HariboteOS / tolsrc

Tool set for developing Haribote OS .

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compile failed on Xcode 10

kawasin73 opened this issue · comments

$ make GCC=/usr/local/Cellar/gcc/8.3.0_2/bin/gcc-8
...
...
...
/usr/local/Cellar/gcc/8.3.0_2/bin/gcc-8 -m32 -Wl,-s -o gocpp0  ../drv_stdc/cpp0main.obj cppmain.o intl.o \
		libcpp.lib hashtable.o version.o ../intl/libintl.lib ../libiberty/libiberty.lib ../go_lib/go_lib.lib ../go_lib/stdin.o ../drv_stdc/drv_stdc.obj
ld: warning: option -s is obsolete and being ignored
ld: warning: The i386 architecture is deprecated for macOS (remove from the Xcode build setting: ARCHS)
ld: warning: ignoring file /usr/local/Cellar/gcc/8.3.0_2/lib/gcc/8/libgcc_ext.10.5.dylib, missing required architecture i386 in file /usr/local/Cellar/gcc/8.3.0_2/lib/gcc/8/libgcc_ext.10.5.dylib (1 slices)
ld: warning: ignoring file /usr/local/Cellar/gcc/8.3.0_2/lib/gcc/8/gcc/x86_64-apple-darwin18/8.3.0/libgcc.a, file was built for archive which is not the architecture being linked (i386): /usr/local/Cellar/gcc/8.3.0_2/lib/gcc/8/gcc/x86_64-apple-darwin18/8.3.0/libgcc.a
ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd, missing required architecture i386 in file /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd
...
...
...
ld: symbol(s) not found for architecture i386
collect2: error: ld returned 1 exit status
make[3]: *** [gocpp0] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all] Error 2
make: *** [all] Error 2

Environments

  • macOS : 10.14.5 (mojave)
  • Macbook Pro 13 inch
  • Xcode : 10.2.1
  • gcc installed by Homebrew

i386 is deprecated after Xcode 10

https://stackoverflow.com/questions/53610512/i386-architecture-deprecated-in-macos-error

The macOS 10.14 SDK no longer contains support for compiling 32-bit applications. If developers need to compile for i386, Xcode 9.4 or earlier is required. (39858111)

https://developer.apple.com/documentation/xcode_release_notes/xcode_10_release_notes

Use MacOS10.13.sdk in Xcode 9.4.1.

  1. Download Xcode_9.4.1.xip from https://developer.apple.com/download/more/
  2. Extract Xcode_9.4.1.xip
  3. Rename downloaded Xcode.app to Xcode_9.4.1.app and move it to /Applications/Xcode_9.4.1.app
  4. Compile tolsrc using installed new SDK with --sysroot flag of gcc (It is not able to use CFLAGS)
$ cd path/to/tolsrc
$ make GCC="/usr/local/Cellar/gcc/9.1.0/bin/gcc-9 --sysroot=/Applications/Xcode_9.4.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/"
$ make install

reference : kawasin73/kos-sample#2

Thank you for reporting the issue. I confirmed this problem is reproducible and your solution is worked.
However, this solution is hard to be automated so we need this solution to be documented.
Could you make a pull request that changes the README to including this information?
Thanks!

sure!