Build on Mac OS X

Hi all,
I'm trying to build LLVM+clang on a Mac Mini G4 with OS X 10.4.11:
Darwin user-users-mac-mini.local 8.11.0 Darwin Kernel Version 8.11.0:
Wed Oct 10 18:26:00 PDT 2007; root:xnu-792.24.17~1/RELEASE_PPC Power
Macintosh powerpc

with
GCC 4.5.2 from Mac Ports:

Target: ppc-apple-darwin8
Configured with: ../gcc-4.5.2/configure --prefix=/opt/local
--build=ppc-apple-darwin8
--enable-languages=c,c++,objc,obj-c++,fortran,java
--libdir=/opt/local/lib/gcc45 --includedir=/opt/local/include/gcc45
--infodir=/opt/local/share/info --mandir=/opt/local/share/man
--datarootdir=/opt/local/share/gcc-4.5 --with-local-prefix=/opt/local
--with-system-zlib --disable-nls --program-suffix=-mp-4.5
--with-gxx-include-dir=/opt/local/include/gcc45/c++/
--with-gmp=/opt/local --with-mpfr=/opt/local --with-mpc=/opt/local
--enable-stage1-checking --disable-multilib --with-dwarf2
Thread model: posix
gcc version 4.5.2 (GCC)

But the build fails:

make -C lto all
llvm[2]: Linking Release+Asserts Shared Library libLTO.dylib
/opt/local/bin/g++-mp-4.5 -I/Users/useruser/LLVM/build-release/include
-I/Users/useruser/LLVM/build-release/tools/lto
-I/Users/useruser/LLVM/llvm/include
-I/Users/useruser/LLVM/llvm/tools/lto -D_DEBUG -D_GNU_SOURCE
-D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -O3 -fno-exceptions
-fno-rtti -fno-common -Woverloaded-virtual -Wcast-qual -O3
-L/Users/useruser/LLVM/build-release/Release+Asserts/lib
-L/Users/useruser/LLVM/build-release/Release+Asserts/lib
-mmacosx-version-min=10.4 -pedantic -Wno-long-long -Wall -W
-Wno-unused-parameter -Wwrite-strings -dynamiclib
-mmacosx-version-min=10.4 -o
/Users/useruser/LLVM/build-release/Release+Asserts/lib/libLTO.dylib
/Users/useruser/LLVM/build-release/tools/lto/Release+Asserts/LTOCodeGenerator.o
/Users/useruser/LLVM/build-release/tools/lto/Release+Asserts/LTOModule.o
/Users/useruser/LLVM/build-release/tools/lto/Release+Asserts/lto.o \
   -lLLVMMCDisassembler -lLLVMBitWriter -lLLVMLinker -lLLVMArchive
-lLLVMBitReader -lLLVMipo -lLLVMPTXCodeGen -lLLVMPTXInfo
-lLLVMMBlazeDisassembler -lLLVMMBlazeAsmParser -lLLVMMBlazeCodeGen
-lLLVMMBlazeAsmPrinter -lLLVMMBlazeInfo -lLLVMCppBackend
-lLLVMCppBackendInfo -lLLVMCBackend -lLLVMCBackendInfo
-lLLVMBlackfinCodeGen -lLLVMBlackfinInfo -lLLVMSystemZCodeGen
-lLLVMSystemZInfo -lLLVMMSP430CodeGen -lLLVMMSP430AsmPrinter
-lLLVMMSP430Info -lLLVMXCoreCodeGen -lLLVMXCoreInfo
-lLLVMCellSPUCodeGen -lLLVMCellSPUInfo -lLLVMMipsCodeGen
-lLLVMMipsInfo -lLLVMARMDisassembler -lLLVMARMAsmParser
-lLLVMARMCodeGen -lLLVMARMAsmPrinter -lLLVMARMInfo -lLLVMAlphaCodeGen
-lLLVMAlphaInfo -lLLVMPowerPCCodeGen -lLLVMPowerPCAsmPrinter
-lLLVMPowerPCInfo -lLLVMSparcCodeGen -lLLVMSparcInfo
-lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen
-lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMMCParser -lLLVMCodeGen
-lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa
-lLLVMAnalysis -lLLVMTarget -lLLVMX86AsmPrinter -lLLVMX86Utils
-lLLVMCore -lLLVMX86Info -lLLVMMC -lLLVMSupport
-Wl,-exported_symbols_list,/Users/useruser/LLVM/build-release/tools/lto/Release+Asserts/lto.exports.sed
-Wl,-dead_strip -Wl,-seg1addr -Wl,0xE0000000 -lpthread -lm
_LLVMCreateDisasm
_LLVMDisasmDispose
_LLVMDisasmInstruction
/usr/bin/ld: symbols names listed in -exported_symbols_list:
/Users/useruser/LLVM/build-release/tools/lto/Release+Asserts/lto.exports.sed
not in linked objects
collect2: ld returned 1 exit status
make[2]: *** [/Users/useruser/LLVM/build-release/Release+Asserts/lib/libLTO.dylib]
Error 1
make[1]: *** [lto/.makeall] Error 2

