Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wont build on mac os with M1 processor #58

Open
halpz opened this issue Feb 17, 2021 · 7 comments
Open

wont build on mac os with M1 processor #58

halpz opened this issue Feb 17, 2021 · 7 comments

Comments

@halpz
Copy link

halpz commented Feb 17, 2021

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; ^

@aap
Copy link
Owner

aap commented Feb 17, 2021

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.

@halpz
Copy link
Author

halpz commented Feb 17, 2021

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)

@SubstituteR
Copy link

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

@jakubHynek
Copy link

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

@joyel24
Copy link

joyel24 commented May 29, 2024

@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

@aap
Copy link
Owner

aap commented May 29, 2024

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.

@joyel24
Copy link

joyel24 commented May 30, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants