Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ziglang build broken on macOS #3575

Open
tomsci opened this issue Apr 22, 2023 · 0 comments
Open

ziglang build broken on macOS #3575

tomsci opened this issue Apr 22, 2023 · 0 comments

Comments

@tomsci
Copy link

tomsci commented Apr 22, 2023

Trying to build dev-esp32 branch @ 32d03a2 on macOS 13.3.1 on Apple Silicon appears to be hitting a bug in ziglang while compiling luac.cross (output trimmed to only include relevant stuff):

$ make
/nodemcu-firmware/sdk/esp32-esp-idf/tools/idf.py  "all"
Executing action: all (aliases: build)
Running make in directory /nodemcu-firmware/build
Executing "make -j 12 all"...
-- Building ESP-IDF components for target esp32
-- Project sdkconfig file /nodemcu-firmware/sdkconfig
Loading defaults file /nodemcu-firmware/sdkconfig.defaults...
-- App "nodemcu" version: 1.4.0-master_20151229-880-g4e9b
[  1%] Performing build step for 'luac_cross_build'
[hostcc] luac.o
<snip>
[hostcc] lundump.o
MachO Flush... [hostcc] lutf8lib.o
[hostcc] lvm.o
MachO Flush... [hostcc] lzio.o
[hostcc] linit.o
[hostcc] lpanic.o
MachO Flush... MachO Flush... [hostcc] uzlib_deflate.o
[hostcc] crc32.o
[ link] luac.cross
MachO Flush... error(link): undefined reference to symbol 'dyld_stub_binder'
error: UndefinedSymbolReference
make[4]: *** [/nodemcu-firmware/build/luac_cross/luac.cross] Error 1
make[3]: *** [luac_cross/src/luac_cross_build-stamp/luac_cross_build-build] Error 2
make[2]: *** [esp-idf/lua/CMakeFiles/luac_cross_build.dir/all] Error 2
make[2]: *** Waiting for unfinished jobs....

This appears to be the same issue as ziglang/zig#11896 which has been open for a while and maaaaybe will be fixed in the next version 0.11 (it's on their milestones but not yet fixed, so who knows if it gets pushed out or not).

Looking at how zig is used here, it seems to be a wrapper around clang? At least for me, this patch to just not use it at all fixed the issue:

diff --git a/components/lua/lua-5.3/host/idf.mk b/components/lua/lua-5.3/host/idf.mk
index 8dfba397..b1ccfe94 100644
--- a/components/lua/lua-5.3/host/idf.mk
+++ b/components/lua/lua-5.3/host/idf.mk
@@ -1,6 +1,6 @@
 all: build
 
-HOSTCC?=$(PYTHON) -m ziglang cc
+HOSTCC?=cc
 
 ifeq ($V,)
   Q:=@

I found this comment referencing zig #1661 (comment) so I guess it's here for the cases where you don't have a host C compiler? Maybe we can make it configurable for the cases where hostcc is available and works, but zig doesn't? Just a thought, for now I've just added the above patch to my branch, but I figured I should raise this if only for other people hitting the same issue to search for!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant