Opened 6 months ago

Closed 4 months ago

Last modified 4 months ago

#68756 closed defect (fixed)

gildas @202311b: duplicate LC_RPATH '/opt/local/lib/libgcc'

Reported by: pabloriviere (Pablo Rivière) Owned by: bardeau
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: pabloriviere (Pablo Rivière), jpinedaf (Jaime Pineda)
Port: gildas

Description (last modified by ryandesign (Ryan Carsten Schmidt))

Hi, I am trying to install Gildas on a Mac with Sonoma 14.1.1. However, I get the following error:

Error: Failed to build gildas: command execution failed
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_gildas/gildas/main.log for details.
Error: Follow https://guide.macports.org/#project.tickets if you believe there is a bug.
Error: Processing of port gildas failed

And the last entries of the log are:

:info:build Command failed: source admin/gildas-env.sh -c /opt/local/bin/gfortran-mp-13  -s /opt/local/include:/opt/local/lib:/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Versions/Current/ && export GAG_SLDFLAGS='-shared -o /opt/local/lib/gildas/x86_64-darwin-gfortran/lib/$(notdir $@) -install_name /opt/local/lib/gildas/x86_64-darwin-gfortran/lib/$(notdir $@)' && export DYLD_LIBRARY_PATH=/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_gildas/gildas/work/gildas-src-nov23b/integ/x86_64-darwin-gfortran/lib && export GAG_ADDONS=yes && make -w install
:info:build Exit code: 2
:error:build Failed to build gildas: command execution failed
:debug:build Error code: NONE
:debug:build Backtrace: command execution failed
:debug:build     while executing
:debug:build "$procedure $targetname"
:error:build See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_gildas/gildas/main.log for details.

I am aware that XCode is giving problems. I tried doing

sudo install_name_tool -delete_rpath /opt/local/lib/libgcc /opt/local/lib/libopenblas-r1.dylib 

And solved a previous issue.

from ticket #68329, with no success

Attachments (1)

main.log (1.5 MB) - added by pabloriviere (Pablo Rivière) 6 months ago.

Download all attachments as: .zip

Change History (26)

comment:1 Changed 6 months ago by pabloriviere (Pablo Rivière)

Cc: pabloriviere added

comment:2 Changed 6 months ago by jmroot (Joshua Root)

Description: modified (diff)
Owner: set to bardeau
Status: newassigned

comment:3 Changed 6 months ago by ryandesign (Ryan Carsten Schmidt)

Description: modified (diff)

Please attach the main.log file.

Changed 6 months ago by pabloriviere (Pablo Rivière)

Attachment: main.log added

comment:4 Changed 6 months ago by bardeau

The linker fails with no more information

:info:build clang: error: linker command failed with exit code 1 (use -v to see invocation)

