Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to resolve build errors in OSX cctools?

I am attempting to build tools from the CCtools collection for OSX, under OSX. I am doing this for research purposes.

When I run the makefile for the entire project I get a linker error:

=========== /Applications/Xcode.app/Contents/Developer/usr/bin/make all for misc =============
cc -Os -DLTO_SUPPORT -DTRIE_SUPPORT -g -Wall -I. -I./../include -I.  -I/usr/local/include  -c -o ./lipo.o lipo.c
cc  -nostdlib -r \
        -o ./lipo.private.o \
        ./lipo.o -L./../libstuff -lstuff
cc   -o ./lipo.NEW \
        ./lipo.private.o
Undefined symbols for architecture x86_64:
  "_is_llvm_bitcode_from_memory", referenced from:
      _main in lipo.private.o
      _check_archive in lipo.private.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[1]: *** [lipo.NEW] Error 1
make: *** [all] Error 1

Running the make files of the individual tools nets me a similar linker error. This occurs for all versions of the CCtools I have tried (Including 877.5, the latest source, and 862, the version that my installed tools are at.)

  • What am I missing to make the tools compile?
  • How can I coax the linker to let me know what library I am missing?
  • Where can I find instruction to make the tools compile?

Additional info:

  • I have XCode and developer tools installed, and I build projects all the time.
  • I also have gcc installed from brew.

I must be missing something stupid.

like image 852
MrSynAckSter Avatar asked Jan 24 '26 19:01

MrSynAckSter


1 Answers

I cannot give you the exact solution for your version 877.5 but the overall problem is that the compilation requires some of the LLVM code on your machine. It might be as simple as missing include directories for the LLVM headers or can require linking some of the LLVM libraries. In your case, they seem to be related to LLVM Bitcode somehow.

In my case, I have just built a subset of the more recent version cctools-895. It complained about a missing symbol related to LLVM's llvm-c/lto.h header. The error went away when I added the following to the problematic file's compilation rules:

-I/opt/llvm-7.0.0/include/

The version of LLVM 7 was a random guess that worked because I had it on my machine. You might want to tailor your include paths to point to the correct version of LLVM that the cctools are supposed to be built with.

The easiest way to get the LLVM on your machine is to get a binary version from the LLVM Download page.

like image 91
Stanislav Pankevich Avatar answered Jan 26 '26 11:01

Stanislav Pankevich



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!