I’m running into a problem which is also explained here: Building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format · Issue #11 · platformio/platform-native · GitHub
Essentially, it looks like I’m unable to build for my “native” platform (macOS 11.2.3 Big Sur), because the generated .pio/build/native/libUnityTestLib.a is not compatible:
% pio test
Verbose mode can be enabled via `-v, --verbose` option
Collected 1 items
Processing test_desktop in native environment
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Building...
(...)
Building in release mode
g++ -o .pio/build/native/test/test_desktop/test_main.o -c -DPLATFORMIO=50101 -DUNIT_TEST -DUNITY_INCLUDE_CONFIG_H -Iinclude -Isrc -I.pio/build/native/UnityTestLib -I/Users/mh/.platformio/packages/tool-unity test/test_desktop/test_main.cpp
gcc -o .pio/build/native/test/tmp_pio_test_transport.o -c -DPLATFORMIO=50101 -DUNIT_TEST -DUNITY_INCLUDE_CONFIG_H -Iinclude -Isrc -I.pio/build/native/UnityTestLib -I/Users/mh/.platformio/packages/tool-unity test/tmp_pio_test_transport.c
gcc -o .pio/build/native/UnityTestLib/unity.o -c -DPLATFORMIO=50101 -DUNIT_TEST -DUNITY_INCLUDE_CONFIG_H -I.pio/build/native/UnityTestLib -I/Users/mh/.platformio/packages/tool-unity /Users/mh/.platformio/packages/tool-unity/unity.c
ar rc .pio/build/native/libUnityTestLib.a .pio/build/native/UnityTestLib/unity.o
BFD: .pio/build/native/UnityTestLib/unity.o: unknown load command 0x32
BFD: .pio/build/native/UnityTestLib/unity.o: unknown load command 0x32
ranlib .pio/build/native/libUnityTestLib.a
BFD: .pio/build/native/libUnityTestLib.a(unity.o): unknown load command 0x32
g++ -o .pio/build/native/program .pio/build/native/test/test_desktop/test_main.o .pio/build/native/test/tmp_pio_test_transport.o -L.pio/build/native .pio/build/native/libUnityTestLib.a
ld: warning: ignoring file .pio/build/native/libUnityTestLib.a, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x5F 0x5F 0x2E 0x53 0x59 0x4D 0x44 0x45 )
Undefined symbols for architecture x86_64:
"_UnityAssertEqualNumber", referenced from:
test_1() in test_main.o
"_UnityBegin", referenced from:
_main in test_main.o
"_UnityDefaultTestRun", referenced from:
_main in test_main.o
"_UnityEnd", referenced from:
_main in test_main.o
ld: symbol(s) not found for architecture x86_64
Any idea how I could build a working library?
Thanks
Michael