Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hdf5 fails to build with Xcode 15 / macOS Sonoma #3571

Closed
fxcoudert opened this issue Sep 21, 2023 · 11 comments
Closed

hdf5 fails to build with Xcode 15 / macOS Sonoma #3571

fxcoudert opened this issue Sep 21, 2023 · 11 comments
Assignees
Labels
Component - Build CMake, Autotools Priority - 0. Blocker ⛔ This MUST be merged for the release to happen Type - Bug / Bugfix Please report security issues to [email protected] instead of creating an issue on GitHub
Milestone

Comments

@fxcoudert
Copy link

Describe the bug

Compilation with Xcode 15 (on macOS Sonoma) leads to a build error:

  ld: unknown options: -commons 
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  make[1]: *** [H5detect] Error 1

Apple ships with Xcode 15 and macOS Sonoma a new linker, which does not accept the -commons option.

This commons from hdf5 configure at

hdf5/configure.ac

Line 1082 in 95907ba

H5_LDFLAGS="$H5_LDFLAGS -Wl,-commons,use_dylibs"

  ## tell libtool to do the right thing with COMMON symbols, this fixes
  ## corrupt values with COMMON and EQUIVALENCE when building shared
  ## Fortran libraries on OSX with gnu and Intel compilers (HDFFV-2772).
  case "`uname`" in
    Darwin*)
    H5_LDFLAGS="$H5_LDFLAGS -Wl,-commons,use_dylibs"
    ;;
  esac

Expected behavior
Successful install :)

Platform (please complete the following information)

  • HDF5 version: 1.14.2
  • OS and version: macOS 14.0 (Release Candidate)
  • Compiler and version: Xcode 15
  • Build system (e.g. CMake, Autotools) and version: autoconf 2.71, automake 1.66.5, libtool 2.4.7
  • Any configure options you specified: ./configure --disable-dependency-tracking --disable-silent-rules --enable-build-mode=production --enable-fortran --enable-cxx --prefix=/opt/homebrew/Cellar/hdf5/1.14.2 --with-szlib=/opt/homebrew/opt/libaec
  • MPI library and version (parallel HDF5): MPI is not used

Additional context
Add any other context about the problem here.

@fxcoudert
Copy link
Author

I've filed the bug with Apple as FB13194355

@Dave-Allured
Copy link
Contributor

@fxcoudert, thank you for the report. Macports users are now running into this, unknown -commons, after updating to Xcode 15 and/or Command Line Tools 15, since 15.0 release three days ago (2023 September 18).
https://trac.macports.org/ticket/68194

@Dave-Allured
Copy link
Contributor

Note: -commons is a fortran-related option. A Macports user has reported that HDF5 1.14.2 without the fortran API option builds fine with Xcode 15.0.

@Dave-Allured
Copy link
Contributor

@fxcoudert, can you test with --enable-fortran removed (or replaced by --disable-fortran)?

@Dave-Allured
Copy link
Contributor

History: -commons was added on 2017 May 23. It has been present in all HDF5 releases since 1.8.19 and 1.10.2. This commit:
133168d

@fxcoudert
Copy link
Author

@Dave-Allured we build HDF5 with Fortran support in Homebrew. We've worked around the issue by forcing use of the old linker: Homebrew/homebrew-core#144559

@Dave-Allured
Copy link
Contributor

@fxcoudert, thanks. I will see if that can be worked into Macports.

@brtnfld
Copy link
Contributor

brtnfld commented Sep 22, 2023

It also will fail with Fortran disabled but with parallel enabled. At least with mpich, since it includes the -commons in the mpicc wrapper.

@brtnfld brtnfld added the Priority - 1. High 🔼 These are important issues that should be resolved in the next release label Sep 22, 2023
@Dave-Allured
Copy link
Contributor

-commons is an obscure option that is found only in Mac OS linkers. As cited above:

## ... this fixes corrupt values with COMMON and EQUIVALENCE when
## building shared Fortran libraries on OSX with gnu and Intel compilers

I searched several versions of HDF5 source code. COMMON and EQUIVALENCE were used only in fortran, and only in the 1.8 release series (and maybe earlier), lately in the single file H5f90global.f90.

I believe that -commons is now completely unnecessary for building series 1.10 forward, including fortran. Therefore I recommend removing -commons in all library patches and future releases. This is in preference to down-shifting to the old linker. I have not yet tested anywhere to see if this really works.

Would someone at HDF5 please verify this finding? Thank you.

User programs that use COMMON or EQUIVALENCE will probably still need to compile and link with -commons on Mac.

@brtnfld
Copy link
Contributor

brtnfld commented Sep 22, 2023

You are correct, it was overlooked when we removed the use of COMMON and EQUIVALENCE in the switch to Fortran 2003. Thanks.

@derobins derobins added this to the 1.14.3 milestone Sep 25, 2023
@derobins derobins added Priority - 0. Blocker ⛔ This MUST be merged for the release to happen Type - Bug / Bugfix Please report security issues to [email protected] instead of creating an issue on GitHub and removed Priority - 1. High 🔼 These are important issues that should be resolved in the next release Type - New Feature Add a new API call, functionality, or tool Branch - 1.14 labels Sep 25, 2023
@derobins
Copy link
Member

Will also be fixed in 1.10.11 and 1.12.3

Dave-Allured added a commit to Dave-Allured/macports-ports that referenced this issue Nov 12, 2023
.

Revert workaround for Sonoma/Xcode 15.0.
`ld_classic` is no longer needed with HDF5 1.14.3.
HDFGroup/hdf5#3571
HDFGroup/hdf5#3581
"Removed "-commons" linking option on Darwin"
https://github.com/HDFGroup/hdf5/blob/hdf5_1_14_3/release_docs/RELEASE.txt
pmetzger pushed a commit to macports/macports-ports that referenced this issue Nov 16, 2023
.

Revert workaround for Sonoma/Xcode 15.0.
`ld_classic` is no longer needed with HDF5 1.14.3.
HDFGroup/hdf5#3571
HDFGroup/hdf5#3581
"Removed "-commons" linking option on Darwin"
https://github.com/HDFGroup/hdf5/blob/hdf5_1_14_3/release_docs/RELEASE.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component - Build CMake, Autotools Priority - 0. Blocker ⛔ This MUST be merged for the release to happen Type - Bug / Bugfix Please report security issues to [email protected] instead of creating an issue on GitHub
Projects
None yet
Development

No branches or pull requests

7 participants