刘可 via llvm-dev
2021-Dec-01 06:29 UTC
[llvm-dev] How to avoid building builtin files with '-m32' during building LLVM?
Hi, I got an error when I specified gcc8.3 toolchain to build LLVM13. Here
is my host environment:
Debian9
gcc6.3
Manully built toolchain: gcc8.3
==============================================================================================Here
is my command:
$ CXX=/home/liuke.gehry/toolchain/x86_64-x86_64-gcc-830/bin/g++
CC=/home/liuke.gehry/toolchain/x86_64-x86_64-gcc-830/bin/gcc cmake -G Ninja
-DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;lld;lldb;openmp"
-DLLVM_ENABLE_RUNTIMES="compiler-rt;libcxx;libcxxabi;libunwind"
-DLLVM_TARGETS_TO_BUILD="X86;ARM;AArch64" -DCMAKE_BUILD_TYPE=Release
-DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON
-DCMAKE_CXX_LINK_FLAGS="-Wl,-rpath
/home/liuke.gehry/toolchain/x86_64-x86_64-gcc-830/lib64
-L/home/liuke.gehry/toolchain/x86_64-x86_64-gcc-830/lib64 -Wl,-rpath
/home/liuke.gehry/toolchain/x86_64-x86_64-gcc-830/sysroot/lib64
-L/home/liuke.gehry/toolchain/x86_64-x86_64-gcc-830/sysroot/lib64
-Wl,-dynamic-linker
/home/liuke.gehry/toolchain/x86_64-x86_64-gcc-830/sysroot/lib64/
ld-linux-x86-64.so.2
-L/home/liuke.gehry/toolchain/x86_64-x86_64-gcc-830/sysroot/lib64/
ld-linux-x86-64.so.2" ../llvm
$ ninja
[99/302] Building C object
CMakeFiles/clang_rt.builtins-i386.dir/floatsisf.c.o
FAILED: CMakeFiles/clang_rt.builtins-i386.dir/floatsisf.c.o
/home/liuke.gehry/llvm/llvm-project/build_with_gcc/./bin/clang
--target=x86_64-unknown-linux-gnu -DVISIBILITY_HIDDEN -O3 -DNDEBUG -m32
-std=c11 -fPIC -fno-builtin -fvisibility=hidden -MD -MT
CMakeFiles/clang_rt.builtins-i386.dir/floatsisf.c.o -MF
CMakeFiles/clang_rt.builtins-i386.dir/floatsisf.c.o.d -o
CMakeFiles/clang_rt.builtins-i386.dir/floatsisf.c.o -c
/home/liuke.gehry/llvm/llvm-project/compiler-rt/lib/builtins/floatsisf.c
In file included from
/home/liuke.gehry/llvm/llvm-project/compiler-rt/lib/builtins/floatsisf.c:16:
In file included from
/home/liuke.gehry/llvm/llvm-project/compiler-rt/lib/builtins/fp_lib.h:23:
In file included from
/home/liuke.gehry/llvm/llvm-project/compiler-rt/lib/builtins/int_lib.h:93:
In file included from
/data00/home/liuke.gehry/llvm/llvm-project/build_with_gcc/lib/clang/13.0.1/include/limits.h:21:
In file included from /usr/include/limits.h:25:
/usr/include/features.h:364:12: fatal error: 'sys/cdefs.h' file not
found
# include <sys/cdefs.h>
^~~~~~~~~~~~~
1 error generated.
==============================================================================================
I know I can solve it through 'apt install'. But I do not need 32-bits
binary . How can I disable '-m32' when building builtins? Or is it a
necessary process?
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20211130/d2abb649/attachment.html>
David Spickett via llvm-dev
2021-Dec-01 09:42 UTC
[llvm-dev] How to avoid building builtin files with '-m32' during building LLVM?
Since your default target will be 64 bit I think you can set
COMPILER_RT_DEFAULT_TARGET_ONLY and it will just build 64 bit. If you
look for that option name in compiler-rt/cmake/base-config-ix.cmake
you'll see a check for it, then if it's not set it checks flags for
both 64 and 32 bit, which is what leads to trying to build both.
if(COMPILER_RT_DEFAULT_TARGET_ONLY)
add_default_target_arch(${COMPILER_RT_DEFAULT_TARGET_ARCH})
elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES
"i[2-6]86|x86|amd64")
if(NOT MSVC)
test_target_arch(x86_64 "" "-m64")
test_target_arch(i386 __i386__ "-m32")
I have not tested it myself but maybe that helps.
On Wed, 1 Dec 2021 at 06:29, 刘可 via llvm-dev <llvm-dev at lists.llvm.org>
wrote:>
> Hi, I got an error when I specified gcc8.3 toolchain to build LLVM13. Here
is my host environment:
> Debian9
> gcc6.3
> Manully built toolchain: gcc8.3
>
>
==============================================================================================>
Here is my command:
> $ CXX=/home/liuke.gehry/toolchain/x86_64-x86_64-gcc-830/bin/g++
CC=/home/liuke.gehry/toolchain/x86_64-x86_64-gcc-830/bin/gcc cmake -G Ninja
-DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;lld;lldb;openmp"
-DLLVM_ENABLE_RUNTIMES="compiler-rt;libcxx;libcxxabi;libunwind"
-DLLVM_TARGETS_TO_BUILD="X86;ARM;AArch64" -DCMAKE_BUILD_TYPE=Release
-DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON
-DCMAKE_CXX_LINK_FLAGS="-Wl,-rpath
/home/liuke.gehry/toolchain/x86_64-x86_64-gcc-830/lib64
-L/home/liuke.gehry/toolchain/x86_64-x86_64-gcc-830/lib64 -Wl,-rpath
/home/liuke.gehry/toolchain/x86_64-x86_64-gcc-830/sysroot/lib64
-L/home/liuke.gehry/toolchain/x86_64-x86_64-gcc-830/sysroot/lib64
-Wl,-dynamic-linker
/home/liuke.gehry/toolchain/x86_64-x86_64-gcc-830/sysroot/lib64/ld-linux-x86-64.so.2
-L/home/liuke.gehry/toolchain/x86_64-x86_64-gcc-830/sysroot/lib64/ld-linux-x86-64.so.2"
../llvm
> $ ninja
>
> [99/302] Building C object
CMakeFiles/clang_rt.builtins-i386.dir/floatsisf.c.o
> FAILED: CMakeFiles/clang_rt.builtins-i386.dir/floatsisf.c.o
> /home/liuke.gehry/llvm/llvm-project/build_with_gcc/./bin/clang
--target=x86_64-unknown-linux-gnu -DVISIBILITY_HIDDEN -O3 -DNDEBUG -m32
-std=c11 -fPIC -fno-builtin -fvisibility=hidden -MD -MT
CMakeFiles/clang_rt.builtins-i386.dir/floatsisf.c.o -MF
CMakeFiles/clang_rt.builtins-i386.dir/floatsisf.c.o.d -o
CMakeFiles/clang_rt.builtins-i386.dir/floatsisf.c.o -c
/home/liuke.gehry/llvm/llvm-project/compiler-rt/lib/builtins/floatsisf.c
> In file included from
/home/liuke.gehry/llvm/llvm-project/compiler-rt/lib/builtins/floatsisf.c:16:
> In file included from
/home/liuke.gehry/llvm/llvm-project/compiler-rt/lib/builtins/fp_lib.h:23:
> In file included from
/home/liuke.gehry/llvm/llvm-project/compiler-rt/lib/builtins/int_lib.h:93:
> In file included from
/data00/home/liuke.gehry/llvm/llvm-project/build_with_gcc/lib/clang/13.0.1/include/limits.h:21:
> In file included from /usr/include/limits.h:25:
> /usr/include/features.h:364:12: fatal error: 'sys/cdefs.h' file not
found
> # include <sys/cdefs.h>
> ^~~~~~~~~~~~~
> 1 error generated.
>
==============================================================================================>
> I know I can solve it through 'apt install'. But I do not need
32-bits binary . How can I disable '-m32' when building builtins? Or is
it a necessary process?
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
PoYao Chang via llvm-dev
2021-Dec-01 09:44 UTC
[llvm-dev] How to avoid building builtin files with '-m32' during building LLVM?
> From: PoYao Chang <rzhboyao at gmail.com> > Subject: Re: [llvm-dev] How can I build LLVM with my gcc toolchain exactly > Date: November 24, 2021 at 1:06:21 AM GMT+8 > To: llvm-dev at lists.llvm.org > > Give “-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON” a try.https://lists.llvm.org/pipermail/llvm-dev/2021-November/153909.html <https://lists.llvm.org/pipermail/llvm-dev/2021-November/153909.html> Have you tried it as I told you a week ago.> On Dec 1, 2021, at 2:29 PM, 刘可 via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > Hi, I got an error when I specified gcc8.3 toolchain to build LLVM13. Here is my host environment: > Debian9 > gcc6.3 > Manully built toolchain: gcc8.3 > > ==============================================================================================> Here is my command: > $ CXX=/home/liuke.gehry/toolchain/x86_64-x86_64-gcc-830/bin/g++ CC=/home/liuke.gehry/toolchain/x86_64-x86_64-gcc-830/bin/gcc cmake -G Ninja -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;lld;lldb;openmp" -DLLVM_ENABLE_RUNTIMES="compiler-rt;libcxx;libcxxabi;libunwind" -DLLVM_TARGETS_TO_BUILD="X86;ARM;AArch64" -DCMAKE_BUILD_TYPE=Release -DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON -DCMAKE_CXX_LINK_FLAGS="-Wl,-rpath /home/liuke.gehry/toolchain/x86_64-x86_64-gcc-830/lib64 -L/home/liuke.gehry/toolchain/x86_64-x86_64-gcc-830/lib64 -Wl,-rpath /home/liuke.gehry/toolchain/x86_64-x86_64-gcc-830/sysroot/lib64 -L/home/liuke.gehry/toolchain/x86_64-x86_64-gcc-830/sysroot/lib64 -Wl,-dynamic-linker /home/liuke.gehry/toolchain/x86_64-x86_64-gcc-830/sysroot/lib64/ld-linux-x86-64.so <http://ld-linux-x86-64.so/>.2 -L/home/liuke.gehry/toolchain/x86_64-x86_64-gcc-830/sysroot/lib64/ld-linux-x86-64.so <http://ld-linux-x86-64.so/>.2" ../llvm > $ ninja > > [99/302] Building C object CMakeFiles/clang_rt.builtins-i386.dir/floatsisf.c.o > FAILED: CMakeFiles/clang_rt.builtins-i386.dir/floatsisf.c.o > /home/liuke.gehry/llvm/llvm-project/build_with_gcc/./bin/clang --target=x86_64-unknown-linux-gnu -DVISIBILITY_HIDDEN -O3 -DNDEBUG -m32 -std=c11 -fPIC -fno-builtin -fvisibility=hidden -MD -MT CMakeFiles/clang_rt.builtins-i386.dir/floatsisf.c.o -MF CMakeFiles/clang_rt.builtins-i386.dir/floatsisf.c.o.d -o CMakeFiles/clang_rt.builtins-i386.dir/floatsisf.c.o -c /home/liuke.gehry/llvm/llvm-project/compiler-rt/lib/builtins/floatsisf.c > In file included from /home/liuke.gehry/llvm/llvm-project/compiler-rt/lib/builtins/floatsisf.c:16: > In file included from /home/liuke.gehry/llvm/llvm-project/compiler-rt/lib/builtins/fp_lib.h:23: > In file included from /home/liuke.gehry/llvm/llvm-project/compiler-rt/lib/builtins/int_lib.h:93: > In file included from /data00/home/liuke.gehry/llvm/llvm-project/build_with_gcc/lib/clang/13.0.1/include/limits.h:21: > In file included from /usr/include/limits.h:25: > /usr/include/features.h:364:12: fatal error: 'sys/cdefs.h' file not found > # include <sys/cdefs.h> > ^~~~~~~~~~~~~ > 1 error generated. > ==============================================================================================> > I know I can solve it through 'apt install'. But I do not need 32-bits binary . How can I disable '-m32' when building builtins? Or is it a necessary process? > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20211201/9a440bf6/attachment.html>