quick q configuring osx

Sorry if this is a newb q… I’m developing an application on a 10.5 machine but want to target the 10.4 SDK. Is there a magic incantation for the llvm configure script to set the sysroot path, equivalent to e.g. --with-sysroot “/Developer/SDKs/MacOSX10.4u.sdk”?

Thanks.

Try ‘make UNIVERSAL_SDK_PATH=/Developer/SDKs/MacOSX10.4u.sdk/’.

There are some comments in llvm/Makefile.rules that can help,

-Chris

Note that you don’t have to use 10.4 SDK to target Tiger. You just have to set the “macosx version min” (either using the gcc flag -mmacosx-version-min=10.4 or using the MACOSX_DEPLOYMENT_TARGET env var)

env MACOSX_DEPLOYMENT_TARGET=10.4 make

Hi,

For the record, adding
UNIVERSAL_SDK_PATH=/Developer/SDKs/MacOSX10.4u.sdk/
was insufficient to restrict the .a/.o files to link against the 10.4 sdk, but
env MACOSX_DEPLOYMENT_TARGET=10.4 make
did the trick.

Thanks!

Hi all,

(Sorry if the answer to this is obvious - and thanks in advance~)

Short version:
linker error of _backtrace from LLVMSystem.a building a dynamic library embedding LLVM/clang, both against the OSX 10.4 sdk.

Long version:
I’ve just tried rebuilding my project using the 2.6 release, using the following commands to try and force LLVM to build against the OSX 10.4 sdk (I am actually doing this on an OS X 10.5.8 system):

env MACOSX_DEPLOYMENT_TARGET=10.4 ./configure --enable-targets=x86 --enable-jit --enable-optimized --enable-pic
env MACOSX_DEPLOYMENT_TARGET=10.4 make UNIVERSAL_SDK_PATH=/Developer/SDKs/MacOSX10.4u.sdk/

This seems to work fine.

However, my project is a dynamic library in which LLVM/Clang are embedded for adding runtime JIT capability to an existing application, but in attempting to build, I get a linker error on _backtrace from LLVMSystem.a.

Is this a simple mistake on my part, or is LLVM not supported against the 10.4 sdk? The problem disappears if I build against 10.5 sdk (using llvm-gcc 4.2), but unfortunately that’s not possible for the application in question. Here’s the (abriged) build command:

CompileC build/Objects-normal/i386/gen_codegen.o gen_codegen.cpp normal i386 c++ com.apple.compilers.gcc.4_0
cd llvm
/Developer/usr/bin/gcc-4.0 -x c++ -arch i386 -fmessage-length=0 -pipe -Wno-trigraphs -fpascal-strings -fasm-blocks -O0 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -fvisibility-inlines-hidden -mmacosx-version-min=10.4 -gdwarf-2 -iquote /build/codegen.build/codegen-generated-files.hmap -I/llvm/build/codegen.build/codegen-own-target-headers.hmap -I/codegen.build/codegen-all-target-headers.hmap -iquote /build/codegen.build/codegen-project-headers.hmap -Wmost -Wno-four-char-constants -Wno-unknown-pragmas -F/build/Development -I/Developer/SDKs/MacOSX10.4u.sdk/Developer/Headers/FlatCarbon -I/llvm/llvm-2.6/include -I/build/codegen.build/DerivedSources -DLUA_USE_MACOSX -DLUA_USE_DLOPEN -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -include /macho-prefix.pch -c /llvm/gen_codegen.cpp -o /build/codegen.build/Objects-normal/i386/gen_codegen.o

Ld “/sysbuild/Development/codegen.mxo/Contents/MacOS/codegen” normal i386
cd /llvm
setenv MACOSX_DEPLOYMENT_TARGET 10.4
/Developer/usr/bin/g+±4.0 -arch i386 -bundle -isysroot /Developer/SDKs/MacOSX10.4u.sdk -L/build/Development -L/llvm-2.6/lib_osx -F/build/Development -filelist /build/codegen.build/Objects-normal/i386/codegen.LinkFileList -mmacosx-version-min=10.4 -lCompilerDriver -lLLVMAnalysis -lLLVMArchive -lLLVMAsmParser -lLLVMAsmPrinter -lLLVMBitReader -lLLVMBitWriter -lLLVMCodeGen -lLLVMCore -lLLVMDebugger -lLLVMExecutionEngine -lLLVMInstrumentation -lLLVMInterpreter -lLLVMipa -lLLVMipo -lLLVMJIT -lLLVMLinker -lLLVMMC -lLLVMScalarOpts -lLLVMSelectionDAG -lLLVMSupport -lLLVMSystem -lLLVMTarget -lLLVMTransformUtils -lLLVMX86AsmParser -lLLVMX86AsmPrinter -lLLVMX86CodeGen -lLLVMX86Info -lLTO -lLTO -lplugin_llvmc_Base -lplugin_llvmc_Clang -lprofile_rt -framework MaxAudioAPI -framework MaxAPI -framework Carbon -o “/sysbuild/Development/codegen.mxo/Contents/MacOS/codegen”
Undefined symbols:
“_backtrace”, referenced from:
PrintStackTrace(void*) in libLLVMSystem.a(Signals.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status

Hi all,

(Sorry if the answer to this is obvious - and thanks in advance~)

Short version:
linker error of _backtrace from LLVMSystem.a building a dynamic library embedding LLVM/clang, both against the OSX 10.4 sdk.

Long version:
I’ve just tried rebuilding my project using the 2.6 release, using the following commands to try and force LLVM to build against the OSX 10.4 sdk (I am actually doing this on an OS X 10.5.8 system):

env MACOSX_DEPLOYMENT_TARGET=10.4 ./configure --enable-targets=x86 --enable-jit --enable-optimized --enable-pic
env MACOSX_DEPLOYMENT_TARGET=10.4 make UNIVERSAL_SDK_PATH=/Developer/SDKs/MacOSX10.4u.sdk/

This seems to work fine.

However, my project is a dynamic library in which LLVM/Clang are embedded for adding runtime JIT capability to an existing application, but in attempting to build, I get a linker error on _backtrace from LLVMSystem.a.

Is this a simple mistake on my part, or is LLVM not supported against the 10.4 sdk? The problem disappears if I build against 10.5 sdk (using llvm-gcc 4.2), but unfortunately that’s not possible for the application in question. Here’s the (abriged) build command:

I don’t think anyone really tries it against 10.4, but it should work in principle. The trick is to configure llvm with the 10.4 SDK, otherwise autoconf will think that backtrace exists. I’m not exactly how to do this. Another option is to hack out ‘#define HAVE_BACKTRACE 1’ from include/llvm/Config/config.h after you configure.

-Chris

Hi,

Couldn’t figure out how to tell autoconf to ignore my system’s properties, but modifying config.h worked.
I also had to push the llvm/clang includes into user includes, to prevent Carbon headers from finding LLVM’s string.h etc. (-iquote rather than -I).

Thanks~