Opened 14 months ago

Last modified 12 months ago

#68239 new defect

Xcode 15 and GCC: linker complains that "duplicate LC_RPATH are deprecated"

Reported by: szhorvat (Szabolcs Horvát) Owned by:
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: cjones051073 (Chris Jones), ddrum2000, Dave-Allured (Dave Allured)
Port: gcc12

Description

When linking to shared libraries that were compiled with GCC, e.g. ports that need gfortran, the linker included in Xcode 15 issues this warning:

$ cc xx.c -L/opt/local/lib -lopenblas
ld: warning: duplicate LC_RPATH are deprecated ('/opt/local/lib/libgcc')

Here openblas is just an example of such a library, and xx.c can be a trivial program with an empty main function.

This is well beyond my expertise, but I think it's related to the rpath entries here:

$ otool -L /opt/local/lib/libopenblas.1.dylib
/opt/local/lib/libopenblas.1.dylib:
	/opt/local/lib/libopenblas-r1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libgfortran.5.dylib (compatibility version 6.0.0, current version 6.0.0)
	@rpath/libquadmath.0.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)

There's a separate issue that trying to use GCC triggers an assertion failure in the linker, but I'm sure you're aware of that (see e.g. this SO search: https://stackoverflow.com/search?q=file+Relocations.cpp%2C+line+1336 )

Change History (5)

comment:1 Changed 14 months ago by cjones051073 (Chris Jones)

You are using the wrong otool option above. You need to use -l (lower case) and check the RPATH entries. What you will find is there are duplicates in that list, which is precisely what the above warning is telling you.

I don’t at this time believe this is something we are doing wrong in the macports gcc packaging, but I could be wrong. I more suspect this is just something upstream GCC will have to address themselves. For now ignore the warnings.

Yes, I am aware of the linker issue as well. This is also I believe either an Xcode, or GCC issue, so the fix will have to come from one or other of those parties as well.

Last edited 14 months ago by cjones051073 (Chris Jones) (previous) (diff)

comment:2 Changed 14 months ago by cjones051073 (Chris Jones)

Update. The warning could be related to

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

Someone might need to review if that workaround is still needed and if it is indeed the cause of the issue.

comment:3 Changed 14 months ago by ddrum2000

Following

comment:4 Changed 14 months ago by ddrum2000

Cc: ddrum2000 added

comment:5 Changed 12 months ago by Dave-Allured (Dave Allured)

Cc: Dave-Allured added
Note: See TracTickets for help on using tickets.