Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22113

Cannot link any C program with gcc on Mac Mojave

$
0
0

I've just updated to OSX 10.14.6 (Mojave) and now, after upgrading Xcode and migrating MacPorts, even the simplest C program will not link with any gcc version. For example, linking the program

int main() {}

gives:

dcs16> gcc test.c 
ld: library not found for -lSystem
collect2: error: ld returned 1 exit status

I am using gcc 6.5 in /opt/local/bin:

dcs16> gcc --version
gcc (MacPorts gcc6 6.5.0_4) 6.5.0

The Xcode version is 11.0 and I have installed the package (which was recommended for solving some compile problems that other people had):

/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

Any help is greatly appreciated.

Note: There is no problem linking with clang.

Note gcc search dirs are:

test> gcc -print-search-dirs
install: /opt/local/lib/gcc6/gcc/x86_64-apple-darwin18/6.5.0/
programs: =/opt/local/libexec/gcc/x86_64-apple-darwin18/6.5.0/:/opt/local/libexec/gcc/x86_64-apple-darwin18/6.5.0/:/opt/local/libexec/gcc/x86_64-apple-darwin18/:/opt/local/lib/gcc6/gcc/x86_64-apple-darwin18/6.5.0/:/opt/local/lib/gcc6/gcc/x86_64-apple-darwin18/:/opt/local/lib/gcc6/gcc/x86_64-apple-darwin18/6.5.0/../../../../../x86_64-apple-darwin18/bin/x86_64-apple-darwin18/6.5.0/:/opt/local/lib/gcc6/gcc/x86_64-apple-darwin18/6.5.0/../../../../../x86_64-apple-darwin18/bin/
libraries: =/opt/local/lib/gcc6/gcc/x86_64-apple-darwin18/6.5.0/:/opt/local/lib/gcc6/gcc/x86_64-apple-darwin18/6.5.0/../../../../../x86_64-apple-darwin18/lib/x86_64-apple-darwin18/6.5.0/:/opt/local/lib/gcc6/gcc/x86_64-apple-darwin18/6.5.0/../../../../../x86_64-apple-darwin18/lib/:/opt/local/lib/gcc6/gcc/x86_64-apple-darwin18/6.5.0/../../../x86_64-apple-darwin18/6.5.0/:/opt/local/lib/gcc6/gcc/x86_64-apple-darwin18/6.5.0/../../../

Viewing all articles
Browse latest Browse all 22113


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>