[cfe-dev] Clang for ARM
Anton Smirnov
dev at antonsmirnov.name
Thu Oct 3 10:37:48 PDT 2013
>
>
> http://stackoverflow.com/questions/12993460/why-am-i-getting-undefined-reference-to-dladdr-even-with-ldl-for-this-simpl
>
> So i wonder what should i do and is it bug or my dev env issue?
>
> Did you try the solution in that question?
I did not actually catch what should i do.
Should i just run `llvm-config --libs core` `llvm-config --ldflags` before
"make"?
2013/10/3 Anton Smirnov <dev at antonsmirnov.name>
> Hey, guys.
>
> I'm using androideabi linker as i'm compiling for android (ARM Linux).
>
> thanks for verbose flag tip, i've tried and output is pretty largeso dive
> in it if you have time and wish:
>
> /home/asmirnov/arm-toolchain-clang33/bin/arm-linux-androideabi-clang++
> -target arm-linux-androideabi -mcpu=cortex-a9
> -I/home/asmirnov/android-ndk-r9/platforms/android-8/arch-arm/include
> -I/home/asmirnov/android-ndk-r9/platforms/android-8/arch-arm/usr/include
> -mfloat-abi=soft -ccc-gcc-name arm-linux-androideabi -fPIC
> -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings
> -Wmissing-field-initializers -pedantic -Wno-long-long
> -Wcovered-switch-default -Wnon-virtual-dtor -fno-common
> -Woverloaded-virtual -Wcast-qual -fno-strict-aliasing
> -Wno-nested-anon-types -fno-rtti -ldl
> CMakeFiles/c-index-test.dir/c-index-test.c.o -o
> ../../../../bin/c-index-test
> -L/home/asmirnov/arm-toolchain-clang33/lib/gcc/arm-linux-androideabi/4.6
> -L/home/asmirnov/arm-toolchain-clang33/arm-linux-androideabi/lib
> -L/home/asmirnov/arm-toolchain-clang33/sysroot/usr/lib
> ../../../../lib/libLLVMMC.a ../../../../lib/libLLVMObject.a
> ../../../../lib/libLLVMSupport.a -ldl -lz ../../../../lib/libclang.so.3.3
> ../../../../lib/libclangARCMigrate.a ../../../../lib/libclangFormat.a
> ../../../../lib/libclangTooling.a ../../../../lib/libclangRewriteFrontend.a
> ../../../../lib/libclangRewriteCore.a ../../../../lib/libclangFrontend.a
> ../../../../lib/libclangDriver.a ../../../../lib/libclangSerialization.a
> ../../../../lib/libLLVMBitReader.a ../../../../lib/libclangParse.a
> ../../../../lib/libclangSema.a ../../../../lib/libLLVMARMCodeGen.a
> ../../../../lib/libLLVMARMAsmParser.a
> ../../../../lib/libLLVMARMDisassembler.a ../../../../lib/libLLVMAsmParser.a
> ../../../../lib/libLLVMAsmPrinter.a ../../../../lib/libLLVMSelectionDAG.a
> ../../../../lib/libLLVMARMDesc.a ../../../../lib/libLLVMMCParser.a
> ../../../../lib/libLLVMCodeGen.a ../../../../lib/libLLVMARMAsmPrinter.a
> ../../../../lib/libLLVMARMInfo.a ../../../../lib/libLLVMObjCARCOpts.a
> ../../../../lib/libLLVMScalarOpts.a ../../../../lib/libLLVMInstCombine.a
> ../../../../lib/libLLVMTransformUtils.a ../../../../lib/libLLVMipa.a
> ../../../../lib/libLLVMAnalysis.a ../../../../lib/libLLVMTarget.a
> ../../../../lib/libLLVMCore.a ../../../../lib/libclangEdit.a
> ../../../../lib/libclangAnalysis.a ../../../../lib/libclangASTMatchers.a
> ../../../../lib/libclangAST.a ../../../../lib/libclangLex.a
> ../../../../lib/libclangBasic.a ../../../../lib/libLLVMMC.a
> ../../../../lib/libLLVMObject.a ../../../../lib/libLLVMSupport.a -ldl -lz
> -ldl -lc -ldl -Wl,-rpath,/home/asmirnov/llvm_arm_build/lib
>
> /home/asmirnov/arm-toolchain-clang33/bin/arm-linux-androideabi-ld:
> ../../../../lib/libclang.so.3.3: error: undefined reference to 'dladdr'
> clang33: error: linker command failed with exit code 1 (use -v to see
> invocation)
>
> I will keep trying to solve it but your help is appreciated too.
> thank you.
>
> PS. Actually my current cmake command-line is:
>
> CC="arm-linux-androideabi-clang" CXX="arm-linux-androideabi-clang++"
> PATH=/home/asmirnov/arm-toolchain-clang33:${PATH} cmake ../llvm
> -DCMAKE_CROSSCOMPILING=True
> -DCMAKE_INSTALL_PREFIX=/home/asmirnov/llvm_arm_installed
> -DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-androideabi -DLLVM_TARGET_ARCH=ARM
> -DLLVM_TARGETS_TO_BUILD=ARM
> -DLLVM_TABLEGEN=/home/asmirnov/llvm_host_build/Release+Asserts/bin/llvm-tblgen
> -DCLANG_TABLEGEN=/home/asmirnov/llvm_host_build/Release+Asserts/bin/clang-tblgen
> -DCMAKE_CXX_FLAGS='-target arm-linux-androideabi -mcpu=cortex-a9
> -I/home/asmirnov/android-ndk-r9/platforms/android-8/arch-arm/include
> -I/home/asmirnov/android-ndk-r9/platforms/android-8/arch-arm/usr/include
> -mfloat-abi=soft -ccc-gcc-name arm-linux-androideabi'
>
> I'm using standalone toolchain from android ndk (clang 3.3)
>
>
>
> 2013/10/3 Tim Northover <t.p.northover at gmail.com>
>
>> It sounds like Android might put libdl in an odd place, though I've
>> never tried to build for it. You might have to tell CMake about this
>> location before it will work.
>>
>> Anton: running "make VERBOSE=1" will show the actual command-line
>> that's failing. That could shed some light on what's going on (e.g.
>> whether -ldl is completely missing or just in the wrong place).
>>
>> > Did you try the solution in that question?
>>
>> Even I wouldn't know how to do that. This is LLVM's own build system.
>> Set CMAKE_CXX_FLAGS? Set CMAKE_EXE_LINKER_FLAGS?
>>
>> Cheers.
>>
>> Tim.
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20131003/418de370/attachment.html>
More information about the cfe-dev
mailing list