Open DrTodd13 opened 12 months ago
Is it using the just built clang to build openmp?
In the second line of the error report above you can see "$SRC_DIR/llvm/build/bin/clang" as the exe of the build command so, yes, I believe that it is using the just built clang. If I try to build the runtime without including clang as a project to build then it gives me an error so I assume that is a requirement of building the runtime.
Yeah, you need some patches to clang to automatically find the sysroot. (Or set --sysroot to make clang aware of the conda sysroot)
Specifically https://github.com/conda-forge/clangdev-feedstock/blob/main/recipe/patches/0002-Fix-sysroot-detection-for-linux.patch and https://github.com/conda-forge/llvmdev-feedstock/blob/main/recipe/build.sh#L22 Or https://github.com/conda-forge/clangdev-feedstock/blob/main/recipe/patches/0003-clang-add-conda-specific-env-var-CONDA_BUILD_SYSROOT.patch
Should we backport those patches to LLVM/clang 15?
@isuruf It seems that for the runtime build portion, when cmake is trying to use the newly built clang to check for the compiler capabilities, that all those checks are failing because of the following:
(/home/username/miniconda3/envs/pyomp39/conda-bld/llvmdev_1690419527432/_build_env) [username@localhost _build_env]$ $SRC_DIR/llvm/build/bin/clang ~/openmp/pthread_test_cmake.c
/usr/bin/ld: cannot find crtbegin.o: No such file or directory
/usr/bin/ld: cannot find -lgcc
/usr/bin/ld: cannot find -lgcc
clang-14: error: linker command failed with exit code 1 (use -v to see invocation)
Suggestions? Thanks!
Did you use my suggestions above?
Should we backport those patches to LLVM/clang 15?
Don't see why not
Did you use my suggestions above?
Yes, I used the second one.
CONDA_BUILD_SYSROOT
is set in your env?
(/home/username/miniconda3/envs/pyomp39/conda-bld/llvmdev_1690419527432/_build_env) [username@localhost llvmdev_1690419527432]$ echo $CONDA_BUILD_SYSROOT /home/username/miniconda3/envs/pyomp39/conda-bld/llvmdev_1690419527432/_build_env/x86_64-conda-linux-gnu/sysroot
(/home/username/miniconda3/envs/pyomp39/conda-bld/llvmdev_1690419527432/_build_env) [username@localhost llvmdev_1690419527432]$ find . -name "libgcc*" -print
./work/clang/test/Driver/Inputs/aarch64-linux-gnu-tree/gcc-10/lib/gcc/aarch64-unknown-linux-gnu/10/libgcc.a
./work/clang/test/Driver/Inputs/aarch64-linux-gnu-tree/gcc-7.5.0/lib/gcc/aarch64-unknown-linux-gnu/7.5.0/libgcc.a
./work/clang/test/Driver/Inputs/aarch64-linux-gnu-tree/gcc-9.3.0/lib/gcc/aarch64-unknown-linux-gnu/9.3.0/libgcc.a
./work/clang/test/Driver/Inputs/aarch64-linux-gnu-tree/gcc-9.3.1/lib/gcc/aarch64-unknown-linux-gnu/9.3.1/libgcc.a
./work/clang/test/Driver/Inputs/basic_avr_tree/usr/lib/gcc/avr/5.4.0/libgcc.a
./work/clang/test/Driver/Inputs/basic_avr_tree_2/opt/local/lib/gcc/avr/10.3.0/libgcc.a
./work/clang/test/Driver/Inputs/montavista_i686_tree/usr/lib/gcc/i686-montavista-linux/4.2.0/libgcc.a
./_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeho/conda-meta/libgcc-ng-11.2.0-h1234567_1.json
./_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeho/lib/libgcc_s.so
./_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeho/lib/libgcc_s.so.1
./_build_env/conda-meta/libgcc-devel_linux-64-7.5.0-hbbeae57_17.json
./_build_env/conda-meta/libgcc-ng-11.2.0-h1234567_1.json
./_build_env/x86_64-conda-linux-gnu/sysroot/lib64/libgcc_s.so
./_build_env/x86_64-conda-linux-gnu/sysroot/lib64/libgcc_s.so.1
./_build_env/lib/gcc/x86_64-conda-linux-gnu/7.5.0/libgcc.a
./_build_env/lib/gcc/x86_64-conda-linux-gnu/7.5.0/libgcc_eh.a
./_build_env/lib/libgcc_s.so
./_build_env/lib/libgcc_s.so.1
Hmm, you might need the other two patches too.
Hmm, you might need the other two patches too.
I thought the same and I tried it. After the rebuild, activating the build environment and rerunning the pthread test program, It changed the linker from /usr/bin/ld to /home/username/miniconda3/envs/pyomp39/conda-bld/llvmdev_1690494537428/_build_env/bin/x86_64-conda-linux-gnu-ld but otherwise the errors are the same about crtbegin.o and -lgcc not being found.
Sidenote: Please post code & shell output enclosed in triple backticks.
Should we backport those patches to LLVM/clang 15?
Don't see why not
https://github.com/conda-forge/llvmdev-feedstock/pull/232 & https://github.com/conda-forge/clangdev-feedstock/pull/234
Though I note that the errors mention clang-14:
clang-14: error: linker command failed with exit code 1 (use -v to see invocation)
so the backports to the 15.x
branch won't have an effect. How are you installing clang @DrTodd13?
Though I note that the errors mention clang-14:
clang-14: error: linker command failed with exit code 1 (use -v to see invocation)
so the backports to the
15.x
branch won't have an effect. How are you installing clang @DrTodd13?
Yes indeed, I am backporting to llvm 14.0.6. You can see what I'm doing in my first post where I show a part of build.sh where I am enabling the clang, lld, and libunwind projects along with the openmp runtime. I'm not "installing" clang...it is just being built as part of the llvm build process and then a later part of the build process that is doing the runtime is using the clang that was built earlier in the build.
@isuruf @h-vetinari I found https://discourse.llvm.org/t/cannot-find-lgcc-with-new-clang-worked-with-clang-7/4232/7.
Running clang --verbose on the clang that is being built in the conda build environment finds no candidate gcc implementations.
$SRC_DIR/llvm/build/bin/clang --verbose clang version 14.0.6 (/home/username/miniconda3/envs/pyomp39/conda-bld/git_cache/github.com/Python-for-HPC/llvm-project.git 3f24beb247fa4f527be15ba155d8eff338744c75) Target: x86_64-conda-linux-gnu Thread model: posix InstalledDir: /home/username/miniconda3/envs/pyomp39/conda-bld/llvmdev_1690494537428/work/llvm/build/bin
Try
ln -sf /home/username/miniconda3/envs/pyomp39/conda-bld/llvmdev_1690494537428/x86_64-conda-linux-gnu /home/username/miniconda3/envs/pyomp39/conda-bld/llvmdev_1690494537428/work/llvm/build/x86_64-conda-linux-gnu
Try
ln -sf /home/username/miniconda3/envs/pyomp39/conda-bld/llvmdev_1690494537428/x86_64-conda-linux-gnu /home/username/miniconda3/envs/pyomp39/conda-bld/llvmdev_1690494537428/work/llvm/build/x86_64-conda-linux-gnu
That directory didn't exist directly under llvmdev_1690494537428 but does exist in the _build_env subdir. I tried doing the ln from that directory to work/llvm/build but it had no effect.
The following NEW packages will be INSTALLED:
From what I can tell you are not using conda-forge packages for the build environment. Can you do
conda config --add channels conda-forge
conda config --set channel_priority strict
and try again with a fresh build environment?
The following NEW packages will be INSTALLED:
From what I can tell you are not using conda-forge packages for the build environment. Can you do
conda config --add channels conda-forge conda config --set channel_priority strict
and try again with a fresh build environment?
Did a completely clean environment and got everything from conda-forge and it still gives me the same error.
Checking in on this old issue again. AFAIU everything should be fixed for v15+. Is there still a problem @DrTodd13?
Comment:
I'm not using the conda-forge recipes (instead basing what I'm doing on the Numba recipe) but I thought this group might have expertise to answer my question. In build.sh, I'm building clang/lld/libunwind and the openmp runtimes as below.
_cmake_config+=(-DLLVM_ENABLE_PROJECTS:STRING="clang;lld;libunwind") _cmake_config+=(-DLLVM_ENABLE_RUNTIMES:STRING=openmp)
I'm doing this in a Centos 7 VM. The build gets into building the runtime and for some of the compilation steps I get the following errors.
It seems to be trying to get the C++ include files from /usr/include and failing because enable_if_t is not available in the base gcc available on centos 7 (gcc 4.8.5). I don't know why it is trying to use this gcc at all since the conda environment created at the beginning has gcc 7.5 in it as follows:
Any suggestions on how to proceed? Thanks!