Author Topic: toolchain on mac osx  (Read 5250 times)

rastafari199625 (OP)

  • *
  • Posts: 27
toolchain on mac osx
« on: May 22, 2014, 04:12:00 pm »
Hello, has somebody succefully built the toolchain on mac osx ? When I try to make it the console says to me that gcc is not installed but it is in /usr/bin any suggestions ?
Thanks in advence

RodrigoCard

  • *
  • Posts: 314
    • Mac Joystick Apps
Re: toolchain on mac osx
« Reply #1 on: May 22, 2014, 07:38:41 pm »
Did you install the Xcode or the "command line tools" first?
I think there is a few things that are different.

I will try to build later.

« Last Edit: May 22, 2014, 07:40:21 pm by RodrigoCard »

rastafari199625 (OP)

  • *
  • Posts: 27
Re: toolchain on mac osx
« Reply #2 on: May 23, 2014, 02:43:14 pm »
Obviously the command line tool is already installed.
Code: [Select]
ls /Applications/Xcode.app/Contents/Developer/usr/bin/gcc
/Applications/Xcode.app/Contents/Developer/usr/bin/gcc

ls /usr/bin/gcc
/usr/bin/gcc
The gcc binary has got two locations but when I type gcc in terminal I exec the /usr/bin/gcc and it works

debug : https://mega.co.nz/#!p4UiFLAR!BPrbyDiLDeTW6patdHX90Lw3fgKcSshg_U20Nwg4-W4

RodrigoCard

  • *
  • Posts: 314
    • Mac Joystick Apps
Re: toolchain on mac osx
« Reply #3 on: May 26, 2014, 05:25:46 am »
There was a script made to build the old dingux toolchain somewhere in the dingux development forum, I didnt find it, but i remember that was helpful at the time.

rastafari199625 (OP)

  • *
  • Posts: 27
Re: toolchain on mac osx
« Reply #4 on: May 29, 2014, 12:53:02 am »
do you talk about that http://clogging.web.fc2.com/dingoo/dingux-cross.zip
what do you want to do with that ? tweak it to compile the gcw0-toolchain ?

RodrigoCard

  • *
  • Posts: 314
    • Mac Joystick Apps
Re: toolchain on mac osx
« Reply #5 on: May 29, 2014, 07:49:36 pm »
I was just guessing. I tried right now and got the same error.
I will take a look later if I have time.

Also, look here: http://stackoverflow.com/questions/6396165/best-way-to-build-cross-toolchains-on-mac-os-x

do you talk about that http://clogging.web.fc2.com/dingoo/dingux-cross.zip
what do you want to do with that ? tweak it to compile the gcw0-toolchain ?

That link appears to be down, try this if you cant download https://dl.dropboxusercontent.com/u/14890209/dingux-cross-auto.zip

Yes, I would try to tweak this script to build the gcw0 toolchain. Not sure if will work.
« Last Edit: May 29, 2014, 08:54:12 pm by RodrigoCard »

rastafari199625 (OP)

  • *
  • Posts: 27
Re: toolchain on mac osx
« Reply #6 on: May 29, 2014, 09:01:08 pm »
the modification that I've already done :
-remove the lines about gcc and g++ checking in dependencies.sh
-remplace all the sed -r by sed -E in many files
-maybe oders but I don't remember, sorry...

here the remains errors :
Code: [Select]
MacBook-Pro-de-Guillaume:buildroot-opendingux-2014.02 guillaume$ make
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1
support/dependencies/check-host-tar.sh: line 26: [: too many arguments
support/dependencies/check-host-tar.sh: line 29: [: too many arguments
/Users/guillaume/Documents/GCW-zero/toolchain_building/buildroot-opendingux-2014.02/support/dependencies/dependencies.sh: line 96: [: too many arguments
>>> linux-headers 3.13.6 Installing to staging directory
(cd /Users/guillaume/Documents/GCW-zero/toolchain_building/buildroot-opendingux-2014.02/output/build/linux-headers-3.13.6; PATH="/Users/guillaume/Documents/GCW-zero/toolchain_building/buildroot-opendingux-2014.02/output/host/bin:/Users/guillaume/Documents/GCW-zero/toolchain_building/buildroot-opendingux-2014.02/output/host/usr/bin:/Users/guillaume/Documents/GCW-zero/toolchain_building/buildroot-opendingux-2014.02/output/host/usr/sbin/:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/opt/local/bin:/opt/local/bin:/Users/guillaume/Documents/android-sdk-macosx/platform-tools:/Users/guillaume/Documents/android-sdk-macosx:/Users/guillaume/Documents/android-sdk-macosx/tools:/Users/guillaume/Qt5.1.0/5.1.0/clang_64/bin/:/opt/gcw0-toolchain/usr/bin" /Applications/Xcode.app/Contents/Developer/usr/bin/make -j9 ARCH=mips HOSTCC="/usr/bin/gcc" HOSTCFLAGS="" HOSTCXX="/usr/bin/g++" INSTALL_HDR_PATH=/Users/guillaume/Documents/GCW-zero/toolchain_building/buildroot-opendingux-2014.02/output/host/usr/mipsel-gcw0-linux-uclibc/sysroot/usr headers_install)
  CHK     include/generated/uapi/linux/version.h
/Users/guillaume/Documents/GCW-zero/toolchain_building/buildroot-opendingux-2014.02/output/build/linux-headers-3.13.6/scripts/Makefile.headersinst:55: *** Missing UAPI file /Users/guillaume/Documents/GCW-zero/toolchain_building/buildroot-opendingux-2014.02/output/build/linux-headers-3.13.6/include/uapi/linux/netfilter/xt_CONNMARK.h.  Stop.
make[3]: *** [netfilter] Error 2
make[3]: *** Waiting for unfinished jobs....
/Users/guillaume/Documents/GCW-zero/toolchain_building/buildroot-opendingux-2014.02/output/build/linux-headers-3.13.6/scripts/Makefile.headersinst:55: *** Missing UAPI file /Users/guillaume/Documents/GCW-zero/toolchain_building/buildroot-opendingux-2014.02/output/build/linux-headers-3.13.6/include/uapi/linux/netfilter_ipv4/ipt_ECN.h.  Stop.
/Users/guillaume/Documents/GCW-zero/toolchain_building/buildroot-opendingux-2014.02/output/build/linux-headers-3.13.6/scripts/Makefile.headersinst:55: *** Missing UAPI file /Users/guillaume/Documents/GCW-zero/toolchain_building/buildroot-opendingux-2014.02/output/build/linux-headers-3.13.6/include/uapi/linux/netfilter_ipv6/ip6t_HL.h.  Stop.
make[3]: *** [netfilter_ipv4] Error 2
make[3]: *** [netfilter_ipv6] Error 2
  INSTALL include/linux/sunrpc (1 file)
make[2]: *** [linux] Error 2
make[1]: *** [headers_install] Error 2
make: *** [/Users/guillaume/Documents/GCW-zero/toolchain_building/buildroot-opendingux-2014.02/output/build/linux-headers-3.13.6/.stamp_staging_installed] Error 2
MacBook-Pro-de-Guillaume:buildroot-opendingux-2014.02 guillaume$

Arrakis

  • *
  • Posts: 6
Re: toolchain on mac osx
« Reply #7 on: June 21, 2014, 04:41:20 pm »
Has anyone managed to get this to work?  I had a very quick try yesterday, but it was complaining about ncurses not being installed.  As I installed it through MacPorts maybe the headers weren't installed.  Anyway, before I invest more time in it, I'd like to know how others have fared

zear

  • * Moderator
  • Posts: 2379
Re: toolchain on mac osx
« Reply #8 on: December 16, 2015, 05:31:29 pm »
As I've recently acquired a Mac Mini, I decided to resurrect this thread with my new findings.

I created a fork of the GCW0 buildroot with some of my OSX patches: https://github.com/zear/buildroot/commits/osx_fixes

Changes:
* gmp: Workaround for Darwin assembler quirk.
* Remove gcc version check to allow for clang usage

In order to get past the sed problems mentioned by others above, one needs to install the GNU flavour of sed via homebrew:
Code: [Select]
brew install gnu-sed

Then it's required to add gnu-sed location to PATH, so that the terminal will see this version instead of the default BSD flavour:
Code: [Select]
export PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"

With those changes, I get as far as uclibc compilation, which fails at:
Code: [Select]
extra/scripts/unifdef.c:81:8: error: expected parameter declarator
size_t strlcpy(char *dst, const char *src, size_t siz);

The good thing however is that with my changes, the compilation process manages to build the compiler, before it succumbs to the issue above.

It means that one can do a simple trick of downloading the latest official x86 Linux toolchain, extracting it to /opt/gcw0-toolchain/ and then copying over the freshly built compiler, resulting in a working GCW0 cross-compiler for OSX.
I have only tested it on my own software projects, but it compiles and the produced binaries/OPKs work fine.
There are some symlink issues and I can't guarantee that every thing necessary gets compiled before the compilation process fails, however this is already something useful to many.

Because of the mentioned quirks I won't be uploading a precompiled build, but at this point I assume that the interested parties are able to compile their own version based on my github fork/branch and the above tips.

greedymex

  • Posts: 3
Re: toolchain on mac osx
« Reply #9 on: December 18, 2015, 02:42:04 pm »
With those changes, I get as far as uclibc compilation, which fails at:
Code: [Select]
extra/scripts/unifdef.c:81:8: error: expected parameter declarator
size_t strlcpy(char *dst, const char *src, size_t siz);

Add -D_FORTIFY_SOURCE=0 to CFLAGS to solve this issue if you're still interested to get whole build process working

slaanesh

  • *
  • Posts: 477
    • Slaanesh Dev
Re: toolchain on mac osx
« Reply #10 on: September 06, 2018, 10:28:38 pm »
Would someone be able to post a pre-built toolchain for Mac OS X based on these instructions?

gameblabla

  • **
  • Posts: 849
Re: toolchain on mac osx
« Reply #11 on: September 12, 2018, 10:13:04 am »
Would someone be able to post a pre-built toolchain for Mac OS X based on these instructions?
The official toolchain is 32-bits only and i heard that Apple are going to discontinue 64-bits support.
So in addition to that, you will also need to compile a 64-bits toolchain on a linux distribution.

I'm afraid it won't be easily possible unless you use a linux distro or WSL.

slaanesh

  • *
  • Posts: 477
    • Slaanesh Dev
Re: toolchain on mac osx
« Reply #12 on: February 05, 2019, 10:08:57 am »
I tried getting using zear's buildroot to build a GCW-0 toolchain on a 10.11.6 (El Capitan) Macbook but failed.
Couldn't even get the menuconfig to build at the start :-(
Kept getting errors looking for ncurses and despite having used brew to install a variety of prerequisites.

Code: [Select]
Undefined symbols for architecture x86_64:
  "_acs_map", referenced from:
      _dialog_checklist in checklist.o
      _print_arrows in checklist.o
      _dialog_clear in util.o
      _draw_box in util.o
      _dialog_inputbox in inputbox.o
      _dialog_textbox in textbox.o
      _dialog_yesno in yesno.o
      ...
  "_cbreak", referenced from:
      _init_dialog in util.o
  "_delwin", referenced from:
...etc

 

Post a new topic