llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.2k stars 11.64k forks source link

18.1.0 (on linux): cross building for 32 bit on 64 bit host fails #84547

Open balducci opened 6 months ago

balducci commented 6 months ago

hi

cross building for 32 bit on 64 bit linux host stops with:

/usr/bin/clang++  -m32 -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/balducci/tmp/install-us-d/llvm-18.1.0.d/llvm-18.1.0/build.d/tools/bolt/lib/Core -I/home/balducci/tmp/install-us-d/llvm-18.1.0.d/llvm-18.1.0/bolt/lib/Core -I/home/balducci/tmp/install-us-d/llvm-18.1.0.d/llvm-18.1.0/build.d/include -I/home/balducci/tmp/install-us-d/llvm-18.1.0.d/llvm-18.1.0/llvm/include -I/home/balducci/tmp/install-us-d/llvm-18.1.0.d/llvm-18.1.0/bolt/include -I/home/balducci/tmp/install-us-d/llvm-18.1.0.d/llvm-18.1.0/build.d/tools/bolt/include -fPIC -fno-semantic-interposition   -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -std=c++17 -fPIC  -fno-exceptions -funwind-tables -MD -MT tools/bolt/lib/Core/CMakeFiles/LLVMBOLTCore.dir/BinaryFunction.cpp.o -MF tools/bolt/lib/Core/CMakeFiles/LLVMBOLTCore.dir/BinaryFunction.cpp.o.d -o tools/bolt/lib/Core/CMakeFiles/LLVMBOLTCore.dir/BinaryFunction.cpp.o -c /home/balducci/tmp/install-us-d/llvm-18.1.0.d/llvm-18.1.0/bolt/lib/Core/BinaryFunction.cpp
/home/balducci/tmp/install-us-d/llvm-18.1.0.d/llvm-18.1.0/bolt/lib/Core/BinaryFunction.cpp:190:7: error: static assertion failed due to requirement 'sizeof(const char *) >= sizeof(llvm::bolt::DebugLineTableRowRef)': Cannot fit instruction debug line information into SMLoc's pointer
  190 |       sizeof(decltype(SMLoc().getPointer())) >= sizeof(DebugLineTableRowRef),
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/balducci/tmp/install-us-d/llvm-18.1.0.d/llvm-18.1.0/bolt/lib/Core/BinaryFunction.cpp:190:46: note: expression evaluates to '4 >= 8'
  190 |       sizeof(decltype(SMLoc().getPointer())) >= sizeof(DebugLineTableRowRef),
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

Building for the native 64 bit host completes successfully.

I have been cross building for 32 bit with versions <=17.0.6 since ever without any problem.

This is my configuration for cross building (unchanged from last successful run with 17.0.6):

-DCMAKE_BUILD_TYPE=
-DCMAKE_INSTALL_PREFIX=/opt/stow.d/versions/llvm-18.1.0/usr
-DLLVM_ENABLE_FFI=ON
-DFFI_INCLUDE_DIR=/usr/include                                         
-DFFI_STATIC_LIBRARIES=""
-DLLVM_BUILD_32_BITS=ON
-DLLVM_TARGET_ARCH=x86
-DLLVM_DEFAULT_TARGET_TRIPLE=i386-pc-linux-gnu
-DLLVM_HOST_TRIPLE=i386-pc-linux-gnu
-DCOMPILER_RT_DEFAULT_TARGET_TRIPLE=i386-pc-linux-gnu
-DCMAKE_ASM_FLAGS=-m32
-DCMAKE_VERBOSE_MAKEFILE=ON
-DLLVM_ENABLE_PROJECTS=""
-DLLVM_BUILD_LLVM_DYLIB=ON
-DLLVM_INSTALL_UTILS=ON
-DLLVM_TARGETS_TO_BUILD="X86;AMDGPU;BPF;"
-DLLVM_ENABLE_RTTI=ON
-DLLVM_INCLUDE_BENCHMARKS=OFF
-DLLDB_PYTHON_EXE_RELATIVE_PATH=/usr/python3/bin/python

I am building with:

##> clang --version
clang version 17.0.6
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

Do I need any new cmake option?

