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

linker errors with 2.17: undefined symbols #1148

Open
1 task done
davydden opened this issue Jan 30, 2018 · 6 comments
Open
1 task done

linker errors with 2.17: undefined symbols #1148

davydden opened this issue Jan 30, 2018 · 6 comments

Comments

@davydden
Copy link

davydden commented Jan 30, 2018

Please mark appropriate

  • rtags (rdm/rc/rp)

Problem description

Linking fails on macOS High Sierra when building rtags from Spack package manager with llvm 4.0 build via Apple's clang 9.0.0.

Expected behavior

links

Actual behavior

     241   /Users/davydden/spack/lib/spack/env/clang/clang++   -I/Users/davydden/spack/opt/spack/darwin-highsierra-x86_64/clang-9.0.0-apple/llvm-4.0.0-5pvwluskkrzla3swgvojhsdbjygyy3fz/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Wall -Wextra -Wpointer-arith -Wnon-virtual-dtor -Wformat -Wshadow -std=c++11 -stdlib=libc++ -Wstrict-aliasing=2 -Wcast-qual -fPIC -fstack-protector-all -Wstack-protector -O2 -g -DNDEBUG -Wl,-search_paths_first -Wl,-headerpad_max_install_names  CMakeFiles/rc.dir/rc.cpp.o  -o ../bin/rc -Wl,-rpath,/Users/davydden/spack/opt/spack/darwin-highsierra-x86_64/clang-9.0.0-apple/llvm-4.0.0-5pvwluskkrzla3swgvojhsdbjygyy3fz/lib librtags.a /Users/davydden/spack/opt/spack/darwin-highsierra-x86_64/clang-9.0.0-apple/llvm-4.0.0-5pvwluskkrzla3swgvojhsdbjygyy3fz/lib/libclang.dylib -lstdc++ -lpthread /Users/davydden/spack/opt/spack/darwin-highsierra-x86_64/clang-9.0.0-apple/zlib-1.2.11-t74siw3tvuz3vfb3rje5mkbiwneuzfb5/lib/libz.dylib /Users/davydden/spack/opt/spack/darwin-highsierra-x86_64/clang-9.0.0-apple/openssl-1.0.2k-u7nfvs3zafwtpadau4cuumzrxlylr2oc/lib/libcrypto.dylib -framework CoreServices -framework CoreFoundation
     242   ld: warning: ignoring file librtags.a, file was built for archive which is not the architecture being linked (x86_64): librtags.a
  >> 243   Undefined symbols for architecture x86_64:
     244     "RClient::exec()", referenced from:
     245         _main in rc.cpp.o
     246     "RClient::parse(unsigned long, char**)", referenced from:
     247         _main in rc.cpp.o
     248     "RClient::RClient()", referenced from:
     249         _main in rc.cpp.o
     250     "RClient::~RClient()", referenced from:
     251         _main in rc.cpp.o
     252   ld: symbol(s) not found for architecture x86_64
  >> 253   clang: error: linker command failed with exit code 1 (use -v to see invocation)
  >> 254   make[2]: *** [bin/rc] Error 1
  >> 255   make[1]: *** [src/CMakeFiles/rc.dir/all] Error 2

     259   /Users/davydden/spack/lib/spack/env/clang/clang++   -I/Users/davydden/spack/opt/spack/darwin-highsierra-x86_64/clang-9.0.0-apple/llvm-4.0.0-5pvwluskkrzla3swgvojhsdbjygyy3fz/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Wall -Wextra -Wpointer-arith -Wnon-virtual-dtor -Wformat -Wshadow -std=c++11 -stdlib=libc++ -Wstrict-aliasing=2 -Wcast-qual -fPIC -fstack-protector-all -Wstack-protector -O2 -g -DNDEBUG -Wl,-search_paths_first -Wl,-headerpad_max_install_names  CMakeFiles/rp.dir/rp.cpp.o  -o ../bin/rp -Wl,-rpath,/Users/davydden/spack/opt/spack/darwin-highsierra-x86_64/clang-9.0.0-apple/llvm-4.0.0-5pvwluskkrzla3swgvojhsdbjygyy3fz/lib librtags.a /Users/davydden/spack/opt/spack/darwin-highsierra-x86_64/clang-9.0.0-apple/llvm-4.0.0-5pvwluskkrzla3swgvojhsdbjygyy3fz/lib/libclang.dylib -lstdc++ -lpthread /Users/davydden/spack/opt/spack/darwin-highsierra-x86_64/clang-9.0.0-apple/zlib-1.2.11-t74siw3tvuz3vfb3rje5mkbiwneuzfb5/lib/libz.dylib /Users/davydden/spack/opt/spack/darwin-highsierra-x86_64/clang-9.0.0-apple/openssl-1.0.2k-u7nfvs3zafwtpadau4cuumzrxlylr2oc/lib/libcrypto.dylib -framework CoreServices -framework CoreFoundation
     260   ld: warning: ignoring file librtags.a, file was built for archive which is not the architecture being linked (x86_64): librtags.a
  >> 261   Undefined symbols for architecture x86_64:
     262     "initLogging(char const*, Flags<LogFlag>, LogLevel, Path const&, LogLevel)", referenced from:
     263         _main in rp.cpp.o
     264     "ClangIndexer::sServerOpts", referenced from:
     265         _main in rp.cpp.o
     266         sigHandler(int) in rp.cpp.o
     267     "ClangIndexer::exec(String const&)", referenced from:
     [ ... ]
     290         std::__1::__shared_ptr_emplace<EventLoop, std::__1::allocator<EventLoop> >::~__shared_ptr_emplace() in rp.cpp.o
     291         std::__1::__shared_ptr_emplace<EventLoop, std::__1::allocator<EventLoop> >::~__shared_ptr_emplace() in rp.cpp.o
     292         std::__1::__shared_ptr_emplace<EventLoop, std::__1::allocator<EventLoop> >::__on_zero_shared() in rp.cpp.o
     293     "Path::readAll(unsigned long) const", referenced from:
     294         _main in rp.cpp.o
     295   ld: symbol(s) not found for architecture x86_64

and a couple of others.

Environment

  • Your operating system: macOS 10.13.3

  • LLVM/Clang version: Apple clang 9.0.0

@davydden
Copy link
Author

@Andersbakken ping.

@Andersbakken
Copy link
Owner

This looks very odd. Can you run this command on librtags.a

lipo -info ./src/librtags.a

Can you also try to blow away the whole build directory and rebuild? It seems like it's possible that different sources were compiled with different compilers or flags.

@davydden
Copy link
Author

davydden commented Mar 14, 2018

lipo -info ./src/librtags.a

$ lipo -info librtags.a
input file librtags.a is not a fat file
Non-fat file: librtags.a is architecture: x86_64

Can you also try to blow away the whole build directory and rebuild? It seems like it's possible that different sources were compiled with different compilers or flags.

Not in my case, i build with spack which makes sure that environment is clean and out-of-source build folder is freshly created.

p.s. i build with

'-DCMAKE_EXPORT_COMPILE_COMMANDS=1',
'-DRTAGS_NO_ELISP_FILES=1'

if that makes a difference.

@davydden
Copy link
Author

here is configure/build log:

spack-build.out.zip

@Andersbakken
Copy link
Owner

Andersbakken commented Mar 15, 2018 via email

@davydden
Copy link
Author

Have you tried with the system clang?

it is system clang. It just goes through compiler wrappers which add a few things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants