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

Error building ARCH=arm #186

Closed
taoeffect opened this issue Sep 20, 2022 · 8 comments
Closed

Error building ARCH=arm #186

taoeffect opened this issue Sep 20, 2022 · 8 comments

Comments

@taoeffect
Copy link

Tried on an M2: make USE_VULKAN=1 RENDERER_DEFAULT=vulkan USE_RENDERER_DLOPEN=0 ARCH=arm -j 8 and got:

code/qcommon/vm_armv7l.c:3202:2: error: implicit declaration of function '__clear_cache' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        __clear_cache( vm->codeBase.ptr, vm->codeBase.ptr + vm->codeLength );
        ^
@ensiform
Copy link
Contributor

ensiform commented Sep 20, 2022

Apple arm platforms like the M2 is aarch64, not "arm". Pretty sure you don't have to pass arch on apple if you're building native only.

@taoeffect
Copy link
Author

Oh, I checked the Makefile and it used both so I just picked one:

ifeq ($(ARCH),arm)
  HAVE_VM_COMPILED = true
endif
ifeq ($(ARCH),aarch64)
  HAVE_VM_COMPILED = true
endif

I get a similar error:

code/qcommon/vm_aarch64.c:3481:2: error: implicit declaration of function '__clear_cache' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        __clear_cache( vm->codeBase.ptr, vm->codeBase.ptr + vm->codeLength );
        ^
1 error generated.

@taoeffect
Copy link
Author

Pretty sure you don't have to pass arch on apple if you're building native only.

Oops, missed this comment. By default it builds x86_64:

$ lipo -info quake3e
Non-fat file: quake3e is architecture: x86_64

@ensiform
Copy link
Contributor

ensiform commented Sep 21, 2022

Pretty sure you don't have to pass arch on apple if you're building native only.

Oops, missed this comment. By default it builds x86_64:

$ lipo -info quake3e
Non-fat file: quake3e is architecture: x86_64

Sounds like your terminal or build process is being run through rosetta then.

In terms of the error still presenting in vm_aarch64.c, there still could be a bug there with regards to the function availability. But its probably not actually present due to trying to be as x86_64?

@taoeffect
Copy link
Author

Sounds like your terminal or build process is being run through rosetta then.

Hmm, I don't think it is, but if you know of another way I can check let me know:

$ lipo -info $(which zsh)
Architectures in the fat file: /bin/zsh are: x86_64 arm64e

But its probably not actually present due to trying to be as x86_64?

I'm not sure I understand what you're saying here. FYI it does build an x86_64 binary without error.

@ec-
Copy link
Owner

ec- commented Sep 21, 2022

Check uname -a output - most likely you're running compilation through x86_64-emulation environment

@taoeffect
Copy link
Author

Wow, @ec- You're right!

Darwin Macintosh.local 21.6.0 Darwin Kernel Version 21.6.0: Mon Aug 22 20:20:07 PDT 2022; root:xnu-8020.140.49~2/RELEASE_ARM64_T8110 x86_64

I have no idea why this is happening! It must be my Terminal / ZSH setup.... if you have any ideas what might be causing this I'd be very curious to know because it's causing problems with other projects too..

@taoeffect
Copy link
Author

taoeffect commented Sep 21, 2022

I figured it out!

Transitioning Homebrew from an Intel machine to Apple Silicon resulted me with an x86 version of zsh.

So to fix this I had to uninstall Homebrew and re-install it. Thanks for your help! It now builds the binary as arm64, although I can't run it, will open a separate issue for that.

EDIT: there's an existing issue: #183

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

3 participants