Issues compiling on OSX

C programming, build, interpreter/VM.
Target audience: MicroPython Developers.
Post Reply
HappyF0x
Posts: 1
Joined: Thu Aug 11, 2016 7:27 pm

Issues compiling on OSX

Post by HappyF0x » Thu Aug 11, 2016 8:04 pm

I searched for any one else having the same issues I found nothing, so here goes.

I was following the instructions to build a native OSX binary at :

https://github.com/micropython/micropyt ... ng-Started

And they didn't work for me. This on OS X 10.11.6 with libffi installed via brew.

To get a working build I used the following steps:

git clone --recurse-submodules https://github.com/micropython/micropython.git
cd micropython/unix
export PKG_CONFIG_PATH=/usr/local/opt/libffi/lib/pkgconfig
make libffi axtls
make MICROPY_PY_BTREE=0

So I have 3 questions :

Is it expected that you have to turn off the berkley db off to get a successful compile?
Is it expected that you have to make libffi and axtls first ?
Should I update https://github.com/micropython/micropyt ... ng-Started with these extra steps ?

Thanks!

User avatar
mcauser
Posts: 507
Joined: Mon Jun 15, 2015 8:03 am

Re: Issues compiling on OSX

Post by mcauser » Fri Oct 14, 2016 1:04 am

On El Capitan this works for me:

Code: Select all

brew install libffi
brew install pkgconfig
brew install python3

cd micropython/unix
unset CFLAGS
make clean
PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig" LDFLAGS="-L/usr/local/opt/libffi/lib" make axtls
PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig" LDFLAGS="-L/usr/local/opt/libffi/lib" make

Code: Select all

Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.
MISC Preparing upip as frozen module
../tools/make-frozen.py build/frozen_upip/ > build/_frozen_upip.c

...

LINK micropython
__TEXT	__DATA	__OBJC	others	dec	hex
335872	49152	0	4294997728	4295382752	1000656e0

Code: Select all

./micropython
MicroPython v1.8.3-136-ga50b26e-dirty on 2016-10-14; darwin version
Use Ctrl-D to exit, Ctrl-E for paste mode
>>> 1/3
0.3333333333333333
>>>

Code: Select all

PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig" LDFLAGS="-L/usr/local/opt/libffi/lib" make test
Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.
cd ../tests && MICROPY_MICROPYTHON=../unix/micropython ./run-tests
pass  basics/0prelim.py
...
pass  unix/ffi_float2.py
527 tests performed (17288 individual testcases)
527 tests passed
7 tests skipped: cmd_showbc cmd_verbose framebuf1 urandom_extra vfs_fat_ramdisk buffered_writer extra_coverage
I am not sure about the CFLAGS bit. All of my ports fail to compile unless I unset it.

Code: Select all

echo $CFLAGS
-I/usr/local/include

Post Reply