Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile Error on macOS High Sierra when lib idn2 is installed #236

Open
tobiasschweizer opened this issue Jun 8, 2018 · 6 comments
Open
Assignees
Milestone

Comments

@tobiasschweizer
Copy link
Contributor

tobiasschweizer commented Jun 8, 2018

I had the following problem when compiling Sipi (develop):

[ 54%] Linking CXX executable sipi
Undefined symbols for architecture x86_64:
  "_idn2_check_version", referenced from:
      _fix_hostname in libcurl.a(libcurl_la-url.o)
      _curl_version in libcurl.a(libcurl_la-version.o)
      _curl_version_info in libcurl.a(libcurl_la-version.o)
  "_idn2_free", referenced from:
      _Curl_disconnect in libcurl.a(libcurl_la-url.o)
      _create_conn in libcurl.a(libcurl_la-url.o)
  "_idn2_lookup_ul", referenced from:
      _fix_hostname in libcurl.a(libcurl_la-url.o)
  "_idn2_strerror", referenced from:
      _fix_hostname in libcurl.a(libcurl_la-url.o)
ld: symbol(s) not found for architecture x86_64

It turned out that my local/lib/libcurl.la looked like this (see build/CMakeFiles/sipi.dir/link.txt for the linking command):

# Libraries that this one depends upon.
dependency_libs=' -L/usr/local/Cellar/openssl/1.0.2o_1/lib -L/usr/local/Cellar/libidn2/2.0.4/lib -lidn2 -lssl -lcrypto -lz'

On my laptop (same OS version, same version of clang) the compilation worked fine and -L/usr/local/Cellar/libidn2/2.0.4/lib -lidn2 was not added as a dependency since it was not even installed.

Steps to resolve my problem:

  • brew remove wget (depends on libidn2)
  • brew remove libidn2

I even have wget installed on my laptop (but without libidn2).

I do not know why this dependency was added in local/lib/libcurl.la for curl. It does not seem correct to me when wget depends on it.

However, all works now and tests pass. I made this issue in case someone has the same problem.

@tobiasschweizer
Copy link
Contributor Author

tobiasschweizer commented Jun 8, 2018

I also had discovered that two versions of clang exist on my iMac:

  • /Library/Developer/CommandLineTools/usr/bin/c++
  • /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++

First, the one from /Library/Developer was used.

xcode-select --reset sets the settings to default which is /Applications/Xcode.app.

@tobiasschweizer
Copy link
Contributor Author

This is the working setup:

macOS High Sierra 10.13.5

$ clang -v
Apple LLVM version 9.1.0 (clang-902.0.39.2)
Target: x86_64-apple-darwin17.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

@tobiasschweizer
Copy link
Contributor Author

Should curl package maintainers enable libidn2 by default or no?

https://curl.haxx.se/mail/lib-2017-10/0157.html

@subotic
Copy link
Contributor

subotic commented Jun 14, 2018

Cool, thanks. I have the same issue, and it solved it.

@ezbinden
Copy link

For me it seems to be a different cause. My output is the following:

[ 54%] Linking CXX executable sipi
Undefined symbols for architecture x86_64:
"_BrotliDecoderCreateInstance", referenced from:
_brotli_init_writer in libcurl.a(libcurl_la-content_encoding.o)
"_BrotliDecoderDecompressStream", referenced from:
_brotli_unencode_write in libcurl.a(libcurl_la-content_encoding.o)
"_BrotliDecoderDestroyInstance", referenced from:
_brotli_unencode_write in libcurl.a(libcurl_la-content_encoding.o)
_brotli_close_writer in libcurl.a(libcurl_la-content_encoding.o)
"_BrotliDecoderGetErrorCode", referenced from:
_brotli_unencode_write in libcurl.a(libcurl_la-content_encoding.o)
"_BrotliDecoderVersion", referenced from:
_curl_version_info in libcurl.a(libcurl_la-version.o)
_brotli_version in libcurl.a(libcurl_la-version.o)
"_idn2_check_version", referenced from:
_fix_hostname in libcurl.a(libcurl_la-url.o)
_curl_version in libcurl.a(libcurl_la-version.o)
_curl_version_info in libcurl.a(libcurl_la-version.o)
"_idn2_free", referenced from:
_Curl_disconnect in libcurl.a(libcurl_la-url.o)
_create_conn in libcurl.a(libcurl_la-url.o)
"_idn2_lookup_ul", referenced from:
_fix_hostname in libcurl.a(libcurl_la-url.o)
"_idn2_strerror", referenced from:
_fix_hostname in libcurl.a(libcurl_la-url.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [sipi] Error 1
make[1]: *** [CMakeFiles/sipi.dir/all] Error 2
make: *** [all] Error 2

I did not have wget installed, neither libidn2. Removing curl did not help either.

My setup is:
macOS Mojave 10.14.2

clang -v
Apple LLVM version 10.0.0 (clang-1000.11.45.5)
Target: x86_64-apple-darwin18.2.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Any ideas? Cheers, E

@lrosenth
Copy link
Collaborator

lrosenth commented Dec 15, 2018 via email

@subotic subotic added this to the Backlog milestone Feb 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants