I have some trouble with creating a build system on a **Monterey M1 MacBook**:
So far I have a working Makefile to build and link a library.
(simplified: g++ -c
all .cpp files into .o files → ar -r <.o files> libmyLibrary.a
>
→ works great
THE PROBLEM:
When I try to build an executable binary that uses said libmyLibrary.a
. The compilation of source files works fine, but I get the following (seemingly nonsensical) linker warning:
ld: warning: ignoring file /Path/to/lib/libmyLibrary.a,
building for macOS-arm64 but attempting to link with file built for macOS-arm64
→ I ofc then get some Undefined symbols for architecture arm64: ... <stuff from library> referenced from: <stuff from executable>
How can building for the same target as the library be a problem?