1

I know these have been posted before, but I'm stuck and can't seem to get anywhere, even by reading copious responses to similar issues to mine.

I get the dreaded "C compiler cannot..." from the title of this post.

I'm on macOS Sierra (long story as to why I'm behind), and have XCode CLT 9.2 installed. I ditched the full XCode app and just went down to the CLT - installed from the Dev area.

Otherwise, I have the latest Homebrew, GCC, Dialog, Libtool, and Automake/Autoconf - some were pre-reqs for the LIRC system I'm trying to get compiled and installed (IR subsystem).

brew config shows that it properly sees the correct XCode CLT, so my guess is that that part is ok.

I get errors once I run the ./configure for this system I'm trying to get up and running...here's the output:

Configuration: .setup.config, executable shell script: configure.sh
Starting the generated shell script which will call configure with the right
parameters...
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/Volumes/Macintosh HD Giant/Users/Nidocamen/Downloads/LIRC-port-for-Mac-OS-X-master':
configure: error: C compiler cannot create executables
See `config.log' for more details

Thought it could be a permissions issue on the LIRC folder, but it's accessible.

I put in a symlink to ensure that gcc is running gcc-9 in /usr/local/bin and ensured that that path is before /usr/bin (brew doctor isn't complaining about that anymore).

Anyways, I'm otherwise really not sure what's causing this to fail. I've been a developer before, but more on the web app side of things and not at this level.

If anyone has some suggestions, I'd love to hear them...thanks! :)

UPDATE - here's some output from the log that would appear to narrow this down. While the people who created this install claims it works well on recent macOS version, it seems like some of the code used is really outdated and that could be why it's not compiling.

Configured with: ../configure --build=x86_64-apple-darwin16 --prefix=/usr/local/Cellar/gcc/9.2.0 --libdir=/usr/local/Cellar/gcc/9.2.0/lib/gcc/9 --disable-nls --enable-checking=release --enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-9 --with-gmp=/usr/local/opt/gmp --with-mpfr=/usr/local/opt/mpfr --with-mpc=/usr/local/opt/libmpc --with-isl=/usr/local/opt/isl --with-system-zlib --with-pkgversion='Homebrew GCC 9.2.0' --with-bugurl=https://github.com/Homebrew/homebrew-core/issues
Thread model: posix
gcc version 9.2.0 (Homebrew GCC 9.2.0) 
configure:3322: $? = 0
configure:3311: gcc -V >&5
gcc: error: unrecognized command line option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:3322: $? = 1
configure:3311: gcc -qversion >&5
gcc: error: unrecognized command line option '-qversion'; did you mean '--version'?
gcc: fatal error: no input files
compilation terminated.
configure:3322: $? = 1
configure:3342: checking whether the C compiler works
configure:3364: gcc -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -mmacosx-version-min=10.9   conftest.c  >&5
ld: library not found for -lSystem
collect2: error: ld returned 1 exit status
configure:3368: $? = 1
configure:3406: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define PACKAGE "lirc"
| #define VERSION "0.9.1-git"
| /* end confdefs.h.  */
Joe D
  • 11
  • 1
  • 3
  • Do you have a file with the same name as the executable? Is that file being executed while the compiler is trying to replace the executable? – Jim Rogers Sep 21 '19 at 01:23
  • Did you look in `config.log` as the error message suggests? That will show you the command line and input used for that configure step. You can diagnose and fix given that information. – Carl Norum Sep 21 '19 at 01:54
  • Jim, I don't think so. – Joe D Sep 21 '19 at 02:03
  • @CarlNorum - I did re-look at the file, and it appears that the issue could be here: `configure:3311: gcc -V >&5 gcc: error: unrecognized command line option '-V' gcc: fatal error: no input files configure:3311: gcc -qversion >&5 gcc: error: unrecognized command line option '-qversion'; did you mean '--version'? gcc: fatal error: no input files configure:3342: checking whether the C compiler works configure:3364: gcc ld: library not found for -lSystem collect2: error: ld returned 1 exit status ` Also complained full XCode wasn't installed. Few lines removed, line brs can't keep in. – Joe D Sep 21 '19 at 02:09
  • Formatting in comments sucks. Can you show it in an edit to your question, please? – Carl Norum Sep 21 '19 at 03:17
  • @CarlNorum - yep, it does. I updated the original question. Thx! – Joe D Sep 21 '19 at 03:30
  • OK - so what happens if you try to run that same command yourself? Add a `-v` flag to see what's up with the linker (which is the part that actually seems to be failing) – Carl Norum Sep 21 '19 at 03:40
  • Where does that `isysroot` thing come from? Does it make sense for a non-apple provided compiler to be doing that? – Carl Norum Sep 21 '19 at 03:41
  • I wound up abandoning this version and was able to get lirc installed correctly via another mgmt tool called MacPorts. I appreciate the help! – Joe D Sep 23 '19 at 21:09

1 Answers1

0

I had a similar issue, and in my case the "library not found for -lSystem" was caused by a line in my .bash_profile

alias openclc=/System/Library/Frameworks/OpenCL.framework/Libraries/openclc

No idea why I had put that in there, but unalias-ing it fixed my issues...

John Tromp
  • 274
  • 2
  • 3