Opened 15 years ago

Closed 9 years ago

#24059 closed defect (fixed)

curl: configure failure with +universal variant: cannot check for file existence when cross compiling

Reported by: keybounce Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version: 1.8.2
Keywords: universal Cc: drechsel@…, keybounce, dpbassid@…, cooljeanius (Eric Gallager)
Port: curl

Description

Attempting to install curl +universal on a 10.5.8 PPC machine results in an error: cannot check for /dev/urandom when compiling universal.

Attempting to use the -d flag before "install" results in a different error message.

Attachments (2)

curl-fail-no-d.txt (243 bytes) - added by keybounce 15 years ago.
Error message when compiled without the -d flag
curl-fail.txt (53.3 KB) - added by keybounce 15 years ago.
Failed compile with -d flag

Download all attachments as: .zip

Change History (20)

Changed 15 years ago by keybounce

Attachment: curl-fail-no-d.txt added

Error message when compiled without the -d flag

comment:1 Changed 15 years ago by keybounce

Cc: keybounce@… added

Cc Me!

comment:2 Changed 15 years ago by keybounce

So it turns out that even trying to recompile it without the -d flag now gives the same error, in the same place. The first time, it did configuration for PPC, and then failed to configure for i386. Now, it won't configure for either.

Cleaning and try again ...

Changed 15 years ago by keybounce

Attachment: curl-fail.txt added

Failed compile with -d flag

comment:3 Changed 15 years ago by keybounce

Alright, there's the complete debug output this time.

I cannot uncheck "leave as new".

comment:4 Changed 15 years ago by mf2k (Frank Schima)

Cc: keybounce@… removed
Owner: changed from macports-tickets@… to ryandesign@…
Port: curl added

comment:5 Changed 15 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: drechsel@… added
Summary: Cannot compile curl universalcurl +universal ppc/i386 fails on PowerPC

Has duplicate #24087.

comment:6 Changed 15 years ago by ryandesign (Ryan Carsten Schmidt)

Michael Gersten provided the following additional feedback by email:

Alright, the configure file for curl has this:

 dnl Check for user-specified random device
 AC_ARG_WITH(random,
 AC_HELP_STRING([--with-random=FILE],
                [read randomness from FILE (default=/dev/urandom)]),
     [ RANDOM_FILE="$withval" ],
     [
         dnl Check for random device
         AC_CHECK_FILE("/dev/urandom", [ RANDOM_FILE="/dev/urandom"] )
     ]
 )
 if test -n "$RANDOM_FILE" && test X"$RANDOM_FILE" != Xno ; then
         AC_SUBST(RANDOM_FILE)
         AC_DEFINE_UNQUOTED(RANDOM_FILE, "$RANDOM_FILE",
         [a suitable file to read random data from])
 fi

This is the only place where AC_CHECK_FILE is used, and this is what triggers the cross compile warning.

I don't know autoconf. Is there some way to specify that the default file is "/dev/urandom" without having to test for its existence? Technically, a file check should fail any time the destination is a different operating system, not a different target for the same operating system, so the AC_CHECK_FILE test is failing in error.

(Heck, a change from one OS version to another might move a file, and invalidate a test like this.)

Last edited 9 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:7 in reply to:  6 Changed 15 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to keybounce@…:

I don't know autoconf. Is there some way to specify that the default file is "/dev/urandom" without having to test for its existence?

I think there probably is. I have not been able to test this however because I am encountering a different configure error on my PowerPC system.

comment:8 Changed 15 years ago by jmroot (Joshua Root)

You should just need to pass --with-random=/dev/urandom to configure to make it use this value and thus skip the check.

comment:9 Changed 15 years ago by keybounce

Some more checking shows that this uses cmake.

Kleiman-ibook:curl-7.20.0 michael$ egrep urandom CMake*
CMakeLists.txt:find_file(RANDOM_FILE urandom /dev)

Produces in configure.ac

Kleiman-ibook:curl-7.20.0 michael$ egrep urandom configure.ac 
                 [read randomness from FILE (default=/dev/urandom)]),
          AC_CHECK_FILE("/dev/urandom", [ RANDOM_FILE="/dev/urandom"] )

Which produces in configure, at line 19790, a test and error message.

It is easy enough to modify configure to not report the error, and just continue. But I don't know how to modify the source (cmake) to avoid generating the error test.

You should just need to pass --with-random=/dev/urandom to configure to make it use this value and thus skip the check.

But how do you get the port command to do this automatically during a build?

comment:10 Changed 15 years ago by keybounce

Cc: keybounce@… added

Cc Me!

comment:11 Changed 15 years ago by keybounce

Actually, that doesn't suffice.

Error: Target org.macports.destroot returned: /opt/local/bin/curl-config differs in /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_net_curl/work/destroot-powerpc and /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_net_curl/work/destroot-intel and cannot be merged

How different are these two files?

