On Tue, Jul 3, 2012 at 10:42 PM, Sebastian Pop <[email protected]> wrote: > Hi, > > here is a patch that allows us to use cmake to specify a cross > compiler for Hexagon. > > In particular, the patch adds a missing case for the target Hexagon in > cmake/config-ix.cmake, and it moves LLVM_DEFAULT_TARGET_TRIPLE and > TARGET_TRIPLE > variables from cmake/config-ix.cmake to the toplevel CMakeLists.txt to make > them > available at configure time. Here is the command line that I have used to test > my patches: > > $ cmake -G Ninja -D BUILD_SHARED_LIBS:BOOL=ON -D > LLVM_TARGETS_TO_BUILD:STRING=Hexagon -D > TARGET_TRIPLE:STRING=hexagon-unknown-linux-gnu -D > LLVM_DEFAULT_TARGET_TRIPLE:STRING=hexagon-unknown-linux-gnu -D > LLVM_TARGET_ARCH:STRING=hexagon-unknown-linux-gnu -D > LLVM_ENABLE_PIC:BOOL=OFF .. > $ ninja check >
With this cmake command, building clang fails for two programs c-arcmt-test and c-index-test like this: [102/649] Linking CXX executable bin/c-index-test FAILED: : && /usr/bin/c++ -fno-common -Woverloaded-virtual -Wcast-qual -fno-strict-aliasing -pedantic -Wno-long-long -Wall -W -Wno-unused-parameter -Wwrite-strings -fno-rtti tools/clang/tools/c-index-test/CMakeFiles/c-index-test.dir/c-index-test.c.o -o bin/c-index-test -rdynamic lib/libLLVMMC.so lib/libLLVMObject.so lib/libLLVMSupport.so -ldl -lpthread -llibclang -Wl,-rpath,/home/spop/llvm/svn-git-llvm/ninja.build/lib: && : /usr/bin/ld: cannot find -llibclang We are trying to link against a static libclang even when we explicitly asked cmake -D BUILD_SHARED_LIBS:BOOL=ON The attached patch fixes the compilation of these two programs by generating the static libclang.a even when BUILD_SHARED_LIBS is ON. Ok to commit the attached patch, or is there a better way to fix the cmake compilations by avoiding the static link against libclang? Thanks, Sebastian -- Qualcomm Innovation Center, Inc is a member of Code Aurora Forum
0001-build-a-static-libclang.a-even-for-BUILD_SHARED_LIBS.patch
Description: Binary data
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
