[MacPorts] #67355: Compiling hdf5 with +gcc12

MacPorts noreply at macports.org
Tue May 2 16:10:09 UTC 2023


#67355: Compiling hdf5 with +gcc12
--------------------------+----------------------
  Reporter:  jvianalopes  |      Owner:  eborisch
      Type:  defect       |     Status:  assigned
  Priority:  Normal       |  Milestone:
 Component:  ports        |    Version:
Resolution:               |   Keywords:
      Port:  hdf5         |
--------------------------+----------------------

Comment (by ryandesign):

 Replying to [ticket:67355 jvianalopes]:
 > My problem is that I need to compile a program in c++  the linking fails
 because it fails to find objects. \\
 > As an example:
 > {{{
 > Undefined symbols for architecture x86_64:
 >
 "__ZN2H510H5Location12iterateElemsERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPiPFixPKcPvESC_",
 referenced from:
 >
 > And the compiled libhdf5_cpp.a has:
 >
 __ZN2H510H5Location12iterateElemsERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEPiPFixPKcPvESD_
 > }}}

 When you say "objects", you mean "symbols"?

 These symbols, demangled, are:
 * `H5::H5Location::iterateElems(std::__cxx11::basic_string<char,
 std::char_traits<char>, std::allocator<char>> const&, int*, int (*)(long
 long, char const*, void*), void*)`
 * `H5::H5Location::iterateElems(std::__1::basic_string<char,
 std::__1::char_traits<char>, std::__1::allocator<char>> const&, int*, int
 (*)(long long, char const*, void*), void*)`
 So they're hdf5 symbols.

 This C++ program you're compiling... which compiler are you using? You'll
 need to use the same C++ standard library for both your program and all of
 the C++ libraries that it uses. So, for example, either use clang and
 libc++ to compile your program and hdf5 (this is very strongly recommended
 on macOS) or use g++ and libstdc++ to compile your program and hdf5. You
 can't mix and match.

 > My question is how does macports fix the compiler? Because I used the
 variant +gcc12 but it seems that it is not the same as defining the
 compilers as environment  variables in the configure.

 You can run `sudo port configure hdf5 +gcc12 +cxx` (and you can interrupt
 it by pressing Control-C shortly after the `--->  Configuring hdf5` line
 is printed; you don't have to wait for the configure phase to finish) and
 then examine the log file (whose location is printed by `port logfile
 hdf5`) to see exactly what configure command, flags, and environment
 variables MacPorts used.

-- 
Ticket URL: <https://trac.macports.org/ticket/67355#comment:3>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list