Pablo, we are not able to guess more from the log file. An alternate solution is that you install GILDAS from the sources (see section IV.2 at https://www.iram.fr/~gildas/dist/gildas.README ) and see if the error is still there and if we can have more details. You are probably one of the first to try the installation on Sonoma, I did not try myself.

comment:5 Changed 6 months ago by pabloriviere (Pablo Rivière)

Hi,

I tried also this, but it failed to install gcc9:

sudo port install gcc9
Password:
gcc9 is known to fail. Try to install anyway? [y/N]: y
--->  Computing dependencies for gcc9libgcc9 is known to fail. Try to install anyway? [y/N]: y
libgcc10 is known to fail. Try to install anyway? [y/N]: y
libgcc11 is known to fail. Try to install anyway? [y/N]: y

The following dependencies will be installed: 
 libgcc10
 libgcc11
 libgcc9
Continue? [Y/n]: y
--->  Fetching archive for libgcc11
--->  Attempting to fetch libgcc11-11.4.0_1+stdlib_flag.darwin_23.x86_64.tbz2 from https://packages.macports.org/libgcc11
--->  Attempting to fetch libgcc11-11.4.0_1+stdlib_flag.darwin_23.x86_64.tbz2 from https://fra.de.packages.macports.org/libgcc11
--->  Attempting to fetch libgcc11-11.4.0_1+stdlib_flag.darwin_23.x86_64.tbz2 from https://mse.uk.packages.macports.org/libgcc11
--->  Building libgcc11
Error: Failed to build libgcc11: command execution failed
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc11/libgcc11/main.log for details.
Error: Follow https://guide.macports.org/#project.tickets if you believe there is a bug.
Error: Processing of port gcc9 failed
Last edited 6 months ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:6 Changed 6 months ago by bardeau

You should stick to the latest gcc version available. Currently gcc13 should be used. I will update the README file accordingly.

comment:7 Changed 6 months ago by pabloriviere (Pablo Rivière)

Hi,
I tried

sudo port install gcc13
sudo port select gcc
sudo port select gcc mp-gcc13
sudo port install gtk2
sudo port install pkgconfig
sudo port variants fftw-3-single
sudo port install fftw-3-single +gcc13
sudo port variants cfitsio
sudo port install cfitsio +gcc13
unxz gildas-src-nov23b.tar.xz
tar -xf gildas-src-nov23b.tar
cd gildas-src-nov23b
source admin/gildas-env.sh -o openmp
make

but I get

Makefile:35: built/x86_64-darwin-gfortran-openmp/Makefile.deps: No such file or directory
gcc -c -I../     -I/Users/pabloriviere/Downloads/gildas-src-nov23b/integ/x86_64-darwin-gfortran-openmp/include -pipe -fPIC -w   -Ddarwin -DDARWIN -DPNG -O -Dunderscore -DGAG_USE_GTK -DGAG_USE_OPENMP -DGAG_USE_POSIX -DGAG_USE_UNDERSCORE gcomm.c -o built/x86_64-darwin-gfortran-openmp/gcomm.o
gcomm.c: In function 'sic_remove_previous_comm_files':
gcomm.c:720:23: error: 'PATH_MAX' undeclared (first use in this function)
  720 |         char last_cwd[PATH_MAX];
      |                       ^~~~~~~~
gcomm.c:720:23: note: each undeclared identifier is reported only once for each function it appears in
make[3]: *** [built/x86_64-darwin-gfortran-openmp/gcomm.o] Error 1
make[2]: *** [default] Error 1
make[1]: *** [default] Error 1
make: *** [default] Error 1

And then after make install:

make[2]: Nothing to be done for `default-install'.
Makefile:35: built/x86_64-darwin-gfortran-openmp/Makefile.deps: No such file or directory
gcc -c -I../     -I/Users/pabloriviere/Downloads/gildas-src-nov23b/integ/x86_64-darwin-gfortran-openmp/include -pipe -fPIC -w   -Ddarwin -DDARWIN -DPNG -O -Dunderscore -DGAG_USE_GTK -DGAG_USE_OPENMP -DGAG_USE_POSIX -DGAG_USE_UNDERSCORE gcomm.c -o built/x86_64-darwin-gfortran-openmp/gcomm.o
gcomm.c: In function 'sic_remove_previous_comm_files':
gcomm.c:720:23: error: 'PATH_MAX' undeclared (first use in this function)
  720 |         char last_cwd[PATH_MAX];
      |                       ^~~~~~~~
gcomm.c:720:23: note: each undeclared identifier is reported only once for each function it appears in
make[3]: *** [built/x86_64-darwin-gfortran-openmp/gcomm.o] Error 1
make[2]: *** [default-install] Error 1
make[1]: *** [default-install] Error 1
make: *** [default-install] Error 1
Last edited 6 months ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:8 Changed 6 months ago by pabloriviere (Pablo Rivière)

Just in case it helps: I upgraded my mac to Sonoma so that I can use Imager (the software asked me a more recent version, I went for the last, I think I as in Calatina before). Now Imager works fine, but GILDAS doesn't.

comment:9 Changed 6 months ago by bardeau

Sorry, the PATH_MAX bug appears with gcc13 installed with MacPorts. I fixed the GILDAS development version but I did not backport it to the current stable version. The fix will be part of the dec23 release.

In the meantime you can use gcc12 which does not have this problem. You can switch to gcc12 with sudo port select gcc mp-gcc12. You have to restart the GILDAS compilation from scratch.

comment:10 Changed 6 months ago by pabloriviere (Pablo Rivière)

Thank you very much for your answer. Just to clarify, what does restarting from scratch mean in this context?

comment:11 Changed 6 months ago by bardeau

There are means to "clean" the previous compilation attempt, but the simplest for you is the erase the source directory and extract it again from the archive.

comment:12 Changed 6 months ago by pabloriviere (Pablo Rivière)

Thank you very much, it worked. Just in case anyone finds itself in the same situation, this is what worked (as suggested by bardeau, drop gcc13 for gcc12):

sudo port install gcc12
sudo port select gcc
sudo port select gcc mp-gcc12
sudo port install gtk2
sudo port install pkgconfig
sudo port variants fftw-3-single
sudo port install fftw-3-single +gcc12
sudo port variants cfitsio
sudo port install cfitsio +gcc12
tar -xf gildas-src-nov23b.tar.xz
cd gildas-src-nov23b
source admin/gildas-env.sh
make
make install
Last edited 6 months ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:13 Changed 6 months ago by bardeau

Thanks for the feedback. This means the compilation runs correctly if compiled "by hand", but not within MacPorts. I have updated my version of MacOS, and I am now performing some tests.

comment:14 Changed 6 months ago by pabloriviere (Pablo Rivière)

Thank you for your help. Very much appreciated.

comment:15 in reply to:  4 Changed 6 months ago by ryandesign (Ryan Carsten Schmidt)

Summary: Cannot build gildas, Command failedgildas @202311b: duplicate LC_RPATH '/opt/local/lib/libgcc'

Replying to bardeau:

The linker fails with no more information

:info:build clang: error: linker command failed with exit code 1 (use -v to see invocation)

Pablo, we are not able to guess more from the log file.

The relevant information in the log was the line immediately preceding the one you quoted:

:info:build ld: duplicate LC_RPATH '/opt/local/lib/libgcc' in '/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_gildas/gildas/work/gildas-src-nov23b/integ/x86_64-darwin-gfortran/lib/libsic.so'

There are many other open tickets about this problem that you can look at to learn more.

Last edited 6 months ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:16 Changed 6 months ago by jpinedaf (Jaime Pineda)

Cc: jpinedaf added

comment:17 Changed 6 months ago by jpinedaf (Jaime Pineda)

I can confirm that the workaround works. I installed gcc12 and then run this

sudo port install gildas +gcc12 +openmp

Many thanks!!

comment:18 Changed 6 months ago by bardeau

Dear @ryandesign,

the problem simplifies as follows.

1) write a fortran-based library and compile it with gfortran-mp-13:

bardeau-mac2 ~> cat hello.f90
subroutine test
  print *,"Hello, world!"
end subroutine test
bardeau-mac2 ~> gfortran -c hello.f90
bardeau-mac2 ~> gfortran  -dynamiclib hello.o -o libhello.so

Looking a it with otool -l, one can find only one occurrence of /opt/local/lib/libgcc as a LC_RPATH.

But, when compiling gildas with MacPorts, we also add the contents of ${configure.ldflags} when linking the dynamic library. During the install process I see this debug message:

DEBUG: compilers PG: RPATH added to ldflags as GCC version is 13

In practice this translates as:

~> gfortran  -dynamiclib -L/opt/local/lib -Wl,-headerpad_max_install_names -Wl,-rpath,/opt/local/lib/libgcc hello.o -o libhello.so
ld: warning: duplicate -rpath '/opt/local/lib/libgcc' ignored

In this case, /opt/local/lib/libgcc appears twice as a LC_RPATH. Note that the warning "duplicate rpath ignored" does not seem correct.

Now I do not know the right answer to this problem. What has changed with gfortran 12? Is the ${configure.ldflags} misconfigured? I tried to locally remove the ${configure.ldflags} from my link lines: this fixes the compilation, execution runs well, but I need to test if the compilation with e.g. gcc 12 is still working.

Any advice?

comment:19 Changed 6 months ago by kencu (Ken)

the compilers PortGroup adds another rpath

https://github.com/macports/macports-ports/blob/a542e2c29dda072a275c7b6a1dc2df9c98279321/_resources/port1.0/group/compilers-1.0.tcl#L844

It will have to be changed to not do that any more, as gcc/gfortran adds one itself… but then certain builds could break (some builds that use gfortran link with clang)

Last edited 6 months ago by kencu (Ken) (previous) (diff)

comment:20 in reply to:  9 ; Changed 6 months ago by barracuda156

Replying to bardeau:

Sorry, the PATH_MAX bug appears with gcc13 installed with MacPorts.

Do you mean the issue is specific to Macports installation of gcc13 but not gcc13 as such?

comment:21 in reply to:  20 ; Changed 6 months ago by bardeau

Replying to barracuda156:

Replying to bardeau:

Sorry, the PATH_MAX bug appears with gcc13 installed with MacPorts.

Do you mean the issue is specific to Macports installation of gcc13 but not gcc13 as such?

This piece of code used to compile up to mp-gcc12:

#include <limits.h>

void main() {
  char foo[PATH_MAX];
  return;
}

Now for mp-gcc13 I need to include syslimits.h instead. As this include also brings PATH_MAX for mp-gcc12, I made the change when compiling with gcc installed with MacPorts. The include file is different for other operating systems, but that's another story.

comment:22 in reply to:  19 Changed 6 months ago by bardeau

Replying to kencu:

the compilers PortGroup adds another rpath

https://github.com/macports/macports-ports/blob/a542e2c29dda072a275c7b6a1dc2df9c98279321/_resources/port1.0/group/compilers-1.0.tcl#L844

It will have to be changed to not do that any more, as gcc/gfortran adds one itself… but then certain builds could break (some builds that use gfortran link with clang)

Ok, thanks for the information. I have removed the use of ${configure.ldflags} on my side. It seems to work with the tests I did. I have pushed a pull request. We'll see if the builds are successful on all platforms.

comment:23 in reply to:  21 Changed 6 months ago by bardeau

Replying to bardeau:

Replying to barracuda156:

Replying to bardeau:

Sorry, the PATH_MAX bug appears with gcc13 installed with MacPorts.

Do you mean the issue is specific to Macports installation of gcc13 but not gcc13 as such?

This piece of code used to compile up to mp-gcc12:

#include <limits.h>

void main() {
  char foo[PATH_MAX];
  return;
}

Now for mp-gcc13 I need to include syslimits.h instead. As this include also brings PATH_MAX for mp-gcc12, I made the change when compiling with gcc installed with MacPorts. The include file is different for other operating systems, but that's another story.

Actually I have a build failure under macos-13 + gcc-13 as the file syslimits.h is not found. Is it the right file to include, or I there a missing dependency I should request?

comment:24 Changed 4 months ago by kencu (Ken)

Resolution: fixed
Status: assignedclosed

In 9d017dc9465cd72143ae08e7737c5cd64fe2011f/macports-ports (master):

gildas @202311b: don't duplicate rpaths

closes: #68756

comment:25 in reply to:  24 Changed 4 months ago by bardeau

Replying to kencu:

In 9d017dc9465cd72143ae08e7737c5cd64fe2011f/macports-ports (master):

gildas @202311b: don't duplicate rpaths

closes: #68756

Thank you Kencu for this patch.

Pablo, a new GILDAS release is now available (since today). It should install correctly now.

Note: See TracTickets for help on using tickets.