[cfe-commits] Fix cmake for Hexagon cross compilers

Sebastian Pop spop at codeaurora.org
Wed Jul 18 20:55:34 PDT 2012


On Tue, Jul 3, 2012 at 11:51 PM, Sebastian Pop <spop at codeaurora.org> wrote:
> On Tue, Jul 3, 2012 at 10:42 PM, Sebastian Pop <spop at codeaurora.org> 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?

Ping second patch.

Thanks,
Sebastian
-- 
Qualcomm Innovation Center, Inc is a member of Code Aurora Forum
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-build-a-static-libclang.a-even-for-BUILD_SHARED_LIBS.patch
Type: application/octet-stream
Size: 1369 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120718/c84b9e81/attachment.obj>


More information about the cfe-commits mailing list