nigels-com / glew

The OpenGL Extension Wrangler Library
Other
2.58k stars 608 forks source link

arm64 on mac #397

Closed CyberMike44 closed 8 months ago

CyberMike44 commented 8 months ago

ld: warning: ignoring file /usr/local/Cellar/glew/2.2.0_1/lib/libGLEW.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64

how to fix? I need it asap. thanks

nigels-com commented 8 months ago

glew-cmake is worth a try.

CyberMike44 commented 8 months ago

also broken... ^ fatal error: too many errors emitted, stopping now [-ferror-limit=] 20 errors generated. make: *** [tmp/darwin-universal/default/shared/glew.o] Error 1

am I doing something wrong?

nigels-com commented 8 months ago

I've been angling at work for a shiny new MacBook Pro. But no joy yet.

CyberMike44 commented 8 months ago

I need to compile for arm64 on an old intel Mac. I've seen some changes for removing i386 but never used git. Could you give me some command lines for fetching a working 2.3? and how to compile. many thanks

nigels-com commented 8 months ago

I'll give it a try on my Intel Mac. I'm not sure if my OS version and/or XCode is sufficient, but I'll give it a try.

CyberMike44 commented 8 months ago

looking forward to. xcode 12.2 i believe is needed. my macbook is from 2010... thanks

Am Mo., 16. Okt. 2023 um 09:55 Uhr schrieb Nigel Stewart < @.***>:

I'll give it a try on my Intel Mac. I'm not sure if my OS version and/or XCode is sufficient, but I'll give it a try.

— Reply to this email directly, view it on GitHub https://github.com/nigels-com/glew/issues/397#issuecomment-1763929036, or unsubscribe https://github.com/notifications/unsubscribe-auth/BDJACR7UULDILWBHQQNK6JLX7TSAHAVCNFSM6AAAAAA6A5UQJCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONRTHEZDSMBTGY . You are receiving this because you authored the thread.Message ID: @.***>

nigels-com commented 8 months ago

This worked for me on Intel macOS 12.7 I did need to update both XCode and the Command Line Compiler Tools v14.2.

$ make clean all SYSTEM=darwin-arm64

See also: PR #398

CyberMike44 commented 8 months ago

Michaels-MacBook-Pro:Downloads michael$ cd glew Michaels-MacBook-Pro:glew michael$ ls LICENSE.txt build glew.pc.in Makefile cmake-testbuild.sh src README.md config auto doc Michaels-MacBook-Pro:glew michael$ make clean all SYSTEM=darwin-arm64 Makefile:40: *** "Platform 'darwin-arm64' not supported". Stop. Michaels-MacBook-Pro:glew michael$ pwd /Users/michael/Downloads/glew Michaels-MacBook-Pro:glew michael$ git pull Already up to date. Michaels-MacBook-Pro:glew michael$

I've never used git. How to get this? Many thanks

nigels-com commented 8 months ago

An alternative:

$ make clean all SYSTEM=darwin-universal
nigels-com commented 8 months ago

Alternative: glew-2.2.0-macos-arm.tar.gz

CyberMike44 commented 8 months ago

Michaels-MacBook-Pro:Downloads michael$ cd gl2 Michaels-MacBook-Pro:glew-2.2.0 michael$ make clean all SYSTEM=darwin-universal rm -f -r tmp/ rm -f -r lib/ rm -f -r bin/ rm -f glew.pc mkdir lib cc -DGLEW_NO_GLU -DGLEW_BUILD -Os -Wall -W -Iinclude -dynamic -fno-common -pedantic -fPIC -arch x86_64 -arch arm64 -std=c89 -o tmp/darwin-universal/default/shared/glew.o -c src/glew.c In file included from src/glew.c:34: In file included from include/GL/glew.h:224: In file included from /Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/stdint.h:52: In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/stdint.h:52: In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/_types.h:32: /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/cdefs.h:807:2: error: Unsupported architecture

error Unsupported architecture

^ In file included from src/glew.c:34: In file included from include/GL/glew.h:224: In file included from /Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/stdint.h:52: In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/stdint.h:52: In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/_types.h:33: /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/machine/_types.h:34:2: error: architecture not supported

error architecture not supported

