Linker warning on macos
A couple of weeks ago I started getting an innocuous message
each time I build a upc++ app under MacOS including
ld: warning: -multiply_defined is obsolete
See for example, the laplac2d upcxx-extras app
The apps work as expected, so the message appears harmless
Software Environment
Ventura Version: 13.0.1
Xcode Version: 14.3
Apple clang version 15.0.0
Comments (12)
-
-
- changed title to Loader warning on macos
-
assigned issue to
-
- changed status to open
-
This may be related to Xcode’s new linker. I started seeing issues like this when compiling with GCC after upgrading to Xcode 15.
-
- marked as critical
- changed title to Linker warning on macos
- changed component to Build/install scripts
-
Fwiw, the problematic
-multiply_defined <treatment>
linker option has been documented as "obsolete" since theld
manpage for macOS 10.5 (released Oct 2007), but was supported in 10.4 (released Apr 2005). It is only now that the linker is warning about this option. -
@Scott Baden (and possibly @Amir Kamil),
Please try configuring UPC++ using
--with-gasnet=https://bitbucket.org/PHHargrove/gasnet-public/get/upcxx-issue-616.tar.gz
. That will download and use a GASNet-EX patched to hopefully address this issue.-Paul
-
That eliminates the warning for me when using Clang.
For GCC via Homebrew, I have to set
CXXFLAGS
to-Wl,-ld_classic
. This isn’t UPC++-specific, and I suspect the fix needs to be on Homebrew’s front rather than ours. -
@Amir Kamil , thanks for the confirmation of the fix. I agree that if the need for
-Wl,-ld_classic
with Homebrew'sgcc
is not specific toUPC++
then it is not something we should be trying to automate or even document. -
@Scott Baden , since there are many ways your environment and/or toolchain might differ from Amir's, I am still hoping you can find time to confirm that configuring using
--with-gasnet=https://bitbucket.org/PHHargrove/gasnet-public/get/upcxx-issue-616.tar.gz
is sufficient to resolve the problem for you. -
The proposed fix is now the subject of gasnet pull-request #618
-
- changed status to resolved
Resolved via merge of GASNet pull request #618
- Log in to comment
Thanks for the report, Scott.
I suspect that we simply need add configure logic in GASNet-EX to make addition of
-Wl,-multiply_defined,suppress
to LDFLAGS conditional (omitting it if a warning is generated).However, I believe that your toolchain is newer than we have access to for testing. So, we may need to ask for your assistance in testing the fix.
-Paul