compdzwio / ios-toolchain-based-on-clang-for-linux

Automatically exported from code.google.com/p/ios-toolchain-based-on-clang-for-linux
0 stars 0 forks source link

Problems compiling toolchain under Ubuntu 12.10 (64 bit) #8

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
This is a short description of my experience building the toolchain in case 
somebody else finds it useful.

Building cctools (from svn trunk)
*********************************
Had to install: automake, libtool, proz, uuid-dev, libssl-dev

I ran into the following error:

In file included from ../../../../include/mach-o/dyld_priv.h:27:
../../../../include/mach-o/dyld.h:240:12: error: declaration of 
'_NSGetExecutablePath' has a different language linkage
extern int _NSGetExecutablePath( /* SPI first appeared in Mac OS X 10.2 */
           ^
../../../../ld64/src/3rd/helper.h:23:5: note: previous declaration is here
int _NSGetExecutablePath(char *path, unsigned int *size);

I had to add extern "C" to helper.h (see helper.patch)

Building iphonesdk-utils (from svn trunk)
*****************************************
Had to install: libxml2-dev

First error I ran into:

getLocalizedStringFromFile.cpp:108:22: error: no matching function for call to 
‘clang::HeaderSearchOptions::AddPath(std::basic_string<char>&, 
clang::frontend::IncludeDirGroup, bool, bool, bool)’
getLocalizedStringFromFile.cpp:108:22: note: candidate is:
In file included from /usr/include/clang/Frontend/CompilerInvocation.h:23:0,
                 from /usr/include/clang/Frontend/CompilerInstance.h:15,
                 from getLocalizedStringFromFile.cpp:21:
/usr/include/clang/Lex/HeaderSearchOptions.h:124:8: note: void 
clang::HeaderSearchOptions::AddPath(llvm::StringRef, 
clang::frontend::IncludeDirGroup, bool, bool)
/usr/include/clang/Lex/HeaderSearchOptions.h:124:8: note:   candidate expects 4 
arguments, 5 provided

I removed one 'false' argument from the function call (see 
getLocalizedStringFromFile.patch)

Second erorr:

libtool: link: g++ -g -O2 -o ios-genLocalization ios_genLocalization-main.o 
ios_genLocalization-getLocalizedStringFromFile.o  
../libplutil/.libs/libplutil.a ../libhelper/.libs/libhelper.a -lxml2 
-lclangTooling -lclangFrontendTool -lclangFrontend -lclangDriver 
-lclangSerialization -lclangCodeGen -lclangParse -lclangSema 
-lclangStaticAnalyzerFrontend -lclangStaticAnalyzerCheckers 
-lclangStaticAnalyzerCore -lclangAnalysis -lclangARCMigrate -lclangEdit 
-lclangAST -lclangLex -lclangBasic -L/usr/lib -lLLVMAsmParser 
-lLLVMInstrumentation -lLLVMArchive -lLLVMBitReader -lLLVMLinker 
-lLLVMDebugInfo -lLLVMOption -lLLVMipo -lLLVMVectorize -lLLVMBitWriter 
-lLLVMTableGen -lLLVMHexagonCodeGen -lLLVMHexagonAsmPrinter -lLLVMHexagonDesc 
-lLLVMHexagonInfo -lLLVMNVPTXCodeGen -lLLVMNVPTXDesc -lLLVMNVPTXInfo 
-lLLVMNVPTXAsmPrinter -lLLVMMBlazeDisassembler -lLLVMMBlazeCodeGen 
-lLLVMMBlazeDesc -lLLVMMBlazeAsmPrinter -lLLVMMBlazeAsmParser -lLLVMMBlazeInfo 
-lLLVMMSP430CodeGen -lLLVMMSP430Desc -lLLVMMSP430Info -lLLVMMSP430AsmPrinter 
-lLLVMXCoreDisassembler -lLLVMXCoreCodeGen -lLLVMXCoreDesc -lLLVMXCoreInfo 
-lLLVMXCoreAsmPrinter -lLLVMMipsDisassembler -lLLVMMipsCodeGen 
-lLLVMMipsAsmParser -lLLVMMipsDesc -lLLVMMipsInfo -lLLVMMipsAsmPrinter 
-lLLVMARMDisassembler -lLLVMARMCodeGen -lLLVMARMAsmParser -lLLVMARMDesc 
-lLLVMARMInfo -lLLVMARMAsmPrinter -lLLVMAArch64Disassembler 
-lLLVMAArch64CodeGen -lLLVMAArch64AsmParser -lLLVMAArch64Desc -lLLVMAArch64Info 
-lLLVMAArch64AsmPrinter -lLLVMAArch64Utils -lLLVMPowerPCCodeGen 
-lLLVMPowerPCDesc -lLLVMPowerPCInfo -lLLVMPowerPCAsmPrinter -lLLVMSparcCodeGen 
-lLLVMSparcDesc -lLLVMSparcInfo -lLLVMX86Disassembler -lLLVMX86AsmParser 
-lLLVMX86CodeGen -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMX86Desc 
-lLLVMX86Info -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMMCDisassembler 
-lLLVMMCParser -lLLVMInterpreter -lLLVMMCJIT -lLLVMJIT -lLLVMCodeGen 
-lLLVMObjCARCOpts -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils 
-lLLVMipa -lLLVMAnalysis -lLLVMRuntimeDyld -lLLVMExecutionEngine -lpthread -lrt 
-ldl -lm -lLLVMCppBackendCodeGen -lLLVMCppBackendInfo -lLLVMTarget -lLLVMCore 
-lLLVMMC -lLLVMObject -lLLVMSupport
/usr/bin/ld: /usr/lib/libLLVMSupport.a(Signals.o): undefined reference to 
symbol 'dladdr@@GLIBC_2.2.5'
/usr/bin/ld: note: 'dladdr@@GLIBC_2.2.5' is defined in DSO 
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libdl.so so try 
adding it to the linker command line
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libdl.so: could not 
read symbols: Invalid operation

This happens because -ldl comes before -lLLVMSupport in the list of libraries 
passed to ld, so I had to modify the LLVM_LDFLAGS to make sure that it comes 
afterwards (see configure.patch)

Building llvm-gcc
*****************
Initially I tried building the version linked from the wiki page 
(llvm-gcc-for-ios-4.2.tar.xz) however there were numerous problems, such as:

../../gcc/config/arm/arm.c: In function ‘arm_override_options’:
../../gcc/config/arm/arm.c:1570:3: error: ‘DARWIN_ASPEN_VERSION_MIN’ 
undeclared (first use in this function)
../../gcc/config/arm/arm.c:1570:3: note: each undeclared identifier is reported 
only once for each function it appears in

Afterwards, I tried the newer llvm-gcc file (llvm-gcc-4.2-darwin11.tar.gz) 
which also had a couple of problems:

ld: file is universal (4 slices) but does not contain a(n) armv6 slice: 
/usr/share/iPhoneOS6.1.sdk/usr/lib/dylib1.o for architecture armv6
collect2: ld returned 1 exit status
make[3]: *** [libgcc_s.dylib] Error 1

I had to use SDK 4.3 since it contains armv6 libraries. As far as I can tell, 
SDKs higher than 5.1 no longer ship with armv6 so I am not sure how to get it 
to build against SDK 6.0 as per the instructions on the wiki.

Then I got the following error:

gcc -c   -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wwrite-strings 
-Wstrict-prototypes -Wmissing-prototypes -pedantic -Wno-long-long 
-Wno-variadic-macros -Wno-overlength-strings -Wold-style-definition 
-Wmissing-format-attribute  -Wno-error  -DHAVE_CONFIG_H -DGENERATOR_FILE -I. 
-Ibuild -I../../gcc -I../../gcc/build -I../../gcc/../include 
-I../../gcc/../libcpp/include  -I../../gcc/../libdecnumber -I../libdecnumber    
-o build/gengtype-lex.o gengtype-lex.c
gcc: error: gengtype-lex.c: No such file or directory
gcc: fatal error: no input files

After installing bison and flex, the error went away and gcc built.

Original issue reported on code.google.com by art...@gmail.com on 24 Feb 2013 at 10:49

Attachments:

GoogleCodeExporter commented 8 years ago
I have tried configure.patch for iphonesdk-utils-1.8 but still constantly 
getting the same error.

Original comment by redpengu...@gmail.com on 12 Mar 2013 at 8:53

GoogleCodeExporter commented 8 years ago
I had to change the exact same line in configure not just configure.ac so now 
it works.

Original comment by redpengu...@gmail.com on 12 Mar 2013 at 9:05

GoogleCodeExporter commented 8 years ago
configure.patch is meant to be applied before running autogen.sh which 
generated the configure script. Sorry if I wasn't clear on that point.

Original comment by art...@gmail.com on 12 Mar 2013 at 9:15

GoogleCodeExporter commented 8 years ago
I'm still on the process of getting the whole thing to work, but to leave this 
documented, I've also needed to install libblocksruntime-dev , and to compile 
lldb, I needed to use ./configure like this:
./configure --enable-optimized --enable-cxx11 --prefix=/usr

Thank you for your hard work, it's very appreciated!

Original comment by waneck on 30 Mar 2013 at 5:17