Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot link with libomp5-10 with clang-10 on ubuntu-20.04 #3040

Closed
1 task done
mahrud opened this issue Mar 28, 2021 · 2 comments
Closed
1 task done

Cannot link with libomp5-10 with clang-10 on ubuntu-20.04 #3040

mahrud opened this issue Mar 28, 2021 · 2 comments

Comments

@mahrud
Copy link

mahrud commented Mar 28, 2021

Description
Starting exactly 10 days ago our nightly builds using Clang10 on Ubuntu-20.04 began failing to link with OpenMP despite no other changes being made to our source code. The only difference I found seems to be that starting 20210315.1, libomp5-11 is installed by default rather than libomp5-10, so it is removed when the older version is being installed. However, I couldn't reproduce this issue locally (e.g. by installing clang-11 and libomp5-11, then installing clang-10 and libomp5-10), so I don't think this is an Ubuntu bug.

Area for Triage:
C/C++

Question, Bug, or Feature?:
Bug

Virtual environments affected

  • Ubuntu 20.04

Image version
Version: 20210315.1

Expected behavior
The build succeeds on version 20210309.1 and we see:

2021-03-18T06:24:41.8561445Z libomp5-10 is already the newest version (1:10.0.0-4ubuntu1).
2021-03-18T06:24:41.8562371Z libomp5-10 set to manually installed.
...
2021-03-18T06:26:28.8525076Z -- Found OpenMP_C: -fopenmp=libomp (found version "4.5") 

Actual behavior
The build fails starting the day after on version 20210315.1:

2021-03-19T06:24:37.6647483Z The following packages will be REMOVED:
2021-03-19T06:24:37.6658177Z   libomp-11-dev libomp5-11
...
2021-03-19T06:24:52.3045871Z Removing libomp-11-dev (1:11.0.0-2~ubuntu20.04.1) ...
2021-03-19T06:24:52.3752235Z Removing libomp5-11:amd64 (1:11.0.0-2~ubuntu20.04.1) ...
...
2021-03-19T06:25:08.0828994Z Selecting previously unselected package libomp5-10:amd64.
2021-03-19T06:25:08.1115424Z Preparing to unpack .../109-libomp5-10_1%3a10.0.0-4ubuntu1_amd64.deb ...
2021-03-19T06:25:08.1128257Z Unpacking libomp5-10:amd64 (1:10.0.0-4ubuntu1) ...
...
2021-03-19T06:25:16.4675353Z Setting up libomp5-10:amd64 (1:10.0.0-4ubuntu1) ...

Note that the right version of clang is detected:

2021-03-19T06:26:08.0149860Z -- The C compiler identification is Clang 10.0.0
2021-03-19T06:26:08.6670147Z -- Check for working C compiler: /usr/lib/ccache/clang-10 - skipped

The resulting CMake error is:

  Could NOT find OpenMP_C (missing: OpenMP_C_FLAGS OpenMP_C_LIB_NAMES)

And digging in CMakeError.txt, this is where things start to go wrong:

[2/2] Linking C executable cmTC_d8702
FAILED: cmTC_d8702 
: && /usr/lib/ccache/clang-10 -fopenmp=libomp -v  CMakeFiles/cmTC_d8702.dir/OpenMPTryFlag.c.o -o cmTC_d8702  -v && :
clang version 10.0.0-4ubuntu1 
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/10
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/8
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/10
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/10
Candidate multilib: .;@m64
Selected multilib: .;@m64
 "/usr/bin/ld" -z relro --hash-style=gnu --build-id --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o cmTC_d8702 /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/crt1.o /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/crti.o /usr/bin/../lib/gcc/x86_64-linux-gnu/10/crtbegin.o -L/usr/bin/../lib/gcc/x86_64-linux-gnu/10 -L/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu -L/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../lib64 -L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib64 -L/usr/lib/x86_64-linux-gnu/../../lib64 -L/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../.. -L/usr/lib/llvm-10/bin/../lib -L/lib -L/usr/lib -L/usr/lib/llvm-10/lib CMakeFiles/cmTC_d8702.dir/OpenMPTryFlag.c.o -lomp -lgcc --as-needed -lgcc_s --no-as-needed -lpthread -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/bin/../lib/gcc/x86_64-linux-gnu/10/crtend.o /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/crtn.o
/usr/bin/ld: cannot find -lomp
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.

Repro steps

  1. install clang-10 and libomp5-10 on ubuntu-20.04 environment
  2. build a cmake project containing find_package(OpenMP REQUIRED)

Public repo: https://github.com/Macaulay2/M2/actions
Succeeding build: https://github.com/Macaulay2/M2/runs/2137307839?check_suite_focus=true
Failing build: https://github.com/Macaulay2/M2/runs/2146146178?check_suite_focus=true

@mahrud
Copy link
Author

mahrud commented Mar 28, 2021

Ah, actually I was able to reproduce this locally in a docker container with the following steps:

RUN apt-get install -y clang-10 llvm-10 && apt-get clean
RUN apt-get install -y clang-11 llvm-11 && apt-get clean
RUN apt-get install -y libomp5-10 && apt-get clean

This probably indicates that the issue is indeed with Ubuntu, and commenting the last line (to use the newer libomp with clang-10) seems to prevent the error, so I'll close this.

@mahrud mahrud closed this as completed Mar 28, 2021
@mahrud
Copy link
Author

mahrud commented Mar 29, 2021

This is apparently related to this Debian issue: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=811283

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants