[LLVMdev] configuring LLVM 2.6 for OSX 10.4sdk on OSX 10.5 system

Graham Wakefield wakefield at mat.ucsb.edu
Mon Oct 26 14:11:30 PDT 2009


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~

On Oct 25, 2009, at 2:21 PM, Chris Lattner wrote:

>
> On Oct 25, 2009, at 1:58 PM, Graham Wakefield wrote:
>
>> 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
>
>>
>> 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
>>
>>
>> On Jan 14, 2009, at 3:43 PM, Graham Wakefield wrote:
>>
>>> 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!
>>>
>>> On Jan 14, 2009, at 1:29 PM, Jean-Daniel Dupas wrote:
>>>
>>>>
>>>> Le 14 janv. 09 à 21:48, Chris Lattner a écrit :
>>>>
>>>>>
>>>>> On Jan 14, 2009, at 12:44 PM, Graham Wakefield wrote:
>>>>>
>>>>>> 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"?
>>>>>>
>>>>> Try 'make UNIVERSAL_SDK_PATH=/Developer/SDKs/MacOSX10.4u.sdk/'.
>>>>>
>>>>> There are some comments in llvm/Makefile.rules that can help,
>>>>
>>>> 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
>>>>
>>>>
>>>> _______________________________________________
>>>> LLVM Developers mailing list
>>>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>>
>>> _______________________________________________
>>> LLVM Developers mailing list
>>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20091026/77b64b21/attachment.html>


More information about the llvm-dev mailing list