Opened 8 years ago

Closed 8 years ago

#53758 closed defect (invalid)

gcc6 @6.3.0_2: g++ fails to find stdc++ includes when -isysroot set

Reported by: ibethune (Iain Bethune) Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.4.0
Keywords: Cc: ryandesign (Ryan Carsten Schmidt)
Port: gcc6

Description

I just did a 'port upgrade outdated' which installed gcc6 @6.3.0_2 (previously I had @6.2.0_2). The following example is now failing for me since the upgrade:

Iains-MacBook-Pro:Desktop ibethune$ cat test.cpp
#include <string>

int main(int argc, char **argv) { return 0; }

Iains-MacBook-Pro:Desktop ibethune$ g++ -v -isysroot=/Developer/SDKs/MacOSX10.9.sdk/ -o test test.cpp
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/opt/local/libexec/gcc/x86_64-apple-darwin16/6.3.0/lto-wrapper
Target: x86_64-apple-darwin16
Configured with: /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc6/gcc6/work/gcc-6.3.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 --with-pkgversion='MacPorts gcc6 6.3.0_2' --with-sysroot=
Thread model: posix
gcc version 6.3.0 (MacPorts gcc6 6.3.0_2) 
COLLECT_GCC_OPTIONS='-v' '-isysroot' '=/Developer/SDKs/MacOSX10.9.sdk/' '-o' 'test' '-mmacosx-version-min=10.12.4' '-asm_macosx_version_min=10.12' '-shared-libgcc' '-mtune=core2'
 /opt/local/libexec/gcc/x86_64-apple-darwin16/6.3.0/cc1plus -quiet -v -D__DYNAMIC__ -isysroot =/Developer/SDKs/MacOSX10.9.sdk/ test.cpp -fPIC -quiet -dumpbase test.cpp -mmacosx-version-min=10.12.4 -mtune=core2 -auxbase test -version -o /var/folders/fk/ljxr9h0x2zx1lcjrtskgv02r0000gn/T//ccnNmN3P.s
GNU C++14 (MacPorts gcc6 6.3.0_2) version 6.3.0 (x86_64-apple-darwin16)
	compiled by GNU C version 6.3.0, GMP version 6.1.2, MPFR version 3.1.4, MPC version 1.0.3, isl version 0.15
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "=/Developer/SDKs/MacOSX10.9.sdk/opt/local/include/gcc6/c++/"
ignoring nonexistent directory "=/Developer/SDKs/MacOSX10.9.sdk/opt/local/include/gcc6/c++//x86_64-apple-darwin16"
ignoring nonexistent directory "=/Developer/SDKs/MacOSX10.9.sdk/opt/local/include/gcc6/c++//backward"
ignoring nonexistent directory "=/Developer/SDKs/MacOSX10.9.sdk/opt/local/include"
ignoring nonexistent directory "/opt/local/lib/gcc6/gcc/x86_64-apple-darwin16/6.3.0/../../../../../x86_64-apple-darwin16/include"
ignoring nonexistent directory "=/Developer/SDKs/MacOSX10.9.sdk/usr/include"
ignoring nonexistent directory "=/Developer/SDKs/MacOSX10.9.sdk//System/Library/Frameworks"
ignoring nonexistent directory "=/Developer/SDKs/MacOSX10.9.sdk//Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
 /opt/local/lib/gcc6/gcc/x86_64-apple-darwin16/6.3.0/include
 /opt/local/lib/gcc6/gcc/x86_64-apple-darwin16/6.3.0/include-fixed
End of search list.
GNU C++14 (MacPorts gcc6 6.3.0_2) version 6.3.0 (x86_64-apple-darwin16)
	compiled by GNU C version 6.3.0, GMP version 6.1.2, MPFR version 3.1.4, MPC version 1.0.3, isl version 0.15
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: d36822ecd9de6fb879bb93e66b8d0005
test.cpp:1:18: fatal error: string: No such file or directory
 #include <string>
                  ^
compilation terminated.

With the previous versions (e.g. gcc5) it also searches under directory /opt/local/include/gcc5/c++/. So how should I build using gcc6 targetting an old macOS SDK?

Change History (2)

comment:1 Changed 8 years ago by kencu (Ken)

Look at 53726 for an issue which sounds similar to yours, perhaps.

Edit - sorry, looks different. My bad.

Last edited 8 years ago by kencu (Ken) (previous) (diff)

comment:2 in reply to:  description Changed 8 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: ryandesign added
Resolution: invalid
Status: newclosed

Replying to ibethune:

Iains-MacBook-Pro:Desktop ibethune$ g++ -v -isysroot=/Developer/SDKs/MacOSX10.9.sdk/ -o test test.cpp

The correct syntax is:

-isysroot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk

That is to say, there is no equals sign between -isysroot and the sysroot path, and surely your SDKs are in the Xcode application and not anymore in /Developer which should no longer exist since OS X 10.7.

Note: See TracTickets for help on using tickets.