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

Linker fails due to missing -rpath #15232

Closed
jh66637 opened this issue May 17, 2023 · 8 comments · Fixed by #15257
Closed

Linker fails due to missing -rpath #15232

jh66637 opened this issue May 17, 2023 · 8 comments · Fixed by #15257
Assignees
Milestone

Comments

@jh66637
Copy link
Contributor

jh66637 commented May 17, 2023

I've been trying to find the problem myself for quite a while, but I can't get to the bottom of it. If someone could take a look, I would be very grateful.

I encounter linking issues on a cluster with Spack using GCC and OpenMPI. After deal.II compiled successfully, I get the linker error:

fatal error: /gpfs/opt/sw/zen/spack-0.19.0/opt/spack/linux-almalinux8-zen2/gcc-9.5.0/hwloc-2.8.0-s7uap66oudz2vyjwxvjnyo46zahht3x/lib:pread failed: Is a directory

I attached the log file for the minimal set of dependencies, and I am happy to provide any additional information that might be helpful.
While the log is produced with GCC9, I encounter the same problems with GCC12. I tried on Intel Skylake as well as AMD Zen architecture and observe the same behavior.

What stands out to me is that I am loading openmpi-4.1.4 and the recognized MPI_VERSION = 3.1. However, I don't know if this is related.

detailed.log

@jh66637
Copy link
Contributor Author

jh66637 commented May 23, 2023

The problem is in the linker flags. Changing -Wl, to -Wl,-rpath -Wl, in a lot of places seems to be a step into the right direction.

@jh66637 jh66637 changed the title Linker fails due to hwloc Linker fails due to missing -rpath May 23, 2023
@drwells
Copy link
Member

drwells commented May 23, 2023

I'm not sure if this is something wrong with deal.II or an upstream package - the problem occurs somewhere in hwloc which we do not directly use (I think Kokkos uses it). pread() is passed a directory instead of a file for something in hwloc which makes me think a dependency has something messed up.

@jh66637
Copy link
Contributor Author

jh66637 commented May 23, 2023

@drwells Thank you for taking a look. I am currently testing some things, which is quite easy now that deal.II does not have to be recompiled every time. I figured that g++ is used as a compiler even though MPI is found. Fixing the compiler explicitly to the mpic++ binary seems to resolve the problem. Btw. I did not use any TPL except MPI to reproduce the issue.

I still have to wait until everything compiled, and I am able to check if the tests are running.

If everything works: Should I close the issue or keep it open because mpic++ is not used even though MPI was found?

@tamiko
Copy link
Member

tamiko commented May 23, 2023

@drwells This looks like a -Wl,--rpath being stripped from a -Wl,--rpath -Wl,.../lib.
We should detect such occurences and escape them correctly by now, but somehow this doesn't seem to happen.

Correction - I did not implemented this logic for -Wl, only for -Xlinker... pull request incoming.

@drwells
Copy link
Member

drwells commented May 23, 2023

I must be missing something. The message is fatal error: /gpfs/[...]/hwloc-2.8.0-[...]/lib:pread failed: Is a directory. Doesn't that indicate a failure in calling pread(), not that pread is a directory we failed to read from?

@tamiko
Copy link
Member

tamiko commented May 23, 2023

@drwells It means that we supplied a plain -Wl,/.../lib to the linker. For examle:

# g++ -Wl,/usr test.cc 
/usr/lib/gcc/x86_64-pc-linux-gnu/12/../../../../x86_64-pc-linux-gnu/bin/ld: error: /usr: read: Is a directory
collect2: error: ld returned 1 exit status

(The :pread in above output is confusing.)

@jh66637
Copy link
Contributor Author

jh66637 commented May 23, 2023

@tamiko @drwells Tanks you for the big help.
I can test the behavior of #15257 on mentioned system, tomorrow.

@jh66637
Copy link
Contributor Author

jh66637 commented May 24, 2023

Fixes the issue for me. Thank you for the help.

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

Successfully merging a pull request may close this issue.

3 participants