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

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

MacPorts
#54599: g++ rejects flag "-stdlib"
------------------------+-----------------
 Reporter:  mouse07410  |      Owner:
     Type:  defect      |     Status:  new
 Priority:  Normal      |  Milestone:
Component:  ports       |    Version:
 Keywords:              |       Port:
------------------------+-----------------
 MacOS Sierra 10.12.6, Xcode-8.3.3, current Macports, Macports-installed
 GCC/G++:

 {{{
 $ g++ -v
 Using built-in specs.
 COLLECT_GCC=g++
 COLLECT_LTO_WRAPPER=/opt/local/libexec/gcc/x86_64-apple-darwin16/6.4.0
 /lto-wrapper
 Target: x86_64-apple-darwin16
 Configured with:
 /opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_lang_gcc6/gcc6/work/gcc-6.4.0/configure
 --prefix=/opt/local --build=x86_64-apple-darwin16 --enable-
 languages=c,c++,objc,obj-c++,lto,fortran --libdir=/opt/local/lib/gcc6
 --includedir=/opt/local/include/gcc6 --infodir=/opt/local/share/info
 --mandir=/opt/local/share/man --datarootdir=/opt/local/share/gcc-6 --with-
 local-prefix=/opt/local --with-system-zlib --disable-nls --program-
 suffix=-mp-6 --with-gxx-include-dir=/opt/local/include/gcc6/c++/ --with-
 gmp=/opt/local --with-mpfr=/opt/local --with-mpc=/opt/local --with-
 isl=/opt/local --enable-stage1-checking --disable-multilib --enable-lto
 --enable-libstdcxx-time --with-build-config=bootstrap-debug --with-
 as=/opt/local/bin/as --with-ld=/opt/local/bin/ld --with-
 ar=/opt/local/bin/ar --with-bugurl=https://trac.macports.org/newticket
 --disable-tls --with-pkgversion='MacPorts gcc6 6.4.0_0'
 Thread model: posix
 gcc version 6.4.0 (MacPorts gcc6 6.4.0_0)
 $ g++ -std=c++11 -stdlib=libc++ -o tfd -I/opt/local/include tf.cpp
 -L/opt/local/lib -lecm -lgmpxx -lgmp -lc++
 g++: error: unrecognized command line option '-stdlib=libc++'
 $
 }}}

--
Ticket URL: <https://trac.macports.org/ticket/54599>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

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

Comment (by kencu):

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

 gcc does not handle the -stdlib flag.

 Just delete it from your build line. Or use clang, which does handle it,
 if you prefer that.

--
Ticket URL: <https://trac.macports.org/ticket/54599#comment:1>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

MacPorts
In reply to this post by MacPorts
#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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

MacPorts
In reply to this post by MacPorts
#54599: g++ rejects flag "-stdlib"
-------------------------+-----------------
  Reporter:  mouse07410  |      Owner:
      Type:  defect      |     Status:  new
  Priority:  Normal      |  Milestone:
 Component:  ports       |    Version:
Resolution:              |   Keywords:
      Port:              |
-------------------------+-----------------

Comment (by kencu):

 Thanks. If you're on 10.6 or later, you should use clang++ instead of g++.
 So your build line would be something like this:

 {{{
 /opt/local/bin/clang++-mp-4.0 -stdlib=libc++ -std=c++11 -o tfd
 -I/opt/local/include -L/opt/local/lib  tf.cpp
 }}}

 libgmp doesn't swim well with clang, and you don't need -lc++. Sorry I
 don't know what -lecm is all about.

--
Ticket URL: <https://trac.macports.org/ticket/54599#comment:3>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

MacPorts
In reply to this post by MacPorts
#54599: g++ rejects flag "-stdlib"
-------------------------+-----------------
  Reporter:  mouse07410  |      Owner:
      Type:  defect      |     Status:  new
  Priority:  Normal      |  Milestone:
 Component:  ports       |    Version:
Resolution:              |   Keywords:
      Port:              |
-------------------------+-----------------

Comment (by kencu):

 If you really, really need to use gcc6 instead of clang, there is a way.
 <http://libcxx.llvm.org/docs/UsingLibcxx.html> will show you. I suggest
 you use clang++ instead, however.

--
Ticket URL: <https://trac.macports.org/ticket/54599#comment:4>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

MacPorts
In reply to this post by MacPorts
#54599: g++ rejects flag "-stdlib"
-------------------------+-----------------
  Reporter:  mouse07410  |      Owner:
      Type:  defect      |     Status:  new
  Priority:  Normal      |  Milestone:
 Component:  ports       |    Version:
Resolution:              |   Keywords:
      Port:              |
-------------------------+-----------------

Comment (by mouse07410):

 Thank you! Let me experiment with this, following your recommendations.

--
Ticket URL: <https://trac.macports.org/ticket/54599#comment:5>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [MacPorts] #54599: gcc6 @6.4.0: g++ rejects flag "-stdlib" (was: g++ rejects flag "-stdlib")

MacPorts
In reply to this post by MacPorts
#54599: gcc6 @6.4.0: g++ rejects flag "-stdlib"
-------------------------+--------------------
  Reporter:  mouse07410  |      Owner:
      Type:  defect      |     Status:  closed
  Priority:  Normal      |  Milestone:
 Component:  ports       |    Version:
Resolution:  invalid     |   Keywords:
      Port:  gcc6        |
-------------------------+--------------------
Changes (by ryandesign):

 * status:  new => closed
 * resolution:   => invalid
 * port:   => gcc6


Comment:

 Not our bug. Complain to developers of gcc if needed.

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