Kleiman-ibook:work michael$ diff destroot-intel/opt/local/bin/curl-config destroot-powerpc/opt/local/bin/curl-config 
140c140
< 	  echo ${CURLLIBDIR}-lcurl -L/opt/local/lib  -L/opt/local/lib -lidn -lssl -lcrypto -lz 
---
> 	  echo ${CURLLIBDIR}-lcurl -L/opt/local/lib  -L/opt/local/lib -L/opt/local/lib -lidn -lssl -lcrypto -lssl -lcrypto -lz -lz 
142c142
< 	  echo ${CURLLIBDIR}-lcurl -L/opt/local/lib  -L/opt/local/lib 
---
> 	  echo ${CURLLIBDIR}-lcurl -L/opt/local/lib  -L/opt/local/lib -L/opt/local/lib 
147c147
< 	echo ${exec_prefix}/lib/libcurl.a -L/opt/local/lib  -L/opt/local/lib -lidn -lssl -lcrypto -lz 
---
> 	echo ${exec_prefix}/lib/libcurl.a -L/opt/local/lib  -L/opt/local/lib -L/opt/local/lib -lidn -lssl -lcrypto -lssl -lcrypto -lz -lz 
151c151
<       echo " '--prefix=/opt/local' '--enable-ipv6' '--without-gnutls' '--without-gssapi' '--without-libssh2' '--without-spnego' '--disable-ares' '--disable-ldap' '--disable-ldaps' '--with-libidn' '--with-zlib=/opt/local' '--disable-dependency-tracking' '--with-ssl' '--with-ca-bundle=/opt/local/share/curl/curl-ca-bundle.crt' '--host=i386-apple-darwin9.8.0' 'host_alias=i386-apple-darwin9.8.0' 'CC=/usr/bin/gcc-4.0' 'CFLAGS=-O2 ' 'LDFLAGS=-L/opt/local/lib ' 'CPPFLAGS=-I/opt/local/include'"
---
>       echo " '--prefix=/opt/local' '--enable-ipv6' '--without-gnutls' '--without-gssapi' '--without-libssh2' '--without-spnego' '--disable-ares' '--disable-ldap' '--disable-ldaps' '--with-libidn' '--with-zlib=/opt/local' '--disable-dependency-tracking' '--with-ssl' '--with-ca-bundle=/opt/local/share/curl/curl-ca-bundle.crt' 'CC=/usr/bin/gcc-4.0' 'CFLAGS=-O2 ' 'LDFLAGS=-L/opt/local/lib ' 'CPPFLAGS=-I/opt/local/include'"

Duplicates of " -L/opt/local/lib" in one, --host and host_alias in the other.

Given that the host flags will change for cross compilation, how can this possibly be resolved? The config files have to be different.

comment:12 in reply to:  11 Changed 15 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to keybounce@…:

You should just need to pass --with-random=/dev/urandom to configure to make it use this value and thus skip the check.

But how do you get the port command to do this automatically during a build?

I would need to modify the portfile to include that configure argument. I have not yet done so because I have not yet reproduced the issue nor verified that this fixes it.

Replying to keybounce@…:

Given that the host flags will change for cross compilation, how can this possibly be resolved? The config files have to be different.

This is an unrelated issue already filed as #24001; continue any discussion about this there.

comment:13 Changed 14 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: dpbassid@… added
Keywords: universal added

Has duplicate #28862. I have still not reproduced this issue. But now that #24001 has been resolved, I will again attempt to do so.

comment:14 Changed 14 years ago by dpbassid@…

On my G4 OSX 10.5.8 system, /dev is an alias that points to nothing and there is no file named "urandom" anywhere on my drive.

comment:15 in reply to:  14 ; Changed 14 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to dpbassid@…:

On my G4 OSX 10.5.8 system, /dev is an alias that points to nothing

That might be how it appears in the Finder (if you have configured your Finder to show hidden items), but it is in fact a directory. You can look inside it in the Terminal using a command like "ls -l /dev"

and there is no file named "urandom" anywhere on my drive.

"urandom", like everything else in /dev, is a device, not a regular file.

comment:16 in reply to:  15 Changed 14 years ago by dpbassid@…

it is in fact a directory.

Right -- sorry I wasn't clear. Get Info shows it's an alias for a (system) directory and that it doesn't point to anything.

"urandom", like everything else in /dev, is a device, not a regular file.

Thanks for the clarification.

Just wanted to provide as many clues as possible, and those seemed potentially relevant.

comment:17 Changed 11 years ago by cooljeanius (Eric Gallager)

Cc: egall@… added

Cc Me!

comment:18 in reply to:  11 Changed 9 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: newclosed
Summary: curl +universal ppc/i386 fails on PowerPCcurl: configure failure with +universal variant: cannot check for file existence when cross compiling

Replying to jmr@…:

You should just need to pass --with-random=/dev/urandom to configure to make it use this value and thus skip the check.

That would presumably have fixed it, but that became unnecessary when upstream changed their code in May 2011 to no longer test for that file when cross-compiling. The version of curl currently in MacPorts contains the revised code, so it no longer has this problem.

Replying to keybounce@…:

Actually, that doesn't suffice.

Duplicates of " -L/opt/local/lib" in one,

I'll handle that issue in #32287.

--host and host_alias in the other.

That was handled in #24001.

Note: See TracTickets for help on using tickets.