wont build on mac os with M1 processor
Opened this issue · 7 comments
steps:
./premake5 gmake //or gmake2
cd build
make config=release
../src/charset.cpp:35:8: error: use of undeclared identifier 'RWDEVICE' static RWDEVICE::Im2DVertex *vertices; ^ ../src/charset.cpp:47:20: error: use of undeclared identifier 'RWDEVICE' vertices = rwNewT(RWDEVICE::Im2DVertex, NUMCHARS*4, MEMDUR_EVENT); ^ ../src/charset.cpp:47:13: error: expected expression vertices = rwNewT(RWDEVICE::Im2DVertex, NUMCHARS*4, MEMDUR_EVENT); ^ ../src/rwengine.h:217:28: note: expanded from macro 'rwNewT' #define rwNewT(t, s, h) (t*)rw::mustmalloc_LOC((s)*sizeof(t),h,RWHERE) ^ ../src/charset.cpp:145:2: error: use of undeclared identifier 'RWDEVICE' RWDEVICE::Im2DVertex *vert; ^
release
as a config is a bit underspecified. use make help
to see what's available, but i assume apple arm is 64 bit and for some reason i don't have a config for that yet. should add it.
i managed to build it in the end, but was a bit of a hassle - i had to change a lot of the #include statements to recursively go back to see certain libraries.
i believe M1 mac have their Homebrew packages installed in a different place (/opt/homebrew), that is not read by the code, which thinks they are in the normal PATH (/usr/local/bin)
i managed to build it in the end, but was a bit of a hassle - i had to change a lot of the #include statements to recursively go back to see certain libraries.
i believe M1 mac have their Homebrew packages installed in a different place (/opt/homebrew), that is not read by the code, which thinks they are in the normal PATH (/usr/local/bin)
Yes, this is indeed what you need to do. When building "another project" that uses this I used nano to quickly replace the references to the x86_64 libraries with references to the ARM64 ones.
You can see this in action if you get the dependencies in both architectures as it'll build but fail to link (until you update the link).
You should only have to update the .make file though (change a flag to point to your ARM64 include and libs.)
@SubstituteR could you specify which flag you mean? Im looking at the .make files and dont see any reference to architectures. I dont have any experience with building c++ projects.
@halpz Can you tell us more on how you did to make it work ?
I'm trying to fix reVC crash on macos & freebsd. halpz/re3#23
As I tried to build reVC from your repo (re3) but I have errors with the librw library : halpz/re3#26
Undefined symbols for architecture x86_64 in this file : '../vendor/librw/lib/macosx-amd64-librw_gl3_glfw-oal/Debug/librw.a'
I wanted to build librw by myself to see if there are diffs but now I have the same error as you about 'RWDEVICE' while trying to build librw alone.
Im on Intel macOS 12.7
Still no idea about macos, but if you have undefined symbols it might be because librw changed a bit since the last public version of re3. maybe try to back to late august 2021 or so.
@aap Thanks for your reply.
I didn't mentioned it but I also tried to compile an old commit of this repo around 2021 and got the same error while trying to build it.
Finally, with the makefiles of re3 repo, I've been able to build librw but it's still not building the librw alone.
All steps I did :
git clone https://github.com/aap/librw.git
premake5 --os=macosx gmake2
cd buid
make
And the result is:
==== Building librw (release) ====
charset.cpp
../src/charset.cpp:35:8: error: use of undeclared identifier 'RWDEVICE'
static RWDEVICE::Im2DVertex *vertices;
^
../src/charset.cpp:47:20: error: use of undeclared identifier 'RWDEVICE'
vertices = rwNewT(RWDEVICE::Im2DVertex, NUMCHARS*4, MEMDUR_EVENT);
^
../src/charset.cpp:47:13: error: expected expression
vertices = rwNewT(RWDEVICE::Im2DVertex, NUMCHARS*4, MEMDUR_EVENT);
^
../src/rwengine.h:229:28: note: expanded from macro 'rwNewT'
#define rwNewT(t, s, h) (t*)rw::mustmalloc_LOC((s)*sizeof(t),h,RWHERE)
^
../src/charset.cpp:153:2: error: use of undeclared identifier 'RWDEVICE'
RWDEVICE::Im2DVertex *vert;
^
4 errors generated.
make[1]: *** [obj/Release/librw/charset.o] Error 1
make: *** [librw] Error 2
Tested with debug and release config, but no changes.