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

Building on macOS 10.15: ld: symbol(s) not found for architecture x86_64 #783

Open
dvcrn opened this issue Jul 21, 2020 · 10 comments
Open

Comments

@dvcrn
Copy link

dvcrn commented Jul 21, 2020

Trying to build souper on catalina and getting this error on the make step:

Scanning dependencies of target souperweb-backend
[ 32%] Building CXX object CMakeFiles/souperweb-backend.dir/tools/souperweb-backend.cpp.o
[ 33%] Linking CXX executable souperweb-backend
Undefined symbols for architecture x86_64:
  "_DebugLevel", referenced from:
      (anonymous namespace)::BaseSolver::inferConst(std::__1::vector<souper::BlockPCMapping, std::__1::allocator<souper::BlockPCMapping> > const&, std::__1::vector<souper::InstMapping, std::__1::allocator<souper::InstMapping> > const&, souper::Inst*, souper::Inst*&, std::__1::set<souper::Inst*, std::__1::less<souper::Inst*>, std::__1::allocator<souper::Inst*> >&, std::__1::map<souper::Inst*, llvm::APInt, std::__1::less<souper::Inst*>, std::__1::allocator<std::__1::pair<souper::Inst* const, llvm::APInt> > >&, souper::InstContext&) in libsouperExtractor.a(Solver.cpp.o)
      canDifferInLSB(souper::SynthesisContext&, souper::Inst*) in libsouperInfer.a(EnumerativeSynthesis.cpp.o)
      synthesizeWithAlive(souper::SynthesisContext&, std::__1::vector<souper::Inst*, std::__1::allocator<souper::Inst*> >&, std::__1::vector<souper::Inst*, std::__1::allocator<souper::Inst*> > const&) in libsouperInfer.a(EnumerativeSynthesis.cpp.o)
      isConcreteCandidateSat(souper::SynthesisContext&, souper::Inst*, bool&) in libsouperInfer.a(EnumerativeSynthesis.cpp.o)
      synthesizeWithKLEE(souper::SynthesisContext&, std::__1::vector<souper::Inst*, std::__1::allocator<souper::Inst*> >&, std::__1::vector<souper::Inst*, std::__1::allocator<souper::Inst*> > const&) in libsouperInfer.a(EnumerativeSynthesis.cpp.o)
      souper::EnumerativeSynthesis::synthesize(souper::SMTLIBSolver*, std::__1::vector<souper::BlockPCMapping, std::__1::allocator<souper::BlockPCMapping> > const&, std::__1::vector<souper::InstMapping, std::__1::allocator<souper::InstMapping> > const&, souper::Inst*, std::__1::vector<souper::Inst*, std::__1::allocator<souper::Inst*> >&, bool, souper::InstContext&, unsigned int) in libsouperInfer.a(EnumerativeSynthesis.cpp.o)
      souper::AliveDriver::synthesizeConstants(souper::Inst*) in libsouperInfer.a(AliveDriver.cpp.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]: *** [souperweb-backend] Error 1
make[1]: *** [CMakeFiles/souperweb-backend.dir/all] Error 2
make: *** [all] Error 2

deps installed without any issues.

Any idea?

@dvcrn
Copy link
Author

dvcrn commented Jul 21, 2020

Okay I tried debugging this a little (I don't know C++). Given that it complains about DebugLevel and that DebugLevel got added in b85db77, I tried the commit before that and it builds fine

@regehr
Copy link
Collaborator

regehr commented Jul 21, 2020

we'll need a bit more info here... is this a Debug or Release build? what exactly is the toolchain you're using to build? anything else you can tell us?

@dvcrn
Copy link
Author

dvcrn commented Jul 21, 2020

Ah sorry. This was a Release build. Toolchain is clang/llvm

Apple clang version 11.0.3 (clang-1103.0.32.62)
Target: x86_64-apple-darwin19.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

However I tried building it with gcc and gcc-10, and also tried using the clang build that souper itself built inside third_party.

Tried using Ninja instead of make as well

@regehr
Copy link
Collaborator

regehr commented Jul 21, 2020

I'll do a from-scratch build of souper on my mac tonight and see what happens

I'll note that my machine is using a bit newer clang

Johns-MacBook-Pro:~ johnregehr$ clang --version
Apple clang version 11.0.0 (clang-1100.0.33.8)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

I think this is from an xcode update the other day. so I won't reproduce your setup exactly, but pretty close

@regehr
Copy link
Collaborator

regehr commented Jul 22, 2020

ok, I can build souper just fine on OSX and Linux.
there's one failing test on OSX since lit strips environment variables and we can't compile stuff without SDKROOT on OSX, but that's expected and normal until I figure out how to fix that.

not sure how you want to proceed here, but everything works as expected for me.

@dvcrn
Copy link
Author

dvcrn commented Jul 22, 2020

Hrrmm... I tried to build the latest master again but switched xcode-select to /Library/Developer/CommandLineTools/ to replicate your environment

Apple clang version 11.0.3 (clang-1103.0.32.62)
Target: x86_64-apple-darwin19.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
-- The C compiler identification is AppleClang 11.0.3.11030032
-- The CXX compiler identification is AppleClang 11.0.3.11030032
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Alive2: /Users/d/src/souper/third_party/alive2-build/libalive2.dylib
-- Z3 shared lib: /Users/d/src/souper/third_party/z3-install/lib/libz3.dylib
-- Found Doxygen: /usr/local/bin/doxygen (found version "1.8.18") found components: doxygen missing components: dot
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/d/src/souper/build2

It's still not building and failing at the same step I posted above, while the commit before b85db77 works fine.

Is there anything I can try from my side, or information I could provide to help debug this?

@regehr
Copy link
Collaborator

regehr commented Jul 22, 2020

I can't think of a good next thing to try.
you're definitely sure you're on the most recent commit?

@dvcrn
Copy link
Author

dvcrn commented Jul 22, 2020

Absolutely sure. I experimented with SDKROOT as well and tried using a fresh clang compiled from source but no luck. Like I wrote, this also happens with a clean gcc-10 installation from homebrew so it's likely something with my environment that's acting up...

I'll see if I can find some time to experiment with build settings.

For using souper, I at least have something functional with the commit I mentioned above so I take what I can get :)

@regehr
Copy link
Collaborator

regehr commented Jul 22, 2020

ok, thanks for being patient. not sure what's going on here.

I doubt it matters here, but I'm getting cmake and friends from homebrew.

@dvcrn
Copy link
Author

dvcrn commented Jul 30, 2020

Just wanted to update: I have installed the latest Xcode update that you mentioned but sadly no luck.

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