openpilot icon indicating copy to clipboard operation
openpilot copied to clipboard

macOS: can’t build after 15.4.1

Open greatgitsby opened this issue 7 months ago • 7 comments

https://github.com/commaai/openpilot/pull/35104 fixes the build. but, before modifying, need to understand why gcc-13 is needed here

thought process: fake_stm.h imports stdio.h -> uses Xcode's stdio -> needs clang to compile it correctly.


Describe the bug

tools/op.sh setup && tools/op.sh build

no longer builds. will attach stack trace. initial deep dive shows that switching to clang for failing file compilations works.

OS Version

macOS 15.4.1

openpilot version or commit

master

Additional info

GH actions run with runner macos-15: https://github.com/commaai/openpilot/actions/runs/14777702991/job/41489546036

one problematic file:

$ gcc-13 -o panda/tests/libpanda/panda.os -c -nostdlib -fno-builtin -std=gnu11 -Wfatal-errors -Wno-pointer-to-int-cast -fPIC -Ipanda/tests/libpanda -Ipanda/board -Iopendbc/safety panda/tests/libpanda/panda.c

In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/_stdio.h:71,
                 from /opt/homebrew/Cellar/gcc@13/13.3.0/lib/gcc/13/gcc/aarch64-apple-darwin24/13/include-fixed/stdio.h:75,
                 from panda/board/fake_stm.h:2,
                 from panda/tests/libpanda/panda.c:1:
/Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/_stdio.h: In function 'fmemopen':
/Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/_stdio.h:457:107: error: expected declaration specifiers before '__API_AVAILABLE_GET_MACRO_93585900'
  457 | FILE *fmemopen(void * __restrict __buf _LIBC_SIZE(__size), size_t __size, const char * __restrict __mode) __API_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(4.0));
      |                                                                                                           ^~~~~~~~~~~~~~~
compilation terminated due to -Wfatal-errors.

compiling with clang instead works:

$ clang -o panda/tests/libpanda/panda.os -c -nostdlib -fno-builtin -std=gnu11 -Wfatal-errors -Wno-pointer-to-int-cast -fPIC -Ipanda/tests/libpanda -Ipanda/board -Iopendbc/safety panda/tests/libpanda/panda.c

greatgitsby avatar May 01 '25 14:05 greatgitsby

This is the error i get:

scons: Reading SConscript files ... scons: done reading SConscript files. scons: Building targets ... gcc-13 -o opendbc_repo/opendbc/safety/tests/libsafety/safety.os -c -Wall -Wextra -Werror -nostdlib -fno-builtin -std=gnu11 -Wfatal-errors -Wno-pointer-to-int-cast -fPIC -Iopendbc_repo/opendbc/safety/tests/libsafety -Iopendbc_repo/opendbc/safety/board -Iopendbc_repo/opendbc/safety opendbc_repo/opendbc/safety/tests/libsafety/safety.c In file included from opendbc_repo/opendbc/safety/board/fake_stm.h:2, from opendbc_repo/opendbc/safety/tests/libsafety/safety.c:3: /opt/homebrew/Cellar/gcc@13/13.3.0/lib/gcc/13/gcc/aarch64-apple-darwin24/13/include-fixed/stdio.h:75:10: fatal error: _stdio.h: No such file or directory 75 | #include <_stdio.h> | ^~~~~~~~~~ compilation terminated. scons: *** [opendbc_repo/opendbc/safety/tests/libsafety/safety.os] Error 1 arm-none-eabi-objcopy -O binary panda/board/jungle/obj/bootstub.panda_jungle_h7.elf panda/board/jungle/obj/bootstub.panda_jungle_h7.bin scons: building terminated because of errors.

lara105 avatar May 01 '25 14:05 lara105

CI is on macos-latest for GH runners. no issue on this version. can be reproduced in CI if macos-15 runner is used. it is on 15.4.1.

https://github.com/actions/runner-images/blob/main/images/macos/macos-15-Readme.md

greatgitsby avatar May 01 '25 14:05 greatgitsby

@phoenixs3 your issue is separate, try uninstalling gcc@13 and gcc-arm-embedded, installing them again, and seeing if you see the stacktrace i attached in the description.

source: https://stackoverflow.com/a/35097817

greatgitsby avatar May 01 '25 15:05 greatgitsby

FYI https://discord.com/channels/469524606043160576/1362735424644055230

devtekve avatar May 02 '25 07:05 devtekve

Actually, it's 2 different issues. But they happened after 15.4. Models can't be compiled on tinygrad for me

devtekve avatar May 02 '25 07:05 devtekve

@phoenixs3 your issue is separate, try uninstalling gcc@13 and gcc-arm-embedded, installing them again, and seeing if you see the stacktrace i attached in the description.

source: https://stackoverflow.com/a/35097817

I tried re-installing them with no change in the stack trace - do you know what i am doing wrong?

lara105 avatar May 02 '25 09:05 lara105

working build: https://github.com/commaai/openpilot/pull/35104 -> https://github.com/commaai/openpilot/actions/runs/14798102212/job/41550115527

greatgitsby avatar May 02 '25 15:05 greatgitsby

still two PRs outstanding to fix this, can we reopen the issue? (probably was auto-closed)

https://github.com/commaai/opendbc/pull/2180 https://github.com/commaai/openpilot/pull/35104

greatgitsby avatar May 13 '25 18:05 greatgitsby