Opened 3 years ago

Closed 11 months ago

#62874 closed defect (fixed)

octave @6.2.0+accelerate+app+docs+gfortran+graphicsmagick+qt5+sound+sundials can't find libgfortran.5.dylib

Reported by: Schamschula (Marius Schamschula) Owned by: MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)
Priority: Normal Milestone:
Component: ports Version:
Keywords: BigSur Cc: rshuston, mascguy (Christopher Nielsen)
Port: octave

Description

With the latest update to gcc11, my M1 Mac mini can't find libgfortran.5.dylib during destroot

:debug:destroot system -W /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_math_octave/octave/work/octave-6.2.0: ./run-octave -cli -q -f -H --eval 'try; pkg prefix /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_math_octave/octave/work/destroot/opt/local/share/octave/packages /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_math_octave/octave/work/destroot/opt/local/lib/octave/packages; pkg global_list /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_math_octave/octave/work/destroot/opt/local/share/octave/octave_packages; pkg -verbose -global rebuild; disp(lasterror.message); catch; exit(1); end_try_catch;'
:info:destroot dyld: Library not loaded: @rpath/libgfortran.5.dylib
:info:destroot   Referenced from: /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_math_octave/octave/work/octave-6.2.0/src/.libs/octave-cli
:info:destroot   Reason: image not found
:info:destroot Command failed: ./run-octave -cli -q -f -H --eval 'try; pkg prefix /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_math_octave/octave/work/destroot/opt/local/share/octave/packages /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_math_octave/octave/work/destroot/opt/local/lib/octave/packages; pkg global_list /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_math_octave/octave/work/destroot/opt/local/share/octave/octave_packages; pkg -verbose -global rebuild; disp(lasterror.message); catch; exit(1); end_try_catch;'

Attachments (1)

octave-main.log.gz (277.7 KB) - added by Schamschula (Marius Schamschula) 3 years ago.

Download all attachments as: .zip

Change History (16)

Changed 3 years ago by Schamschula (Marius Schamschula)

Attachment: octave-main.log.gz added

comment:1 Changed 3 years ago by kencu (Ken)

see also #62856

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

I believe this issue is caused by a recent change that the Darwin gcc lead proposed and implemented, to use @rpath linking on the systems that support it.

this is now is being done in the gcc-devel port on arm64 only.

It fixes certain things, and clang uses @rpath too --- but it breaks certain things.

gcc10 also has arm64 fixes now. not sure about gcc11 - presumably it has arm fixes too, or eveything would be a mess now. but gcc11 is not supposed to be using the @rpath approach (yet).

Version 3, edited 3 years ago by kencu (Ken) (previous) (next) (diff)

comment:3 Changed 3 years ago by Schamschula (Marius Schamschula)

I've just uninstalled gcc-devel and libgcc-devel. I'm running port rev-update.

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

the gcc lead, Iain, does a lot of free work on gcc for Darwin. This @rpath change helps him quite a lot, and the approach was reviewed and approved by Jeremy, but it's only in the trenches that you find all the warts.

octave is running something during the build here, but the @rpath'd library is obviously not being found.

At this moment, not sure if the issue is with MacPorts build style for gcc-devel or octave, with gcc-devel, or with octave.

this should work, but doesn't...

comment:5 Changed 3 years ago by Schamschula (Marius Schamschula)

octave is just as broken under Mojave.

comment:6 Changed 3 years ago by Schamschula (Marius Schamschula)

Uninstalling gcc-devel and libgcc-devel did not help.

comment:7 Changed 3 years ago by kencu (Ken)

on Mojave means on Intel then.

Well at least that will be easier to look into :)

comment:8 Changed 3 years ago by Schamschula (Marius Schamschula)

A straight rev-update rebuild worked under Mojave.

comment:9 Changed 3 years ago by Schamschula (Marius Schamschula)

Instead of the default, with +gfortran, I installed octave @6.2.0_1+accelerate+app+docs+gcc11+qt5+sound+sundials on the M1 mini. No destroot issue.

Last edited 3 years ago by Schamschula (Marius Schamschula) (previous) (diff)

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

OK, good info to know.

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

comment:11 Changed 3 years ago by rshuston

This is what I did to get octave @6.4.0_1+accelerate+app+docs+gfortran+graphicsmagick+qt5+sound+sundials installed on my MacBook Pro M1 running Monterey. The key is to run port build instead of port install so that you have the opportunity to eliminate the @rpath entries placed in octave-cli and octave-gui in the Octave port's ${workpath}/octave-6.4.0/src/.libs directory. Running otool -L on these files reveals the following two @rpath entries for each file:

@rpath/libgfortran.5.dylib
@rpath/libquadmath.0.dylib

These files exist in the MacPorts directory tree in

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

So the approach is to run port build, use install_name_tool to fix the built octave-cli and octave-gui files, and then finish with port destroot and port install. NOTE: You'll probably need to first patch the vecLibFort package according to comment:ticket:63717:20 before installing Octave.

  1. sudo port build octave
  2. cd /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_math_octave/octave/work/octave-6.4.0/src/.libs
  3. sudo install_name_tool -change "@rpath/libgfortran.5.dylib" /opt/local/lib/libgcc/libgfortran.5.dylib octave-cli
  4. sudo install_name_tool -change "@rpath/libquadmath.0.dylib" /opt/local/lib/libgcc/libquadmath.0.dylib octave-cli
  5. sudo install_name_tool -change "@rpath/libgfortran.5.dylib" /opt/local/lib/libgcc/libgfortran.5.dylib octave-gui
  6. sudo install_name_tool -change "@rpath/libquadmath.0.dylib" /opt/local/lib/libgcc/libquadmath.0.dylib octave-gui
  7. cd -
  8. sudo port dest octave
  9. sudo port install octave

Hopefully, somebody who understands the Octave portfile can use the above information to make the appropriate fixes to get Octave building cleanly again.

Last edited 3 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:12 Changed 3 years ago by rshuston

Cc: rshuston added

comment:13 Changed 14 months ago by mascguy (Christopher Nielsen)

Marius, is this still an issue, with the latest version of octave?

comment:14 Changed 14 months ago by mascguy (Christopher Nielsen)

Cc: mascguy added

comment:15 Changed 11 months ago by Schamschula (Marius Schamschula)

Resolution: fixed
Status: assignedclosed

This now in the Portfile and has to be updated for each major version of octave.

Note: See TracTickets for help on using tickets.