[MacPorts] #54599: g++ rejects flag "-stdlib"

MacPorts noreply at macports.org
Sun Aug 13 03:40:58 UTC 2017


#54599: g++ rejects flag "-stdlib"
-------------------------+-----------------
  Reporter:  mouse07410  |      Owner:
      Type:  defect      |     Status:  new
  Priority:  Normal      |  Milestone:
 Component:  ports       |    Version:
Resolution:              |   Keywords:
      Port:              |
-------------------------+-----------------

Comment (by mouse07410):

 > yep -- a little tough to help without knowing what port this is -- if in
 fact this is a port you're trying to build.

 Darn... Silly me. The port I'm complaining about is gcc6:

 {{{
 $ port info gcc6
 gcc6 @6.4.0 (lang)
 Sub-ports:            libgcc
 Variants:             universal

 Description:          The GNU compiler collection, including front ends
 for C, C++, Objective-C, Objective-C++, and Fortran.
 Homepage:             http://gcc.gnu.org/

 Extract Dependencies: xz
 Library Dependencies: cctools, gmp, isl, ld64, libgcc, libiconv, libmpc,
 mpfr
 Runtime Dependencies: gcc_select
 Platforms:            darwin
 License:              {GPL-3+ Permissive}
 Maintainers:          none
 }}}


 > gcc does not handle the -stdlib flag.

 And this is the essence of my complaint - because for the C++ code I'm
 compiling/linking I need to be able to tell g++ to use libc++ instead of
 libstdc++. Otherwise it won't be able to link with other libraries that
 are compiled for libc++. Which is why I cannot "just delete "-stdlib" from
 the build line - I'd get something like

 {{{
 $ g++ -std=c++11 -o tfd -I/opt/local/include tf.cpp -L/opt/local/lib -lecm
 -lgmpxx -lgmp -lc++
 Undefined symbols for architecture x86_64:
   "operator<<(std::basic_ostream<char, std::char_traits<char> >&,
 __mpz_struct const*)", referenced from:
       std::basic_ostream<char, std::char_traits<char> >& operator<<
 <__mpz_struct [1], __mpz_struct [1]>(std::basic_ostream<char,
 std::char_traits<char> >&, __gmp_expr<__mpz_struct [1], __mpz_struct [1]>
 const&) in ccUkMPud.o
   "operator>>(std::basic_istream<char, std::char_traits<char> >&,
 __mpz_struct*)", referenced from:
       std::basic_istream<char, std::char_traits<char> >&
 operator>><__mpz_struct [1]>(std::basic_istream<char,
 std::char_traits<char> >&, __gmp_expr<__mpz_struct [1], __mpz_struct
 [1]>&) in ccUkMPud.o
 ld: symbol(s) not found for architecture x86_64
 collect2: error: ld returned 1 exit status
 }}}

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


More information about the macports-tickets mailing list