^ In file included from src/glew.c:34: In file included from include/GL/glew.h:224: In file included from /Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/stdint.h:52: In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/stdint.h:52: /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/_types.h:55:9: error: unknown type name 'int64_t' typedef __int64_t darwin_blkcnt_t; / total blocks / ^ /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/_types.h:56:9: error: unknown type name 'int32_t' typedef __int32_t darwin_blksize_t; / preferred block size / ^ /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/_types.h:57:9: error: unknown type name 'int32_t' typedef __int32_t darwin_dev_t; / dev_t / ^ /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/_types.h:60:9: error: unknown type name 'uint32_t' typedef __uint32_t darwin_gid_t; / [???] process and gro... ^ /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/_types.h:61:9: error: unknown type name 'uint32_t' typedef __uint32_t darwin_id_t; / [XSI] pid_t, uid_t, o... ^ /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/_types.h:62:9: error: unknown type name 'uint64_t'; did you mean 'uint64_t'? typedef uint64_t darwin_ino64_t; /* [???] Used for 64 bi... ^ /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/_types/_uint64_t.h:31:28: note: 'uint64_t' declared here typedef unsigned long long uint64_t; ^ In file included from src/glew.c:34: In file included from include/GL/glew.h:224: In file included from /Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/stdint.h:52: In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/stdint.h:52: /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/_types.h:68:9: error: unknown type name 'darwin_natural_t' typedef darwin_natural_t darwin_mach_port_name_t; / Used by mach / ^ /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/_types.h:70:9: error: unknown type name 'uint16_t' typedef __uint16_t darwin_mode_t; / [???] Some file attributes / ^ /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/_types.h:71:9: error: unknown type name 'int64_t' typedef __int64_t darwin_off_t; / [???] Used for file sizes / ^ /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/_types.h:72:9: error: unknown type name 'int32_t' typedef __int32_t darwin_pid_t; / [???] process and gro... ^ /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/_types.h:73:9: error: unknown type name 'uint32_t' typedef __uint32_t darwin_sigset_t; / [???] signal set / ^ /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/_types.h:74:9: error: unknown type name 'int32_t' typedef __int32_t darwin_suseconds_t; / [???] microseconds / ^ /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/_types.h:75:9: error: unknown type name 'uint32_t' typedef __uint32_t darwin_uid_t; / [???] user IDs / ^ /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/_types.h:76:9: error: unknown type name 'uint32_t' typedef __uint32_t darwin_useconds_t; / [???] microseconds */ ^ In file included from src/glew.c:34: In file included from include/GL/glew.h:224: In file included from /Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/stdint.h:52: In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/stdint.h:53: In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/_types/_intptr_t.h:30: /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/machine/types.h:37:2: error: architecture not supported

error architecture not supported

^ In file included from src/glew.c:34: In file included from include/GL/glew.h:224: In file included from /Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/stdint.h:52: In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/stdint.h:53: /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/_types/_intptr_t.h:32:9: error: unknown type name 'darwin_intptr_t' typedef darwin_intptr_t intptr_t; ^ In file included from src/glew.c:101: In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/stdlib.h:64: /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/_types.h:43:9: error: unknown type name 'uint32_t' typedef __uint32_t darwin_wctype_t; ^ fatal error: too many errors emitted, stopping now [-ferror-limit=] 20 errors generated. make: *** [tmp/darwin-universal/default/shared/glew.o] Error 1 Michaels-MacBook-Pro:glew-2.2.0 michael$

CyberMike44 commented 8 months ago

Michaels-MacBook-Pro:glew-2.2.0 michael$ softwareupdate --list Software Update Tool

Finding available software No new software available. Michaels-MacBook-Pro:glew-2.2.0 michael$

I have 10.15.7

nigels-com commented 8 months ago

You're probably not going to be able to target arm64 without newer Command Line Compiler Tools. You might have trouble upgrading those without upgrading MacOS. Your machine sounds too old to be supported for that. So it looks like you're out of luck.

CyberMike44 commented 8 months ago

Could you try with 12.2 as I can compile for arm64. Rename the devTools to for ex. devtoolOLD so you could easily switch back. Many thanks

nigels-com commented 8 months ago

In the file config/Makefile.darwin-arm64 could you try changing (both of) -arch arm64 to -target arm64-apple-macos11? That's mentioned here, I don't remember the merits of -arch vs -target. https://developer.apple.com/documentation/apple-silicon/building-a-universal-macos-binary

Could be that your toolchain needs a newer SDK than the default there for Intel.

CyberMike44 commented 8 months ago

Many thanks it compiled.

CyberMike44 commented 8 months ago

But still: ld: warning: ignoring file /Users/michael/Downloads/glew-2.2.0/lib/libGLEW.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64

CyberMike44 commented 8 months ago

Michaels-MacBook-Pro:SDKs michael$ sudo mv MacOSX10.15.sdk MacOSX10.15.sdkold Password: Michaels-MacBook-Pro:SDKs michael$ ls -la total 0 drwxr-xr-x 5 root wheel 160 23 Okt 11:32 . drwxr-xr-x 5 root wheel 160 22 Okt 08:54 .. lrwxr-xr-x 1 root wheel 14 22 Okt 08:55 MacOSX.sdk -> MacOSX11.1.sdk drwxr-xr-x 8 root wheel 256 9 Jul 2020 MacOSX10.15.sdkold drwxr-xr-x 7 root wheel 224 30 Nov 2020 MacOSX11.1.sdk Michaels-MacBook-Pro:SDKs michael$

Michaels-MacBook-Pro:lib michael$ lipo -archs libGLEW.a x86_64 arm64

for some reasons I still had 10.15... MANY THANKS I'll close it now.