Search code examples
clangconfigure

wllvm error: C compiler cannot create executables


I'm trying to build the LLVM bitcode of libosip2-4.1.0 with wllvm. I exported the following variables:

export LLVM_COMPILER=/home/oren/GIT/LatestKlee/llvm/Release/bin/clang
export LLVM_COMPILER_PATH=/home/oren/GIT/LatestKlee/llvm/Release/bin/

Then created a dedicated build library, and ran configure from there:

CC=wllvm ../libosip2-4.1.0/configure

However, configure script complains that wllvm cannot create executables:

configure: error: C compiler cannot create executables

When I run it without CC=wllvm (usual compilation with gcc) everything works fine. What should I do? Thanks!


Solution

  • It turns out that:

    export LLVM_COMPILER=clang (works fine)
    

    But not with an absolute path:

    export LLVM_COMPILER=/home/oren/GIT/LatestKlee/llvm/Release/bin/clang (doesn't work)
    

    Here is my final script that works fine and builds an llvm bitcode for libosip2-4.1.0:

    wget https://ftp.gnu.org/gnu/osip/libosip2-4.1.0.tar.gz
    tar xf libosip2-4.1.0.tar.gz
    
    mkdir build
    cd build
    CC=wllvm LLVM_COMPILER=clang ../libosip2-4.1.0/configure --enable-test --disable-shared
    LLVM_COMPILER=clang make -j
    
    cd ./src/test
    extract-bc ./torture_test
    file ./torture_test.bc
    

    And the desired terminal output that proves mission accomplished:

    ./torture_test.bc: LLVM IR bitcode