beshrns / homebrew-mspgcc

formulae for the MSP430 microcontroller compiler toolchain
3 stars 1 forks source link

Various failures on macOS Mojave and High Sierra #4

Closed g-oikonomou closed 5 years ago

g-oikonomou commented 6 years ago

In the (somewhat distant) past I have installed this no problem at all, until a friend tried a couple of days ago and ran into problems, that I can confirm.

Straight off the box:

$ brew reinstall msp430-gcc
[...]
==> ../configure --target=msp430 --enable-languages=c,c++ --program-prefix='msp430-' --prefix=/usr/local/Cellar/msp430-gcc/4.7.0 --with-as=/usr/local/opt/msp430-binutils/
==> make
Last 15 lines from /Users/cexgo/Library/Logs/Homebrew/msp430-gcc/02.make:
checking for msp430-nm... /private/tmp/msp430-gcc-20181114-60411-1ftv2oq/gcc-4.7.0/build/./gcc/nm
checking for msp430-ranlib... msp430-ranlib
checking for msp430-strip... msp430-strip
checking whether ln -s works... yes
checking for msp430-gcc... /private/tmp/msp430-gcc-20181114-60411-1ftv2oq/gcc-4.7.0/build/./gcc/xgcc -B/private/tmp/msp430-gcc-20181114-60411-1ftv2oq/gcc-4.7.0/build/./gcc/ -B/usr/local/Cellar/msp430-gcc/4.7.0/msp430/bin/ -B/usr/local/Cellar/msp430-gcc/4.7.0/msp430/lib/ -isystem /usr/local/Cellar/msp430-gcc/4.7.0/msp430/include -isystem /usr/local/Cellar/msp430-gcc/4.7.0/msp430/sys-include   
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether /private/tmp/msp430-gcc-20181114-60411-1ftv2oq/gcc-4.7.0/build/./gcc/xgcc -B/private/tmp/msp430-gcc-20181114-60411-1ftv2oq/gcc-4.7.0/build/./gcc/ -B/usr/local/Cellar/msp430-gcc/4.7.0/msp430/bin/ -B/usr/local/Cellar/msp430-gcc/4.7.0/msp430/lib/ -isystem /usr/local/Cellar/msp430-gcc/4.7.0/msp430/include -isystem /usr/local/Cellar/msp430-gcc/4.7.0/msp430/sys-include    accepts -g... yes
checking for /private/tmp/msp430-gcc-20181114-60411-1ftv2oq/gcc-4.7.0/build/./gcc/xgcc -B/private/tmp/msp430-gcc-20181114-60411-1ftv2oq/gcc-4.7.0/build/./gcc/ -B/usr/local/Cellar/msp430-gcc/4.7.0/msp430/bin/ -B/usr/local/Cellar/msp430-gcc/4.7.0/msp430/lib/ -isystem /usr/local/Cellar/msp430-gcc/4.7.0/msp430/include -isystem /usr/local/Cellar/msp430-gcc/4.7.0/msp430/sys-include    option to accept ISO C89... unsupported
checking how to run the C preprocessor... /lib/cpp
configure: error: in `/private/tmp/msp430-gcc-20181114-60411-1ftv2oq/gcc-4.7.0/build/msp430/libgcc':
configure: error: C preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details.
make[1]: *** [configure-target-libgcc] Error 1
make: *** [all] Error 2

I tried the recommended fix from sampsyo/homebrew-mspgcc#13, same behaviour.

No idea why it goes and tries with /lib/cpp, which does not exist. So I changed msp430-gcc.rb like so:

$ git diff
diff --git a/msp430-gcc.rb b/msp430-gcc.rb
index 6f81ff6..f0d9e65 100644
--- a/msp430-gcc.rb
+++ b/msp430-gcc.rb
@@ -35,6 +35,7 @@ class Msp430Gcc < Formula
     ENV.remove_from_cflags(/ ?-march=\S*/)
     ENV.remove_from_cflags(/ ?-msse[\d\.]*/)
     ENV.remove_from_cflags(/ ?-mmacosx-version-min=10\.\d+/)
+    ENV['CPP'] = 'clang -E'

     # gcc must be built outside of the source directory.
     mkdir "build" do

Different problem:

$ brew reinstall msp430-gcc
[...]
==> ../configure --target=msp430 --enable-languages=c,c++ --program-prefix='msp430-' --prefix=/usr/local/Cellar/msp430-gcc/4.7.0 --with-as=/usr/local/opt/msp430-binutils/
==> make
Last 15 lines from /Users/cexgo/Library/Logs/Homebrew/msp430-gcc/02.make:
                 from ../../../../libgcc/libgcc2.c:29:
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/sys/_types/_size_t.h:31:1: error: unknown type name '__darwin_size_t'
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/stddef.h:79:0,
                 from ../../../../libgcc/../gcc/tsystem.h:45,
                 from ../../../../libgcc/libgcc2.c:29:
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/sys/_types/_wchar_t.h:34:1: error: unknown type name '__darwin_wchar_t'
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/stddef.h:82:0,
                 from ../../../../libgcc/../gcc/tsystem.h:45,
                 from ../../../../libgcc/libgcc2.c:29:
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/sys/_types/_wint_t.h:32:1: error: unknown type name '__darwin_wint_t'
make[4]: *** [__main.o] Error 1
make[3]: *** [multi-do] Error 1
make[2]: *** [all-multi] Error 2
make[1]: *** [all-target-libgcc] Error 2
make: *** [all] Error 2

Changed the formula again, using ENV['CPP'] = 'gcc -E'

$ brew reinstall msp430-gcc
[...]
==> ../configure --target=msp430 --enable-languages=c,c++ --program-prefix='msp430-' --prefix=/usr/local/Cellar/msp430-gcc/4.7.0 --with-as=/usr/local/opt/msp430-binutils/
==> make
Last 15 lines from /Users/cexgo/Library/Logs/Homebrew/msp430-gcc/02.make:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/stddef.h:79:0,
                 from ../../../../libgcc/../gcc/tsystem.h:45,
                 from ../../../../libgcc/libgcc2.c:29:
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/sys/_types/_wchar_t.h:34:1: error: unknown type name '__darwin_wchar_t'
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/stddef.h:82:0,
                 from ../../../../libgcc/../gcc/tsystem.h:45,
                 from ../../../../libgcc/libgcc2.c:29:
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/sys/_types/_wint_t.h:32:1: error: unknown type name '__darwin_wint_t'
make[4]: *** [_clear_cache.o] Error 1
make[4]: *** [_trampoline.o] Error 1
make[4]: *** [__main.o] Error 1
make[3]: *** [multi-do] Error 1
make[2]: *** [all-multi] Error 2
make[1]: *** [all-target-libgcc] Error 2
make: *** [all] Error 2

With ENV['CPP'] = '/usr/bin/cpp'

==> ../configure --target=msp430 --enable-languages=c,c++ --program-prefix='msp430-' --prefix=/usr/local/Cellar/msp430-gcc/4.7.0 --with-as=/usr/local/opt/msp430-binutils/
==> make
Last 15 lines from /Users/cexgo/Library/Logs/Homebrew/msp430-gcc/02.make:
checking for x86_64-apple-darwin18.2.0-lipo... no
checking for lipo... lipo
checking for x86_64-apple-darwin18.2.0-otool... no
checking for otool... otool
checking for x86_64-apple-darwin18.2.0-otool64... no
checking for otool64... no
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking for -force_load linker flag... yes
checking how to run the C preprocessor... /usr/bin/cpp
configure: error: in `/private/tmp/msp430-gcc-20181114-78241-oksnvi/gcc-4.7.0/build/lto-plugin':
configure: error: C preprocessor "/usr/bin/cpp" fails sanity check
See `config.log' for more details.
make[1]: *** [configure-lto-plugin] Error 1
make: *** [all] Error 2

I am running out of ideas here, not even sure whether this is a problem with the formula or whether it's a bug with msp430-gcc sources / build system. Any clues?

$ gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1
Apple LLVM version 10.0.0 (clang-1000.10.44.4)
Target: x86_64-apple-darwin18.2.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
AndrewMohawk commented 5 years ago

I managed to get around these errors by using the other brew repo: tgtakaoka/homebrew-mspgcc [ https://github.com/tgtakaoka/homebrew-mspgcc ] (in case anyone still gets here), on mojave.

This is a duplicate comment from the main repo (soz)

g-oikonomou commented 5 years ago

Thanks @AndrewMohawk I can confirm this on Mojave.