sipi icon indicating copy to clipboard operation
sipi copied to clipboard

Compile Error on macOS High Sierra when lib idn2 is installed

Open tobiasschweizer opened this issue 6 years ago • 6 comments

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 avatar Jun 08 '18 12:06 tobiasschweizer

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 avatar Jun 08 '18 12:06 tobiasschweizer

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 avatar Jun 08 '18 12:06 tobiasschweizer

Should curl package maintainers enable libidn2 by default or no?

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

tobiasschweizer avatar Jun 08 '18 12:06 tobiasschweizer

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

subotic avatar Jun 14 '18 08:06 subotic

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

ezbinden avatar Dec 15 '18 16:12 ezbinden

Seems to be a problem with libcurl - missing library... Will have a look at it...

Lukas

Am 15.12.2018 um 17:45 schrieb ez <[email protected]mailto:[email protected]>:

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

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHubhttps://github.com/dhlab-basel/Sipi/issues/236#issuecomment-447581448, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AFN9zGIzF8BYxvwF22QZa8ULUuLxlw_jks5u5ScigaJpZM4UgBl3.

lrosenth avatar Dec 15 '18 16:12 lrosenth