Opened 2 years ago

Last modified 2 years ago

#64800 assigned defect

xcrysden: Library not loaded: @rpath/libgfortran.5.dylib

Reported by: giovannicantele Owned by: dstrubbe (David Strubbe)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc:
Port: xcrysden

Description

Dear all,

I'm experiencing a sever issue with libgfortran, since I cannot find it in mi current MacPorts installation, nor I can install it.

The library is referenced by XCrysDen (how is it possible that it was correctly installed by macports if there is a missing library?), but as I try to launch it, the following message shows up:

dyld[79368]: Library not loaded: @rpath/libgfortran.5.dylib
  Referenced from: /opt/local/lib/xcrysden-1.6.2/ftnunit
  Reason: tried: '/opt/local/lib/xcrysden-1.6.2/libgfortran.5.dylib' (no such file), '/opt/local/lib/libgfortran.5.dylib' (no such file), '/opt/local/lib/gcc-devel/gcc/aarch64-apple-darwin21/12.0.0/libgfortran.5.dylib' (no such file), '/opt/local/lib/gcc-devel/gcc/aarch64-apple-darwin21/12.0.0/../../../libgfortran.5.dylib' (no such file), '/opt/local/lib/xcrysden-1.6.2/libgfortran.5.dylib' (no such file), '/opt/local/lib/libgfortran.5.dylib' (no such file), '/opt/local/lib/gcc-devel/gcc/aarch64-apple-darwin21/12.0.0/libgfortran.5.dylib' (no such file), '/opt/local/lib/gcc-devel/gcc/aarch64-apple-darwin21/12.0.0/../../../libgfortran.5.dylib' (no such file), '/usr/local/lib/libgfortran.5.dylib' (no such file), '/usr/lib/libgfortran.5.dylib' (no such file)''''

Since I understand that there required package should be libgcc11, I also tried to install it but, unfortunately, this gives an error:

--->  Computing dependencies for libgcc11
Error: Can't install libgcc11 because conflicting ports are active: libgcc-devel
Error: Follow https://guide.macports.org/#project.tickets if you believe there
is a bug.
Error: Processing of port libgcc11 failed

So, libgcc11 conflicts with libgcc-devel but, trying to uninstall libgcc-devel also gives problems:

Note: It is not recommended to uninstall/deactivate a port that has dependents as it breaks the dependents.
The following ports will break:
 fftw-3 @3.3.10_0
 OpenBLAS @0.3.20_0
 py39-numpy @1.22.3_0
 py39-scipy @1.8.0_0
 py310-numpy @1.22.3_0
 py310-scipy @1.8.0_0
 xcrysden @1.6.2_0
 gcc11 @11.2.0_1

It seems there is no way to fix the issue.

Currently I'm running MacPorts 2.7.2 under macOS Monterey Version 12.2, hosted by a MacBook Pro, M1, 2020.

Any hint would be greatly appreciated.

I thank you in advance.

Giovanni

Change History (10)

comment:1 Changed 2 years ago by reneeotten (Renee Otten)

Priority: HighNormal

comment:2 Changed 2 years ago by reneeotten (Renee Otten)

Owner: set to dstrubbe
Port: xcrysden added; libgcc11 removed
Status: newassigned

it appears you have gcc-devel already installed, so I would think that installing xrysden with the +gccdevel variant instead of the default gcc11 could work. Try that and/or build it from source and see if that resolves the issue. In other words, first uninstall the port, reinstall with the different variant (which will make it build from source anyway since binaries will only be available for default variants): sudo port uninstall xcrysden && sudo port clean --all xrysden && sudo port install xcysded +gccdevel.

comment:3 Changed 2 years ago by reneeotten (Renee Otten)

Summary: libgfortran.5.dylib problemxcrysden: Library not loaded: @rpath/libgfortran.5.dylib

comment:4 Changed 2 years ago by kencu (Ken)

please see extensive discussion with upstream gcc maintainer here:

https://github.com/macports/macports-ports/pull/14187

he recently pushed fixes.

I’m not sure if our gcc on macports has been updated to the version with these fixes yet.

Once it is, and assuming his fixes worked, absolutely everything built with gcc will have to be rebuilt to take those fixes in….

Fun, right?

Last edited 2 years ago by kencu (Ken) (previous) (diff)

comment:5 Changed 2 years ago by giovannicantele

Thank you a lot for you prompt message.Unfortunately, after following the suggested steps ( uninstall + clean + install with variant), exactly the same error shows up:

dyld[80836]: Library not loaded: @rpath/libgfortran.5.dylib
  Referenced from: /opt/local/lib/xcrysden-1.6.2/ftnunit
  Reason: tried: '/opt/local/lib/xcrysden-1.6.2/libgfortran.5.dylib' (no such file), '/opt/local/lib/libgfortran.5.dylib' (no such file), '/opt/local/lib/gcc-devel/gcc/aarch64-apple-darwin21/12.0.0/libgfortran.5.dylib' (no such file), '/opt/local/lib/gcc-devel/gcc/aarch64-apple-darwin21/12.0.0/../../../libgfortran.5.dylib' (no such file), '/opt/local/lib/xcrysden-1.6.2/libgfortran.5.dylib' (no such file), '/opt/local/lib/libgfortran.5.dylib' (no such file), '/opt/local/lib/gcc-devel/gcc/aarch64-apple-darwin21/12.0.0/libgfortran.5.dylib' (no such file), '/opt/local/lib/gcc-devel/gcc/aarch64-apple-darwin21/12.0.0/../../../libgfortran.5.dylib' (no such file), '/usr/local/lib/libgfortran.5.dylib' (no such file), '/usr/lib/libgfortran.5.dylib' (no such file)

However, after a closer and deep inspection, I realised that xcrysden (or maybe any other code needing libgfortran) looks fo that library in standard paths, such as /opt/local/lib . On the other hand, the output of the command

port contents libgcc-devel | grep gfort

is

/opt/local/lib/libgcc/libgfortran.5.dylib

That means that libgcc-devel puts libgfortran.5.dylib in a non-standard path (under libgcc under lib), that causes the issue. This is probably a bug or an issue, in any case. After

cd /opt/local/lib
sudo ln -s libgcc/libgfortran.5.dylib .

everything works fine.

comment:6 in reply to:  4 Changed 2 years ago by giovannicantele

Thanks also to you.

Should I want to rebuild, how to do that?

Replying to kencu:

please see extensive discussion with upstream gcc maintainer here:

https://github.com/macports/macports-ports/pull/14187

he recently pushed fixes.

I’m not sure if our gcc on macports has been updated to the version with these fixes yet.

Once it is, and assuming his fixes worked, absolutely everything built with gcc will have to be rebuilt to take those fixes in….

Fun, right?

comment:7 in reply to:  5 Changed 2 years ago by kencu (Ken)

Replying to giovannicantele:

That means that libgcc-devel puts libgfortran.5.dylib in a non-standard path (under libgcc under lib), that causes the issue. This is probably a bug or an issue, in any case.

MacPorts installs gcc's libs in a supported libdir. Those are then symlinks to the actual libraries installed in /opt/local/lib/libgcc.

This is a perfectly reasonable installation plan that was done for a good reason, and has been like this for 15 years or so.

Recent changes to gcc-devel for arm did not properly support having gcc libraries in their own set libdir, in particular manifest when using @rpaths.

That is an upstream gcc bug that was hopefully fixed by the pushes to gcc noted in the above PR.

But now that fix needs to propagate down the chain, be verified to fix the problem, and then everything that was ever built with gcc-devel needs to be rebuilt so it will pick up the new rpath references (to gcc's own libdir).

Last edited 2 years ago by kencu (Ken) (previous) (diff)

comment:8 Changed 2 years ago by dstrubbe (David Strubbe)

So, in the end, looks like this is an issue about libgcc-devel rather than xcrysden, per se.

comment:9 in reply to:  8 Changed 2 years ago by giovannicantele

I would say that it is definitely a gcc-devel issue, nothing to do with xcrysden, that was just trying to use libgfortran and didn't find it in the place where it should be

Replying to dstrubbe:

So, in the end, looks like this is an issue about libgcc-devel rather than xcrysden, per se.

comment:10 Changed 2 years ago by kencu (Ken)

technically, gcc was not adding the right path to it’s libraries, which is why gcc couldn’t find them.

It apparently is adding the right path now, but we have yet to verify that.

Once verified, we can start revbumping everything that is broken.

Last edited 2 years ago by kencu (Ken) (previous) (diff)
Note: See TracTickets for help on using tickets.