Same error with the default GCC:
Target: powerpc-apple-darwin8
Configured with: /var/tmp/gcc/gcc-5370~2/src/configure
--disable-checking -enable-werror --prefix=/usr --mandir=/share/man
--enable-languages=c,objc,c++,obj-c++
--program-transform-name=/^[cg][^.-]*$/s/$/-4.0/
--with-gxx-include-dir=/include/c++/4.0.0 --with-slibdir=/usr/lib
--build=powerpc-apple-darwin8 --host=powerpc-apple-darwin8
--target=powerpc-apple-darwin8
Thread model: posix
gcc version 4.0.1 (Apple Computer, Inc. build 5370)

What could be the problem?

$ cat /Users/useruser/LLVM/build-release/tools/lto/Release+Asserts/lto.exports.sed
_lto_get_error_message
_lto_get_version
_lto_module_create
_lto_module_create_from_fd
_lto_module_create_from_fd_at_offset
_lto_module_create_from_memory
_lto_module_get_num_symbols
_lto_module_get_symbol_attribute
_lto_module_get_symbol_name
_lto_module_get_target_triple
_lto_module_set_target_triple
_lto_module_is_object_file
_lto_module_is_object_file_for_target
_lto_module_is_object_file_in_memory
_lto_module_is_object_file_in_memory_for_target
_lto_module_dispose
_lto_codegen_add_module
_lto_codegen_add_must_preserve_symbol
_lto_codegen_compile
_lto_codegen_create
_lto_codegen_dispose
_lto_codegen_set_debug_model
_lto_codegen_set_pic_model
_lto_codegen_write_merged_modules
_lto_codegen_debug_options
_lto_codegen_set_assembler_args
_lto_codegen_set_assembler_path
_lto_codegen_set_cpu
_lto_codegen_compile_to_file
_LLVMCreateDisasm
_LLVMDisasmDispose
_LLVMDisasmInstruction

Csaba

Hi all,
I'm trying to build LLVM+clang on a Mac Mini G4 with OS X 10.4.11:
Darwin user-users-mac-mini.local 8.11.0 Darwin Kernel Version 8.11.0:
Wed Oct 10 18:26:00 PDT 2007; root:xnu-792.24.17~1/RELEASE_PPC Power
Macintosh powerpc

with
GCC 4.5.2 from Mac Ports:

...

What could be the problem?

Hi Csaba,

I don't exactly know what's going on here, but you're very likely to run into several problems with this configuration:

1. Clang doesn't have real powerpc support.
2. Tiger support is atrophying in LLVM, because no one is using it.
3. Using an FSF GCC on Darwin is asking for trouble.

To get past this error, you could try hacking out the export list, but I wouldn't be surprised if you hit other issues later.

-Chris

Nevertheless it builds fine on Leopard/PPC now.

Well, powerpc (both 32 and 64bit) support is good enough that we can compile a
running "ls" and "sh" on FreeBSD (with a few hack to remove darwinisms).

So it's not completely broken either.