1
votes

I've built OpenSSL into a custom build directory:

/Users/builder/dev/artifact_staging/temp/openssl

Now when I configure libcurl I point it to use OpenSSL in that directory:

./configure
  --without-zlib \
  --enable-static \
  --enable-ipv6 \
  --with-ssl=/Users/builder/dev/artifact_staging/temp/openssl \
  --host="arm-apple-darwin" \
  --prefix=/Users/builder/dev/artifact_staging/temp/libcurl

The problem is that in the summary report I get at the end of configure it tells me that it will not use SSL:

curl version:     7.59.0
  Host setup:       x86_64-apple-darwin17.5.0
  Install prefix:   /usr/local
  Compiler:         gcc
  SSL support:      no      (--with-{ssl,gnutls,nss,polarssl,mbedtls,cyassl,axtls,winssl,darwinssl} )
  SSH support:      no      (--with-libssh2)
  zlib support:     enabled
  brotli support:   no      (--with-brotli)
  GSS-API support:  no      (--with-gssapi)
  TLS-SRP support:  no      (--enable-tls-srp)
  resolver:         POSIX threaded
  IPv6 support:     enabled
  Unix sockets support: enabled
  IDN support:      enabled (libidn2)
  Build libcurl:    Shared=yes, Static=yes
  Built-in manual:  enabled
  --libcurl option: enabled (--disable-libcurl-option)
  Verbose errors:   enabled (--disable-verbose)
  SSPI support:     no      (--enable-sspi)
  ca cert bundle:   /etc/ssl/cert.pem
  ca cert path:     no
  ca fallback:      no
  LDAP support:     enabled (OpenLDAP)
  LDAPS support:    enabled
  RTSP support:     enabled
  RTMP support:     no      (--with-librtmp)
  metalink support: no      (--with-libmetalink)
  PSL support:      no      (libpsl not found)
  HTTP2 support:    disabled (--with-nghttp2)
  Protocols:        DICT FILE FTP GOPHER HTTP IMAP LDAP LDAPS POP3 RTSP SMTP TELNET TFTP

What am I missing here in my configure call?

UPDATE 1

Some errors found in my config.log file

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/netdb.h:277:17: note: previous declaration is here
int             getnameinfo(const struct sockaddr * __restrict, socklen_t,
                ^
1 error generated.


gcc -o conftest -Qunused-arguments -Os -mmacosx-version-min=10.8 -Werror=partial-availability  -I/usr/local/Cellar/libidn2/2.0.4/include  -L/usr/local/Cellar/libidn2/2.0.4/lib conftest.c -lidn2 -lldap >&5
conftest.c:307:3: error: expected identifier or '('
} # AC-LANG-PROGRAM
  ^
1 error generated.


fatal error: 'ac_nonexistent.h' file not found
#include <ac_nonexistent.h>
         ^~~~~~~~~~~~~~~~~~
1 error generated.


error: use of undeclared identifier 'force'
      force compilation error
      ^
1 error generated.


error: 'bad_t' declared as an array with a negative size
      typedef char bad_t[sizeof(char) == sizeof(int) ? -1 : -1 ];
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

UPDATE 2

After more reading I've made the following modifications. It still is not giving me what I want but I would like to know if I am on the right track.

I've modified my configure parameters with what I think is the correct host:

./configure
  --without-zlib \
  --enable-static \
  --enable-ipv6 \
  --with-ssl=/Users/builder/dev/artifact_staging/temp/openssl \
  --host="arm64-apple-darwin" \
  --prefix=/Users/builder/dev/artifact_staging/temp/libcurl

I've also added a couple of flags:

export CPPFLAGS="-arch=arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk -I/Users/builder/dev/artifact_staging/temp/openssl/include"

export LDFLAGS="-arch=arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk -L/Users/builder/dev/artifact_staging/temp/openssl/lib"

Now when I run configure I still do not end up with ssl support in the end and when I examine the config.log file I see

clang: warning: using sysroot for 'iPhoneOS' but targeting 'MacOSX' [-Wincompatible-sysroot]

I'm not sure what I'm missing here to make it think that I'm targeting MacOSX; every thing that I have done thus far specifies arm64.

There are other actual errors but I think they are a result of it thinking that I'm trying to build for x86_64 rather than arm64.

ld: dynamic main executables must link with libSystem.dylib for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
configure:4386: $? = 1
configure:4424: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "curl"
| #define PACKAGE_TARNAME "curl"
| #define PACKAGE_VERSION "-"
| #define PACKAGE_STRING "curl -"
| #define PACKAGE_BUGREPORT "a suitable curl mailing list: https://curl.haxx.se/mail/"
| #define PACKAGE_URL ""
| /* end confdefs.h.  */
| 
| int main (void)
| {
| 
|  ;
|  return 0;
| }
configure:4429: error: in `/Users/builder/dev/artifact_staging/curl-7.59.0':
configure:4431: error: C compiler cannot create executables

Am I missing a parameter in my flags?

As always when configure doesn't do what you want it, inspect config.log after its completion. Find the specific check that failed and see what more you can learn from those additional details in there.Daniel Stenberg
The config.log file is quite large and to me its not obvious what is going wrong. There are many errors in there but I'm not sure if these errors are the cause of my problem. I would expect any error to halt the configuration rather than let it finish. I updated my original post with some of the errors that I am seeing. The last line in the log is configure: exit 0 which to me means that there was no error which is contradictory to what I'm seeing in the rest of the log.Przemek Lach
you should look for "openssl" in the log, and specifically for the tests that verify that it exists and worksDaniel Stenberg
Ok I think I found it: ld: warning: ld: warning: ignoring file /Users/builder/dev/artifact_staging/temp/openssl/lib/libcrypto.a, file was built for archive which is not the architecture being linked (x86_64): /Users/builder/dev/artifact_staging/temp/openssl/lib/libcrypto.aignoring file /Users/builder/dev/artifact_staging/temp/openssl/lib/libssl.a, file was built for archive which is not the architecture being linked (x86_64): /Users/builder/dev/artifact_staging/temp/openssl/lib/libssl.a It's obvious now. Thank youPrzemek Lach