thanks in advance for any help

llvmbot commented 6 months ago

@llvm/issue-subscribers-bolt

Author: None (balducci)

hi cross building for 32 bit on 64 bit linux host stops with: ``` /usr/bin/clang++ -m32 -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/balducci/tmp/install-us-d/llvm-18.1.0.d/llvm-18.1.0/build.d/tools/bolt/lib/Core -I/home/balducci/tmp/install-us-d/llvm-18.1.0.d/llvm-18.1.0/bolt/lib/Core -I/home/balducci/tmp/install-us-d/llvm-18.1.0.d/llvm-18.1.0/build.d/include -I/home/balducci/tmp/install-us-d/llvm-18.1.0.d/llvm-18.1.0/llvm/include -I/home/balducci/tmp/install-us-d/llvm-18.1.0.d/llvm-18.1.0/bolt/include -I/home/balducci/tmp/install-us-d/llvm-18.1.0.d/llvm-18.1.0/build.d/tools/bolt/include -fPIC -fno-semantic-interposition -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -std=c++17 -fPIC -fno-exceptions -funwind-tables -MD -MT tools/bolt/lib/Core/CMakeFiles/LLVMBOLTCore.dir/BinaryFunction.cpp.o -MF tools/bolt/lib/Core/CMakeFiles/LLVMBOLTCore.dir/BinaryFunction.cpp.o.d -o tools/bolt/lib/Core/CMakeFiles/LLVMBOLTCore.dir/BinaryFunction.cpp.o -c /home/balducci/tmp/install-us-d/llvm-18.1.0.d/llvm-18.1.0/bolt/lib/Core/BinaryFunction.cpp /home/balducci/tmp/install-us-d/llvm-18.1.0.d/llvm-18.1.0/bolt/lib/Core/BinaryFunction.cpp:190:7: error: static assertion failed due to requirement 'sizeof(const char *) >= sizeof(llvm::bolt::DebugLineTableRowRef)': Cannot fit instruction debug line information into SMLoc's pointer 190 | sizeof(decltype(SMLoc().getPointer())) >= sizeof(DebugLineTableRowRef), | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/balducci/tmp/install-us-d/llvm-18.1.0.d/llvm-18.1.0/bolt/lib/Core/BinaryFunction.cpp:190:46: note: expression evaluates to '4 >= 8' 190 | sizeof(decltype(SMLoc().getPointer())) >= sizeof(DebugLineTableRowRef), | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated. ``` Building for the native 64 bit host completes successfully. I have been cross building for 32 bit with versions <=17.0.6 since ever without any problem. This is my configuration for cross building (unchanged from last successful run with 17.0.6): ``` -DCMAKE_BUILD_TYPE= -DCMAKE_INSTALL_PREFIX=/opt/stow.d/versions/llvm-18.1.0/usr -DLLVM_ENABLE_FFI=ON -DFFI_INCLUDE_DIR=/usr/include -DFFI_STATIC_LIBRARIES="" -DLLVM_BUILD_32_BITS=ON -DLLVM_TARGET_ARCH=x86 -DLLVM_DEFAULT_TARGET_TRIPLE=i386-pc-linux-gnu -DLLVM_HOST_TRIPLE=i386-pc-linux-gnu -DCOMPILER_RT_DEFAULT_TARGET_TRIPLE=i386-pc-linux-gnu -DCMAKE_ASM_FLAGS=-m32 -DCMAKE_VERBOSE_MAKEFILE=ON -DLLVM_ENABLE_PROJECTS="" -DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_INSTALL_UTILS=ON -DLLVM_TARGETS_TO_BUILD="X86;AMDGPU;BPF;" -DLLVM_ENABLE_RTTI=ON -DLLVM_INCLUDE_BENCHMARKS=OFF -DLLDB_PYTHON_EXE_RELATIVE_PATH=/usr/python3/bin/python ``` I am building with: ``` ##> clang --version clang version 17.0.6 Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/bin ``` Do I need any new cmake option? thanks in advance for any help
aaupov commented 6 months ago

CC @ayermolo

Zentrik commented 5 months ago

I have also hit this issue, I didn't have a problem with LLVM 16 or 17.