librw icon indicating copy to clipboard operation
librw copied to clipboard

wont build on mac os with M1 processor

Open halpz opened this issue 4 years ago • 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; ^

halpz avatar Feb 17 '21 15:02 halpz

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.

aap avatar Feb 17 '21 17:02 aap

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)

halpz avatar Feb 17 '21 17:02 halpz

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 avatar Feb 23 '21 08:02 SubstituteR

@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.

jakubHynek avatar Feb 08 '24 23:02 jakubHynek