I tested this and it worked fine for me on my machine. Can you post your full invocation and log when running CMake? Make sure you don’t have a CMakeCache.txt there as well since it will make CMake not regard all the new input.
The log is long and since I can not upload a log file (new user) - I am copying and paste it here - sorry for that:
– The C compiler identification is GNU 4.8.5
– The CXX compiler identification is GNU 4.8.5
– The ASM compiler identification is GNU
– Found assembler: /usr/bin/cc
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Check for working C compiler: /usr/bin/cc - skipped
– Detecting C compile features
– Detecting C compile features - done
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Check for working CXX compiler: /usr/bin/c++ - skipped
– Detecting CXX compile features
– Detecting CXX compile features - done
– Could NOT find LLVM (missing: LLVM_DIR)
– Could NOT find Clang (missing: Clang_DIR)
– Performing Test LLVM_RUNTIMES_LINKING_WORKS
– Performing Test LLVM_RUNTIMES_LINKING_WORKS - Success
– Performing Test LLVM_RUNTIMES_SUPPORT_NOSTDLIBXX_FLAG
– Performing Test LLVM_RUNTIMES_SUPPORT_NOSTDLIBXX_FLAG - Failed
– Performing Test LLVM_RUNTIMES_SUPPORT_NOSTDINCXX_FLAG
– Performing Test LLVM_RUNTIMES_SUPPORT_NOSTDINCXX_FLAG - Success
– Linker detection: GNU ld
– Performing Test SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG
– Performing Test SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG - Success
– Performing Test C_SUPPORTS_WERROR_DATE_TIME
– Performing Test C_SUPPORTS_WERROR_DATE_TIME - Failed
– Performing Test CXX_SUPPORTS_WERROR_DATE_TIME
– Performing Test CXX_SUPPORTS_WERROR_DATE_TIME - Failed
– Performing Test C_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW
– Performing Test C_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW - Failed
– Performing Test CXX_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW
– Performing Test CXX_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW - Failed
– Performing Test CXX_SUPPORTS_MISSING_FIELD_INITIALIZERS_FLAG
– Performing Test CXX_SUPPORTS_MISSING_FIELD_INITIALIZERS_FLAG - Success
– Performing Test C_SUPPORTS_IMPLICIT_FALLTHROUGH_FLAG
– Performing Test C_SUPPORTS_IMPLICIT_FALLTHROUGH_FLAG - Failed
– Performing Test CXX_SUPPORTS_IMPLICIT_FALLTHROUGH_FLAG
– Performing Test CXX_SUPPORTS_IMPLICIT_FALLTHROUGH_FLAG - Failed
– Performing Test C_SUPPORTS_COVERED_SWITCH_DEFAULT_FLAG
– Performing Test C_SUPPORTS_COVERED_SWITCH_DEFAULT_FLAG - Failed
– Performing Test CXX_SUPPORTS_COVERED_SWITCH_DEFAULT_FLAG
– Performing Test CXX_SUPPORTS_COVERED_SWITCH_DEFAULT_FLAG - Failed
– Performing Test CXX_SUPPORTS_CLASS_MEMACCESS_FLAG
– Performing Test CXX_SUPPORTS_CLASS_MEMACCESS_FLAG - Failed
– Performing Test CXX_SUPPORTS_REDUNDANT_MOVE_FLAG
– Performing Test CXX_SUPPORTS_REDUNDANT_MOVE_FLAG - Failed
– Performing Test CXX_SUPPORTS_PESSIMIZING_MOVE_FLAG
– Performing Test CXX_SUPPORTS_PESSIMIZING_MOVE_FLAG - Failed
– Performing Test CXX_SUPPORTS_NOEXCEPT_TYPE_FLAG
– Performing Test CXX_SUPPORTS_NOEXCEPT_TYPE_FLAG - Failed
– Performing Test CXX_WONT_WARN_ON_FINAL_NONVIRTUALDTOR
– Performing Test CXX_WONT_WARN_ON_FINAL_NONVIRTUALDTOR - Failed
– Performing Test CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG
– Performing Test CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG - Failed
– Performing Test C_WCOMMENT_ALLOWS_LINE_WRAP
– Performing Test C_WCOMMENT_ALLOWS_LINE_WRAP - Failed
– Performing Test C_SUPPORTS_STRING_CONVERSION_FLAG
– Performing Test C_SUPPORTS_STRING_CONVERSION_FLAG - Failed
– Performing Test CXX_SUPPORTS_STRING_CONVERSION_FLAG
– Performing Test CXX_SUPPORTS_STRING_CONVERSION_FLAG - Failed
– Performing Test C_SUPPORTS_MISLEADING_INDENTATION_FLAG
– Performing Test C_SUPPORTS_MISLEADING_INDENTATION_FLAG - Failed
– Performing Test CXX_SUPPORTS_MISLEADING_INDENTATION_FLAG
– Performing Test CXX_SUPPORTS_MISLEADING_INDENTATION_FLAG - Failed
– Performing Test LINKER_SUPPORTS_COLOR_DIAGNOSTICS
– Performing Test LINKER_SUPPORTS_COLOR_DIAGNOSTICS - Failed
– Performing Test C_SUPPORTS_FNO_FUNCTION_SECTIONS
– Performing Test C_SUPPORTS_FNO_FUNCTION_SECTIONS - Failed
– Performing Test C_SUPPORTS_FDATA_SECTIONS
– Performing Test C_SUPPORTS_FDATA_SECTIONS - Failed
– Performing Test CXX_SUPPORTS_FDATA_SECTIONS
– Performing Test CXX_SUPPORTS_FDATA_SECTIONS - Success
– Looking for os_signpost_interval_begin
– Looking for os_signpost_interval_begin - not found
– Found Python3: /usr/intel/bin/python3 (found version “3.7.4”) found components: Interpreter
– check-runtimes does nothing.
– Configuring done
– Generating done
CMake Warning:
Manually-specified variables were not used by the project:
LLVM_BUILTIN_TARGETS
– Build files have been written to: /nfs/…/work/llvm-project/build
Ah you are supposed to run -S llvm for my commands to work, I have never tired to build directly from the runtime directory before. Note that your detected compiler is to old to build clang. I am not sure why your -DCMAKE_CXX/C_COMPILER is not picked up? possibly because you have a old cache around.
I am insisting with this one since it looks quite a basic matter and I may not understand some basics with LLVM. I would be grateful if someone can shade light.
The only way I could build libcxx for 32bits (on my 64bits linux system using gcc) is by using the following:
It seems to build 32 bits libraries - although the release notes say using -m32 is “flaky” and they recommend to use cross compile by adding “-DLLVM_RUNTIME_TARGETS=i386-unknown-linux” but it does not work and cmake says LLVM_RUNTIME_TARGETS is ignored.
So, is my workaround above ok?
Is building 64 bits a simple task while 32 bits somewhat more complicated?
And what is the recommended way to build 32 bits libcxx in a 64bits linux environment?
I don’t think there is anything wrong with this approach per-se. I find it a bit ugly defining CFLAGS like that manually. But if it works - it works.
I think the recommended way is to get RUNTIMES build to work. I think it will be easier for you if you try to build a full clang and runtime build since clang has a bit of better handling of cross-compilation than gcc in this case.
But it all depends on if you are trying to do a small non-production thing or if you want to ship something important on this. There is no point putting more time into doing this “right” if it works for you and it’s not that important.
What you say about -m32 makes sense.
To summarize:
I could not make the cross compilation work with either clang or gcc with ‘-S llvm’ or ‘-S runtimes’.
The LLVM_RUNTIME_TARGETS parameter is disregarded the same as I stated above.
In addition setting LLVM_ENABLE_RUNTIMES=all does not affect the issue above