2020-12-02 18:45

can't compile tests on os x Undefined symbols for architecture x86_64 libiconv

I am unable to compile the tests on os x yosemite 10 .10.1

weechat compiles fine, outside of the tests. I tried compiling iconv from scratch with gcc, i have tried installing with homebrew as well (which uses clang, the default compiler). I have also tried modifying FindIconv.cmake to point directly to the lib location

The x86_64 libraries exist

$ file /usr/local/lib/libiconv.dylib 
/usr/local/lib/libiconv.dylib: Mach-O universal binary with 2 architectures
/usr/local/lib/libiconv.dylib (for architecture i386):  Mach-O dynamically linked shared library i386
/usr/local/lib/libiconv.dylib (for architecture x86_64):    Mach-O 64-bit dynamically linked shared library x86_64

I also tried adding /usr/local/opt/ to the library paths to the FindIconv.cmake (those libraries are symlinked to the homebrew locations)

"Looking for libiconv_open in iconv - not found" is what i think is the problem, but I don't know exactly know what that means.

(i know how to fix the cppunit error so disregard that error)

This is the output from when I try and configure and make

cmake .. -DPREFIX=~/Workspace/weechat -DENABLE_TESTS=ON -DCMAKE_CXX_COMPILER=/usr/local/bin/g++-4.9 -DCMAKE_C_COMPILER=/usr/local/bin/gcc-4.9
-- The C compiler identification is GNU 4.9.2
-- Checking whether C compiler has -isysroot
-- Checking whether C compiler has -isysroot - yes
-- Checking whether C compiler supports OSX deployment target flag
-- Checking whether C compiler supports OSX deployment target flag - yes
-- Check for working C compiler: /usr/local/bin/gcc-4.9
-- Check for working C compiler: /usr/local/bin/gcc-4.9 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Looking for include file langinfo.h
-- Looking for include file langinfo.h - found
-- Looking for include file sys/resource.h
-- Looking for include file sys/resource.h - found
-- Looking for mallinfo
-- Looking for mallinfo - not found
-- Looking for eat_newline_glitch
-- Looking for eat_newline_glitch - found
-- Looking for include file libintl.h
-- Looking for include file libintl.h - not found
-- Found GCRYPT: -L/usr/local/Cellar/libgcrypt/1.6.2/lib -lgcrypt -L/usr/local/Cellar/libgpg-error/1.17/lib -lgpg-error 
-- Found ZLIB: /usr/lib/libz.dylib (found version "1.2.5")
-- Looking for libiconv_open in iconv
-- Looking for libiconv_open in iconv - not found
-- Looking for iconv_open in iconv
-- Looking for iconv_open in iconv - found
-- Performing Test ICONV_2ARG_IS_CONST
-- Performing Test ICONV_2ARG_IS_CONST - Failed
-- Found CURL: /usr/lib/libcurl.dylib (found version "7.37.1") 
-- Looking for flock
-- Looking for flock - found
-- Looking for backtrace
-- Looking for backtrace - found
-- checking for one of the modules 'ruby-2.1;ruby-2.0;ruby-1.9;ruby-1.8'
-- checking for one of the modules 'lua5.2;lua-5.2;lua52;lua5.1;lua-5.1;lua51;lua-5.0;lua5.0;lua50;lua'
-- Found Tclsh: /usr/bin/tclsh (found version "8.5") 
-- checking for one of the modules 'guile-2.0'
-- Looking for include file ncursesw/ncurses.h
-- Looking for include file ncursesw/ncurses.h - found
-- The CXX compiler identification is GNU 4.9.2
-- Checking whether CXX compiler has -isysroot
-- Checking whether CXX compiler has -isysroot - yes
-- Checking whether CXX compiler supports OSX deployment target flag
-- Checking whether CXX compiler supports OSX deployment target flag - yes
-- Check for working CXX compiler: /usr/local/bin/g++-4.9
-- Check for working CXX compiler: /usr/local/bin/g++-4.9 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- checking for one of the modules 'cpputest'
--   found cpputest, version 3.6
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/abeach/Workspace/weechat/build
Alexadners-MacBook-Air:build abeach$ make
Scanning dependencies of target version_git
Creating file config-git.h with git version: "v1.0-271-g1f1611c"
[  0%] Built target version_git
Scanning dependencies of target weechat_core
[  0%] Building C object src/core/CMakeFiles/weechat_core.dir/weechat.o
[  1%] Building C object src/core/CMakeFiles/weechat_core.dir/wee-arraylist.o
[  1%] Building C object src/core/CMakeFiles/weechat_core.dir/wee-backtrace.o
[  2%] Building C object src/core/CMakeFiles/weechat_core.dir/wee-command.o
[  3%] Building C object src/core/CMakeFiles/weechat_core.dir/wee-completion.o
[  3%] Building C object src/core/CMakeFiles/weechat_core.dir/wee-config.o
[  4%] Building C object src/core/CMakeFiles/weechat_core.dir/wee-config-file.o
[  4%] Building C object src/core/CMakeFiles/weechat_core.dir/wee-debug.o
[  5%] Building C object src/core/CMakeFiles/weechat_core.dir/wee-eval.o
[  6%] Building C object src/core/CMakeFiles/weechat_core.dir/wee-hashtable.o
[  6%] Building C object src/core/CMakeFiles/weechat_core.dir/wee-hdata.o
[  7%] Building C object src/core/CMakeFiles/weechat_core.dir/wee-hook.o
[  8%] Building C object src/core/CMakeFiles/weechat_core.dir/wee-infolist.o
[  8%] Building C object src/core/CMakeFiles/weechat_core.dir/wee-input.o
[  9%] Building C object src/core/CMakeFiles/weechat_core.dir/wee-list.o
[  9%] Building C object src/core/CMakeFiles/weechat_core.dir/wee-log.o
[ 10%] Building C object src/core/CMakeFiles/weechat_core.dir/wee-network.o
[ 11%] Building C object src/core/CMakeFiles/weechat_core.dir/wee-proxy.o
[ 11%] Building C object src/core/CMakeFiles/weechat_core.dir/wee-secure.o
[ 12%] Building C object src/core/CMakeFiles/weechat_core.dir/wee-string.o
[ 12%] Building C object src/core/CMakeFiles/weechat_core.dir/wee-upgrade.o
[ 13%] Building C object src/core/CMakeFiles/weechat_core.dir/wee-upgrade-file.o
[ 14%] Building C object src/core/CMakeFiles/weechat_core.dir/wee-url.o
[ 14%] Building C object src/core/CMakeFiles/weechat_core.dir/wee-utf8.o
[ 15%] Building C object src/core/CMakeFiles/weechat_core.dir/wee-util.o
[ 16%] Building C object src/core/CMakeFiles/weechat_core.dir/wee-version.o
Linking C static library libweechat_core.a
[ 16%] Built target weechat_core
Scanning dependencies of target weechat_plugins
[ 16%] Building C object src/plugins/CMakeFiles/weechat_plugins.dir/plugin.o
[ 17%] Building C object src/plugins/CMakeFiles/weechat_plugins.dir/plugin-api.o
[ 18%] Building C object src/plugins/CMakeFiles/weechat_plugins.dir/plugin-config.o
Linking C static library libweechat_plugins.a
[ 18%] Built target weechat_plugins
Scanning dependencies of target weechat_plugins_scripts
[ 18%] Building C object src/plugins/CMakeFiles/weechat_plugins_scripts.dir/plugin-script.o
[ 19%] Building C object src/plugins/CMakeFiles/weechat_plugins_scripts.dir/plugin-script-api.o
[ 20%] Building C object src/plugins/CMakeFiles/weechat_plugins_scripts.dir/plugin-script-callback.o
Linking C static library libweechat_plugins_scripts.a
[ 20%] Built target weechat_plugins_scripts
Scanning dependencies of target alias
[ 20%] Building C object src/plugins/alias/CMakeFiles/alias.dir/alias.o
[ 21%] Building C object src/plugins/alias/CMakeFiles/alias.dir/alias-config.o
[ 21%] Building C object src/plugins/alias/CMakeFiles/alias.dir/alias-info.o
Linking C shared module alias.so
[ 21%] Built target alias
Scanning dependencies of target charset
[ 22%] Building C object src/plugins/charset/CMakeFiles/charset.dir/charset.o
Linking C shared module charset.so
[ 22%] Built target charset
Scanning dependencies of target exec
[ 23%] Building C object src/plugins/exec/CMakeFiles/exec.dir/exec.o
[ 23%] Building C object src/plugins/exec/CMakeFiles/exec.dir/exec-buffer.o
[ 24%] Building C object src/plugins/exec/CMakeFiles/exec.dir/exec-command.o
[ 24%] Building C object src/plugins/exec/CMakeFiles/exec.dir/exec-completion.o
[ 25%] Building C object src/plugins/exec/CMakeFiles/exec.dir/exec-config.o
Linking C shared module exec.so
[ 25%] Built target exec
Scanning dependencies of target fifo
[ 26%] Building C object src/plugins/fifo/CMakeFiles/fifo.dir/fifo.o
[ 26%] Building C object src/plugins/fifo/CMakeFiles/fifo.dir/fifo-info.o
Linking C shared module fifo.so
[ 26%] Built target fifo
Scanning dependencies of target irc
[ 27%] Building C object src/plugins/irc/CMakeFiles/irc.dir/irc.o
[ 28%] Building C object src/plugins/irc/CMakeFiles/irc.dir/irc-bar-item.o
[ 28%] Building C object src/plugins/irc/CMakeFiles/irc.dir/irc-buffer.o
[ 29%] Building C object src/plugins/irc/CMakeFiles/irc.dir/irc-channel.o
[ 29%] Building C object src/plugins/irc/CMakeFiles/irc.dir/irc-color.o
[ 30%] Building C object src/plugins/irc/CMakeFiles/irc.dir/irc-command.o
[ 31%] Building C object src/plugins/irc/CMakeFiles/irc.dir/irc-completion.o
[ 31%] Building C object src/plugins/irc/CMakeFiles/irc.dir/irc-config.o
[ 32%] Building C object src/plugins/irc/CMakeFiles/irc.dir/irc-ctcp.o
[ 32%] Building C object src/plugins/irc/CMakeFiles/irc.dir/irc-debug.o
[ 33%] Building C object src/plugins/irc/CMakeFiles/irc.dir/irc-ignore.o
[ 34%] Building C object src/plugins/irc/CMakeFiles/irc.dir/irc-info.o
[ 34%] Building C object src/plugins/irc/CMakeFiles/irc.dir/irc-input.o
[ 35%] Building C object src/plugins/irc/CMakeFiles/irc.dir/irc-message.o
[ 36%] Building C object src/plugins/irc/CMakeFiles/irc.dir/irc-mode.o
[ 36%] Building C object src/plugins/irc/CMakeFiles/irc.dir/irc-msgbuffer.o
[ 37%] Building C object src/plugins/irc/CMakeFiles/irc.dir/irc-nick.o
[ 37%] Building C object src/plugins/irc/CMakeFiles/irc.dir/irc-notify.o
[ 38%] Building C object src/plugins/irc/CMakeFiles/irc.dir/irc-protocol.o
[ 39%] Building C object src/plugins/irc/CMakeFiles/irc.dir/irc-raw.o
[ 39%] Building C object src/plugins/irc/CMakeFiles/irc.dir/irc-redirect.o
[ 40%] Building C object src/plugins/irc/CMakeFiles/irc.dir/irc-sasl.o
[ 40%] Building C object src/plugins/irc/CMakeFiles/irc.dir/irc-server.o
[ 41%] Building C object src/plugins/irc/CMakeFiles/irc.dir/irc-upgrade.o
Linking C shared module irc.so
[ 41%] Built target irc
Scanning dependencies of target logger
[ 42%] Building C object src/plugins/logger/CMakeFiles/logger.dir/logger.o
[ 42%] Building C object src/plugins/logger/CMakeFiles/logger.dir/logger-buffer.o
[ 43%] Building C object src/plugins/logger/CMakeFiles/logger.dir/logger-config.o
[ 44%] Building C object src/plugins/logger/CMakeFiles/logger.dir/logger-info.o
[ 44%] Building C object src/plugins/logger/CMakeFiles/logger.dir/logger-tail.o
Linking C shared module logger.so
[ 44%] Built target logger
Scanning dependencies of target relay
[ 44%] Building C object src/plugins/relay/CMakeFiles/relay.dir/relay.o
[ 45%] Building C object src/plugins/relay/CMakeFiles/relay.dir/relay-buffer.o
[ 46%] Building C object src/plugins/relay/CMakeFiles/relay.dir/relay-client.o
[ 46%] Building C object src/plugins/relay/CMakeFiles/relay.dir/irc/relay-irc.o
[ 47%] Building C object src/plugins/relay/CMakeFiles/relay.dir/weechat/relay-weechat.o
[ 47%] Building C object src/plugins/relay/CMakeFiles/relay.dir/weechat/relay-weechat-msg.o
[ 48%] Building C object src/plugins/relay/CMakeFiles/relay.dir/weechat/relay-weechat-nicklist.o
[ 49%] Building C object src/plugins/relay/CMakeFiles/relay.dir/weechat/relay-weechat-protocol.o
[ 49%] Building C object src/plugins/relay/CMakeFiles/relay.dir/relay-command.o
[ 50%] Building C object src/plugins/relay/CMakeFiles/relay.dir/relay-completion.o
[ 50%] Building C object src/plugins/relay/CMakeFiles/relay.dir/relay-config.o
[ 51%] Building C object src/plugins/relay/CMakeFiles/relay.dir/relay-info.o
[ 52%] Building C object src/plugins/relay/CMakeFiles/relay.dir/relay-network.o
[ 52%] Building C object src/plugins/relay/CMakeFiles/relay.dir/relay-raw.o
[ 53%] Building C object src/plugins/relay/CMakeFiles/relay.dir/relay-server.o
[ 54%] Building C object src/plugins/relay/CMakeFiles/relay.dir/relay-upgrade.o
[ 54%] Building C object src/plugins/relay/CMakeFiles/relay.dir/relay-websocket.o
Linking C shared module relay.so
[ 54%] Built target relay
Scanning dependencies of target script
[ 55%] Building C object src/plugins/script/CMakeFiles/script.dir/script.o
[ 56%] Building C object src/plugins/script/CMakeFiles/script.dir/script-action.o
[ 56%] Building C object src/plugins/script/CMakeFiles/script.dir/script-buffer.o
[ 57%] Building C object src/plugins/script/CMakeFiles/script.dir/script-command.o
[ 57%] Building C object src/plugins/script/CMakeFiles/script.dir/script-completion.o
[ 58%] Building C object src/plugins/script/CMakeFiles/script.dir/script-config.o
[ 59%] Building C object src/plugins/script/CMakeFiles/script.dir/script-info.o
[ 59%] Building C object src/plugins/script/CMakeFiles/script.dir/script-repo.o
Linking C shared module script.so
[ 59%] Built target script
Scanning dependencies of target perl
[ 60%] Building C object src/plugins/perl/CMakeFiles/perl.dir/weechat-perl.o
[ 60%] Building C object src/plugins/perl/CMakeFiles/perl.dir/weechat-perl-api.o
Linking C shared module perl.so
[ 60%] Built target perl
Scanning dependencies of target python
[ 61%] Building C object src/plugins/python/CMakeFiles/python.dir/weechat-python.o
[ 62%] Building C object src/plugins/python/CMakeFiles/python.dir/weechat-python-api.o
Linking C shared module python.so
[ 62%] Built target python
Scanning dependencies of target ruby
[ 63%] Building C object src/plugins/ruby/CMakeFiles/ruby.dir/weechat-ruby.o
[ 63%] Building C object src/plugins/ruby/CMakeFiles/ruby.dir/weechat-ruby-api.o
Linking C shared module ruby.so
[ 63%] Built target ruby
Scanning dependencies of target tcl
[ 64%] Building C object src/plugins/tcl/CMakeFiles/tcl.dir/weechat-tcl.o
[ 65%] Building C object src/plugins/tcl/CMakeFiles/tcl.dir/weechat-tcl-api.o
Linking C shared module tcl.so
[ 65%] Built target tcl
Scanning dependencies of target trigger
[ 66%] Building C object src/plugins/trigger/CMakeFiles/trigger.dir/trigger.o
[ 66%] Building C object src/plugins/trigger/CMakeFiles/trigger.dir/trigger-buffer.o
[ 67%] Building C object src/plugins/trigger/CMakeFiles/trigger.dir/trigger-callback.o
[ 68%] Building C object src/plugins/trigger/CMakeFiles/trigger.dir/trigger-command.o
[ 68%] Building C object src/plugins/trigger/CMakeFiles/trigger.dir/trigger-completion.o
[ 69%] Building C object src/plugins/trigger/CMakeFiles/trigger.dir/trigger-config.o
Linking C shared module trigger.so
[ 69%] Built target trigger
Scanning dependencies of target xfer
[ 69%] Building C object src/plugins/xfer/CMakeFiles/xfer.dir/xfer.o
[ 70%] Building C object src/plugins/xfer/CMakeFiles/xfer.dir/xfer-buffer.o
[ 71%] Building C object src/plugins/xfer/CMakeFiles/xfer.dir/xfer-chat.o
[ 71%] Building C object src/plugins/xfer/CMakeFiles/xfer.dir/xfer-command.o
[ 72%] Building C object src/plugins/xfer/CMakeFiles/xfer.dir/xfer-completion.o
[ 72%] Building C object src/plugins/xfer/CMakeFiles/xfer.dir/xfer-config.o
[ 73%] Building C object src/plugins/xfer/CMakeFiles/xfer.dir/xfer-dcc.o
[ 74%] Building C object src/plugins/xfer/CMakeFiles/xfer.dir/xfer-file.o
[ 74%] Building C object src/plugins/xfer/CMakeFiles/xfer.dir/xfer-info.o
[ 75%] Building C object src/plugins/xfer/CMakeFiles/xfer.dir/xfer-network.o
[ 76%] Building C object src/plugins/xfer/CMakeFiles/xfer.dir/xfer-upgrade.o
Linking C shared module xfer.so
[ 76%] Built target xfer
Scanning dependencies of target weechat_gui_common
[ 76%] Building C object src/gui/CMakeFiles/weechat_gui_common.dir/gui-bar.o
[ 77%] Building C object src/gui/CMakeFiles/weechat_gui_common.dir/gui-bar-item.o
[ 77%] Building C object src/gui/CMakeFiles/weechat_gui_common.dir/gui-bar-window.o
[ 78%] Building C object src/gui/CMakeFiles/weechat_gui_common.dir/gui-buffer.o
[ 79%] Building C object src/gui/CMakeFiles/weechat_gui_common.dir/gui-chat.o
[ 79%] Building C object src/gui/CMakeFiles/weechat_gui_common.dir/gui-color.o
[ 80%] Building C object src/gui/CMakeFiles/weechat_gui_common.dir/gui-completion.o
[ 80%] Building C object src/gui/CMakeFiles/weechat_gui_common.dir/gui-cursor.o
[ 81%] Building C object src/gui/CMakeFiles/weechat_gui_common.dir/gui-filter.o
[ 82%] Building C object src/gui/CMakeFiles/weechat_gui_common.dir/gui-focus.o
[ 82%] Building C object src/gui/CMakeFiles/weechat_gui_common.dir/gui-history.o
[ 83%] Building C object src/gui/CMakeFiles/weechat_gui_common.dir/gui-hotlist.o
[ 84%] Building C object src/gui/CMakeFiles/weechat_gui_common.dir/gui-input.o
[ 84%] Building C object src/gui/CMakeFiles/weechat_gui_common.dir/gui-key.o
[ 85%] Building C object src/gui/CMakeFiles/weechat_gui_common.dir/gui-layout.o
[ 85%] Building C object src/gui/CMakeFiles/weechat_gui_common.dir/gui-line.o
[ 86%] Building C object src/gui/CMakeFiles/weechat_gui_common.dir/gui-mouse.o
[ 87%] Building C object src/gui/CMakeFiles/weechat_gui_common.dir/gui-nicklist.o
[ 87%] Building C object src/gui/CMakeFiles/weechat_gui_common.dir/gui-window.o
Linking C static library libweechat_gui_common.a
[ 87%] Built target weechat_gui_common
Scanning dependencies of target weechat_gui_curses
[ 88%] Building C object src/gui/curses/CMakeFiles/weechat_gui_curses.dir/gui-curses-bar-window.o
[ 89%] Building C object src/gui/curses/CMakeFiles/weechat_gui_curses.dir/gui-curses-chat.o
[ 89%] Building C object src/gui/curses/CMakeFiles/weechat_gui_curses.dir/gui-curses-color.o
[ 90%] Building C object src/gui/curses/CMakeFiles/weechat_gui_curses.dir/gui-curses-key.o
[ 90%] Building C object src/gui/curses/CMakeFiles/weechat_gui_curses.dir/gui-curses-main.o
[ 91%] Building C object src/gui/curses/CMakeFiles/weechat_gui_curses.dir/gui-curses-mouse.o
[ 92%] Building C object src/gui/curses/CMakeFiles/weechat_gui_curses.dir/gui-curses-term.o
[ 92%] Building C object src/gui/curses/CMakeFiles/weechat_gui_curses.dir/gui-curses-window.o
Linking C static library libweechat_gui_curses.a
[ 92%] Built target weechat_gui_curses
Scanning dependencies of target weechat
[ 93%] Building C object src/gui/curses/CMakeFiles/weechat.dir/main.o
Linking C executable weechat
[ 93%] Built target weechat
Scanning dependencies of target weechat_unit_tests
[ 93%] Building CXX object tests/CMakeFiles/weechat_unit_tests.dir/unit/core/test-arraylist.o
[ 94%] Building CXX object tests/CMakeFiles/weechat_unit_tests.dir/unit/core/test-eval.o
[ 94%] Building CXX object tests/CMakeFiles/weechat_unit_tests.dir/unit/core/test-hashtable.o
[ 95%] Building CXX object tests/CMakeFiles/weechat_unit_tests.dir/unit/core/test-hdata.o
[ 96%] Building CXX object tests/CMakeFiles/weechat_unit_tests.dir/unit/core/test-infolist.o
[ 96%] Building CXX object tests/CMakeFiles/weechat_unit_tests.dir/unit/core/test-list.o
[ 97%] Building CXX object tests/CMakeFiles/weechat_unit_tests.dir/unit/core/test-string.o
[ 97%] Building CXX object tests/CMakeFiles/weechat_unit_tests.dir/unit/core/test-url.o
[ 98%] Building CXX object tests/CMakeFiles/weechat_unit_tests.dir/unit/core/test-utf8.o
[ 99%] Building CXX object tests/CMakeFiles/weechat_unit_tests.dir/unit/core/test-util.o
Linking CXX static library libweechat_unit_tests.a
[ 99%] Built target weechat_unit_tests
Scanning dependencies of target weechat_ncurses_fake
[100%] Building C object tests/CMakeFiles/weechat_ncurses_fake.dir/ncurses-fake.o
Linking C static library libweechat_ncurses_fake.a
[100%] Built target weechat_ncurses_fake
Scanning dependencies of target tests
[100%] Building CXX object tests/CMakeFiles/tests.dir/tests.o
Linking CXX executable tests
Undefined symbols for architecture x86_64:
  "std::bad_alloc::bad_alloc()", referenced from:
      normal_operator_new(unsigned long) in libCppUTest.a(lib_libCppUTest_a-MemoryLeakWarningPlugin.o)
      normal_operator_new_debug(unsigned long, char const*, int) in libCppUTest.a(lib_libCppUTest_a-MemoryLeakWarningPlugin.o)
      normal_operator_new_array(unsigned long) in libCppUTest.a(lib_libCppUTest_a-MemoryLeakWarningPlugin.o)
      normal_operator_new_array_debug(unsigned long, char const*, int) in libCppUTest.a(lib_libCppUTest_a-MemoryLeakWarningPlugin.o)
      mem_leak_operator_new(unsigned long) in libCppUTest.a(lib_libCppUTest_a-MemoryLeakWarningPlugin.o)
      mem_leak_operator_new_debug(unsigned long, char const*, int) in libCppUTest.a(lib_libCppUTest_a-MemoryLeakWarningPlugin.o)
      mem_leak_operator_new_array(unsigned long) in libCppUTest.a(lib_libCppUTest_a-MemoryLeakWarningPlugin.o)
  "_libiconv", referenced from:
      _string_iconv in libweechat_core.a(wee-string.o)
  "_libiconv_close", referenced from:
      _string_iconv in libweechat_core.a(wee-string.o)
  "_libiconv_open", referenced from:
      _string_iconv in libweechat_core.a(wee-string.o)
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make[2]: *** [tests/tests] Error 1
make[1]: *** [tests/CMakeFiles/tests.dir/all] Error 2
make: *** [all] Error 2


  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答


  • weixin_39855634 weixin_39855634 5月前

    OK, then I reopen the issue (and I just saw that the initial problem is not with resolv but with the tests).

    Unfortunately I have no Mac OS X to test, so not easy for me to debug the problem, any help is welcome to understand why my fix does not work.

    点赞 评论 复制链接分享
  • weixin_39744512 weixin_39744512 5月前

    Thanks for reopening. I asked for help.

    点赞 评论 复制链接分享
  • weixin_39855634 weixin_39855634 5月前

    Did you try to delete CMakeCache.txt and make clean, then build again? Sometimes the cache can disturb.

    点赞 评论 复制链接分享
  • weixin_39744512 weixin_39744512 5月前

    I blew away the whole build dir so the cache is not it.

    点赞 评论 复制链接分享
  • weixin_39789979 weixin_39789979 5月前

    Still broken in latest HEAD. :( Cannot build.

    Undefined symbols for architecture x86_64:
      "_res_9_init", referenced from:
          _irc_server_xfer_send_ready_cb in irc-server.o
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    点赞 评论 复制链接分享
  • weixin_39855634 weixin_39855634 5月前

    : I added link with resolv for irc and xfer plugins (where the function res_init() is called). Could you please try again with latest HEAD?

    点赞 评论 复制链接分享
  • weixin_39789979 weixin_39789979 5月前

    Wooo Sebastien, it compiles now! Thank you! 🥇

    点赞 评论 复制链接分享
  • weixin_39855634 weixin_39855634 5月前

    Great, so I close the issue. I hope it's OK for everybody affected by this issue; if not I'll reopen.

    点赞 评论 复制链接分享
  • weixin_39871378 weixin_39871378 5月前

    maybe this is the same or a different issue: I updated the Homebrew formula to weechat 1.6, and it fails to build: https://bot.brew.sh/job/Homebrew%20Core/8869/

    [ 81%] Linking C shared module irc.so
    cd /tmp/weechat-20161007-82251-1kkqbiu/weechat-1.6/build/src/plugins/irc && /usr/local/Cellar/cmake/3.6.2/bin/cmake -E cmake_link_script CMakeFiles/irc.dir/link.txt --verbose=1
    /usr/local/Homebrew/Library/Homebrew/shims/super/clang    -Wall -Wextra -Werror-implicit-function-declaration -DNDEBUG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -mmacosx-version-min=10.11 -bundle -Wl,-headerpad_max_install_names  -o irc.so CMakeFiles/irc.dir/irc.o CMakeFiles/irc.dir/irc-bar-item.o CMakeFiles/irc.dir/irc-buffer.o CMakeFiles/irc.dir/irc-channel.o CMakeFiles/irc.dir/irc-color.o CMakeFiles/irc.dir/irc-command.o CMakeFiles/irc.dir/irc-completion.o CMakeFiles/irc.dir/irc-config.o CMakeFiles/irc.dir/irc-ctcp.o CMakeFiles/irc.dir/irc-debug.o CMakeFiles/irc.dir/irc-ignore.o CMakeFiles/irc.dir/irc-info.o CMakeFiles/irc.dir/irc-input.o CMakeFiles/irc.dir/irc-message.o CMakeFiles/irc.dir/irc-mode.o CMakeFiles/irc.dir/irc-msgbuffer.o CMakeFiles/irc.dir/irc-nick.o CMakeFiles/irc.dir/irc-notify.o CMakeFiles/irc.dir/irc-protocol.o CMakeFiles/irc.dir/irc-raw.o CMakeFiles/irc.dir/irc-redirect.o CMakeFiles/irc.dir/irc-sasl.o CMakeFiles/irc.dir/irc-server.o CMakeFiles/irc.dir/irc-upgrade.o /usr/local/lib/libgnutls.dylib -L/usr/local/opt/libgcrypt/lib -lgcrypt -L/usr/local/opt/libgpg-error/lib -lgpg-error 
    Undefined symbols for architecture x86_64:
      "_res_9_init", referenced from:
          _irc_server_xfer_send_ready_cb in irc-server.o
    ld: symbol(s) not found for architecture x86_64
    点赞 评论 复制链接分享
  • weixin_39744512 weixin_39744512 5月前

    Adding -lresolv as described in homebrew-core #4427 helped with the problem reported. I am on OS X 10.11.6.

    点赞 评论 复制链接分享
  • weixin_39855634 weixin_39855634 5月前

    So is this still an issue?

    点赞 评论 复制链接分享
  • weixin_39744512 weixin_39744512 5月前

    I just tried building HEAD and the issue is still there. Would you mind adding libresolv to ldflags when on macOS as the issue is not with Homebrew but with building weechat on macOS.

    点赞 评论 复制链接分享
  • weixin_39855634 weixin_39855634 5月前

    : fixed. I added a link with resolv in all cases (not only for Mac OS X). Could you please confirm if it's OK for you? Thanks.

    点赞 评论 复制链接分享
  • weixin_39855634 weixin_39855634 5月前

    Hmm compilation faiils on FreeBSD, so I'll condition the link with resolv.

    点赞 评论 复制链接分享
  • weixin_39855634 weixin_39855634 5月前

    Done. Now -lresolv is added only on Mac OS X (see 228040dc04648507d9a57dcc6324d436cd97a4bc).

    点赞 评论 复制链接分享
  • weixin_39744512 weixin_39744512 5月前

    Thanks for adding this. I tried compiling with your latest change but it fails with the same old problem. export LDFLAGS=-lresolv before cmake .. -DCMAKE_INSTALL_PREFIX=/path and the whole thing works.

    点赞 评论 复制链接分享