添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

I tried to build the unix port on macOS by following the directions at https://docs.micropython.org/en/latest/develop/gettingstarted.html#building-the-unix-port-of-micropython but I'm getting errors like this:

CC ../../lib/berkeley-db-1.xx/btree/bt_close.c
../../lib/berkeley-db-1.xx/btree/bt_close.c:63:1: error: a function declaration without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype]
__bt_close(dbp)
../../lib/berkeley-db-1.xx/btree/bt_close.c:116:1: error: a function declaration without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype]
__bt_sync(dbp, flags)
../../lib/berkeley-db-1.xx/btree/bt_close.c:159:1: error: a function declaration without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype]
bt_meta(t)
../../lib/berkeley-db-1.xx/btree/bt_close.c:159:1: error: a function declaration without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype]
4 errors generated.
-e See https://github.com/micropython/micropython/wiki/Build-Troubleshooting
make: *** [build-standard/lib/berkeley-db-1.xx/btree/bt_close.o] Error 1

It looks like it should be possible to build for macOS since I can brew install micropython. If someone has successfully built the unix port on macOS, could you walk me through the process?

Maybe homebrew compiles with an older version of gcc. (Edit: yes, see GCC 4.2.1 in the homebrew version's banner)

Either way, we probably need to add an exclusion for that warning -- we already have -Wno-old-style-definition in extmod/extmod.mk, sounds like we need to add -Wdeprecated-non-prototype. (Are you interested in sending a PR :) )

@robert-hh thanks for the suggestion. I'm able to build the unix port by setting MICROPY_PY_BTREE = 0 in mpconfigport.mk as you suggested.

However, on the homebrew version of micropython, it looks like they were able to build with the btree module enabled:

❯ micropython
MicroPython v1.20.0 on 2023-04-26; darwin [GCC 4.2.1] version
Use Ctrl-D to exit, Ctrl-E for paste mode
>>> import btree

Looking at https://github.com/Homebrew/homebrew-core/blob/master/Formula/micropython.rb it's not obvious to me what they did differently when building this for macOS. I'm just doing the following (not sure if I'm missing some other mac-specific step?):

❯ cd ports/unix
❯ make submodules
❯ make
        

Maybe homebrew compiles with an older version of gcc. (Edit: yes, see GCC 4.2.1 in the homebrew version's banner)

Either way, we probably need to add an exclusion for that warning -- we already have -Wno-old-style-definition in extmod/extmod.mk, sounds like we need to add -Wdeprecated-non-prototype. (Are you interested in sending a PR :) )