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

install failed on MacOS with ARM64 #3296

Closed
dbkernel opened this issue Jan 16, 2023 · 13 comments
Closed

install failed on MacOS with ARM64 #3296

dbkernel opened this issue Jan 16, 2023 · 13 comments
Labels
Milestone

Comments

@dbkernel
Copy link

Xmake Version

2.7.5

Operating System Version and Architecture

macOS Monterey

Describe Bug

install by bash <(curl -fsSL https://xmake.io/shget.text) failed

error log:

xmake, A cross-platform build utility based on Lua.   
Copyright (C) 2015-present Ruki Wang, tboox.org, xmake.io
                         _                            
    __  ___ __  __  __ _| | ______                    
    \ \/ / |  \/  |/ _  | |/ / __ \                   
     >  <  | \__/ | /_| |   <  ___/                   
    /_/\_\_|_|  |_|\__ \|_|\_\____|                   
                         by ruki, xmake.io            
                                                      
   👉  Manual: https://xmake.io/#/getting_started     
   🙏  Donate: https://xmake.io/#/sponsor             
                                                      
downloading https://fastly.jsdelivr.net/gh/xmake-mirror/xmake-releases@v2.7.5/xmake-v2.7.5.xz.run ..
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1800k  100 1800k    0     0  12966      0  0:02:22  0:02:22 --:--:-- 14867
Creating directory /var/folders/n8/f9rj26xj4k14xw8q0ndxdt9h0000gn/T//.xmake_getter15408
Verifying archive integrity...  100%    100%   All good.
Uncompressing xmake-v2.7.5-runfile  100%  
checking for platform ... macosx
checking for architecture ... arm64
checking for make ... ok
checking for the c compiler (cc) ... clang
checking for the c++ compiler (cxx) ... clang
checking for the assembler (as) ... clang
checking for the objc compiler (mm) ... clang
checking for the objc++ compiler (mxx) ... clang
checking for the linker (ld) ... clang++
checking for the static library archiver (ar) ... ar
checking for the shared library linker (sh) ... clang++
checking for toolchain ... clang
checking for readline .. ok
checking for curses .. ok
checking for atomic .. no
checking for lua_cjson .. no
checking for lua .. ok
checking for luajit .. no
checking for lz4 .. ok
checking for sv .. no
checking for tbox .. no
checking for wchar .. no
analyzing project configuration ..
generating build/macosx/arm64/release/xmake.config.h ..
build/macosx/arm64/release/xmake.config.h is generated!
generating makefile ..
makefile is generated!

/dev/fd/63: line 227: nproc: command not found
compiling.release core/src/lua-cjson/lua-cjson/dtoa.c
......
compiling.release core/src/tbox/tbox/src/tbox/platform/mutex.c
compiling.release core/src/tbox/tbox/src/tbox/platform/native_memory.c
In file included from core/src/tbox/tbox/src/tbox/platform/file.c:39:
core/src/tbox/tbox/src/tbox/platform/posix/file.c:202:14: warning: 'lstat64' is deprecated: first deprecated in macOS 10.6 [-Wdeprecated-declarations]
        if (!lstat64(path, &st))
             ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/sys/stat.h:428:9: note: 'lstat64' has been explicitly marked deprecated here
int     lstat64(const char *, struct stat64 *) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_6, __IPHONE_NA, __IPHONE_NA);
        ^
In file included from core/src/tbox/tbox/src/tbox/platform/file.c:39:
core/src/tbox/tbox/src/tbox/platform/posix/file.c:219:22: warning: 'stat64' is deprecated: first deprecated in macOS 10.6 [-Wdeprecated-declarations]
                if (!stat64(path, &st))
                     ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/sys/stat.h:429:9: note: 'stat64' has been explicitly marked deprecated here
int     stat64(const char *, struct stat64 *) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_6, __IPHONE_NA, __IPHONE_NA);
        ^
compiling.release core/src/tbox/tbox/src/tbox/platform/page.c
......
compiling.release core/src/xmake/os/rename.c
core/src/xmake/lz4/block_decompress.c:71:22: warning: 'LZ4_decompress_fast' is deprecated: This function is deprecated and unsafe. Consider using LZ4_decompress_safe() instead [-Wdeprecated-declarations]
        tb_int_t r = LZ4_decompress_fast((tb_char_t const*)data, (tb_char_t*)output_data, real);
                     ^
/usr/local/Cellar/lz4/1.9.3/include/lz4.h:753:1: note: 'LZ4_decompress_fast' has been explicitly marked deprecated here
LZ4_DEPRECATED("This function is deprecated and unsafe. Consider using LZ4_decompress_safe() instead")
^
/usr/local/Cellar/lz4/1.9.3/include/lz4.h:687:52: note: expanded from macro 'LZ4_DEPRECATED'
#    define LZ4_DEPRECATED(message) __attribute__((deprecated(message)))
                                                   ^
1 warning generated.
compiling.release core/src/xmake/os/isfile.c
......
compiling.release core/src/demo/xmake.c
linking.release build/macosx/arm64/release/liblua_cjson.a
linking.release build/macosx/arm64/release/libsv.a
linking.release build/macosx/arm64/release/libtbox.a
linking.release build/macosx/arm64/release/libxmake.a
linking.release build/xmake
ld: warning: ignoring file build/macosx/arm64/release/libtbox.a, building for macOS-x86_64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file build/macosx/arm64/release/libxmake.a, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: archive has no table of contents file 'build/macosx/arm64/release/liblua_cjson.a' for architecture x86_64
clang-13: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [build/xmake] Error 1
make failed!

Expected Behavior

Expected installation success

Project Configuration

No response

Additional Information and Error Logs

No response

@dbkernel dbkernel added the bug label Jan 16, 2023
@waruqi
Copy link
Member

waruqi commented Jan 16, 2023

try dev branch

bash <(curl -fsSL https://xmake.io/shget.text) dev

@dbkernel
Copy link
Author

I tried, it has same error for me

compiling.release core/src/tbox/tbox/src/tbox/platform/file.c
In file included from core/src/tbox/tbox/src/tbox/platform/file.c:39:
core/src/tbox/tbox/src/tbox/platform/posix/file.c:202:14: warning: 'lstat64' is deprecated: first deprecated in macOS 10.6 [-Wdeprecated-declarations]
        if (!lstat64(path, &st))
             ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/sys/stat.h:428:9: note: 'lstat64' has been explicitly marked deprecated here
int     lstat64(const char *, struct stat64 *) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_6, __IPHONE_NA, __IPHONE_NA);
        ^
In file included from core/src/tbox/tbox/src/tbox/platform/file.c:39:
core/src/tbox/tbox/src/tbox/platform/posix/file.c:219:22: warning: 'stat64' is deprecated: first deprecated in macOS 10.6 [-Wdeprecated-declarations]
                if (!stat64(path, &st))
                     ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/sys/stat.h:429:9: note: 'stat64' has been explicitly marked deprecated here
int     stat64(const char *, struct stat64 *) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_6, __IPHONE_NA, __IPHONE_NA);
        ^
2 warnings generated.
compiling.release core/src/tbox/tbox/src/tbox/platform/filelock.c
......
compiling.release core/src/xmake/lz4/block_decompress.c
core/src/xmake/lz4/block_decompress.c:71:22: warning: 'LZ4_decompress_fast' is deprecated: This function is deprecated and unsafe. Consider using LZ4_decompress_safe() instead [-Wdeprecated-declarations]
        tb_int_t r = LZ4_decompress_fast((tb_char_t const*)data, (tb_char_t*)output_data, real);
                     ^
/usr/local/Cellar/lz4/1.9.3/include/lz4.h:753:1: note: 'LZ4_decompress_fast' has been explicitly marked deprecated here
LZ4_DEPRECATED("This function is deprecated and unsafe. Consider using LZ4_decompress_safe() instead")
^
/usr/local/Cellar/lz4/1.9.3/include/lz4.h:687:52: note: expanded from macro 'LZ4_DEPRECATED'
#    define LZ4_DEPRECATED(message) __attribute__((deprecated(message)))
                                                   ^
1 warning generated.
compiling.release core/src/xmake/lz4/compress_stream_read.c
compiling.release core/src/xmake/lz4/compress_file.c
......
linking.release build/macosx/arm64/release/libxmake.a
compiling.release core/src/demo/xmake.c
linking.release build/xmake
ld: warning: ignoring file build/macosx/arm64/release/libtbox.a, building for macOS-x86_64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file build/macosx/arm64/release/libxmake.a, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: archive has no table of contents file 'build/macosx/arm64/release/libsv.a' for architecture x86_64
clang-13: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [build/xmake] Error 1
make failed!

@waruqi
Copy link
Member

waruqi commented Jan 19, 2023

can you try the following command and give me verbose logs.

git clone --recursive https://github.com/xmake-io/xmake.git
cd ./xmake
./configure --verbose --diagnosis
make VERBOSE=1

@FabianTerhorst
Copy link

I have the same issue with a m1 pro.
I get the following error with make VERBOSE=1

linking.release build/xmake
clang++ -o build/xmake  build/.objs/demo/macosx/arm64/release/core/src/demo/xmake.c.o -Qunused-arguments  -Lbuild/macosx/arm64/release  -lxmake  -Lbuild/macosx/arm64/release  -llua_cjson  -Lbuild/macosx/arm64/release  -llz4  -Lbuild/macosx/arm64/release  -lsv  -Lbuild/macosx/arm64/release  -ltbox  -Lbuild/macosx/arm64/release  -llua  -Wl,-x -Wl,-dead_strip  -lreadline  -framework CoreFoundation -framework CoreServices  -lpthread -ldl -lm -lc -flto -L/opt/local/lib -Wl,-search_paths_first -lncurses
ld: archive has no table of contents file 'build/macosx/arm64/release/libxmake.a'
clang-15: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [build/xmake] Error 1

@waruqi
Copy link
Member

waruqi commented Feb 5, 2023

I have the same issue with a m1 pro. I get the following error with make VERBOSE=1

linking.release build/xmake
clang++ -o build/xmake  build/.objs/demo/macosx/arm64/release/core/src/demo/xmake.c.o -Qunused-arguments  -Lbuild/macosx/arm64/release  -lxmake  -Lbuild/macosx/arm64/release  -llua_cjson  -Lbuild/macosx/arm64/release  -llz4  -Lbuild/macosx/arm64/release  -lsv  -Lbuild/macosx/arm64/release  -ltbox  -Lbuild/macosx/arm64/release  -llua  -Wl,-x -Wl,-dead_strip  -lreadline  -framework CoreFoundation -framework CoreServices  -lpthread -ldl -lm -lc -flto -L/opt/local/lib -Wl,-search_paths_first -lncurses
ld: archive has no table of contents file 'build/macosx/arm64/release/libxmake.a'
clang-15: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [build/xmake] Error 1

I need full logs

./configure --verbose --diagnosis
make VERBOSE=1

@FabianTerhorst
Copy link

@waruqi
Copy link
Member

waruqi commented Feb 5, 2023

https://gist.github.com/FabianTerhorst/06975e41cc86638b95076121e3ce15f9

Can you disable LTO and try it again?

xmake/core/xmake.sh

Lines 28 to 31 in 0847395

if is_plat "macosx"; then
add_cxflags "-flto"
add_mxflags "-flto"
add_ldflags "-flto"

then you need run ./configure to re-generate makefile.

@FabianTerhorst
Copy link

thanks alot, make worked and i got a xmake binary now.

@FabianTerhorst
Copy link

It looks like make didn't returned any errors and generated a binary, but the binary is not doing anything and is just 500kb.

@FabianTerhorst
Copy link

@waruqi
Copy link
Member

waruqi commented Feb 5, 2023

It looks like make didn't returned any errors and generated a binary, but the binary is not doing anything and is just 500kb.

right, xmake binary is small, it is just 500kb.

you need run

./scripts/get.sh __local__ __install_only__
source ~/.xmake/profile

to install binary and all lua scripts, then it will work.

@FabianTerhorst
Copy link

thanks, it works now. I was able to build a project with it.

@waruqi waruqi closed this as completed Feb 5, 2023
@waruqi waruqi added this to the v2.7.7 milestone Feb 5, 2023
waruqi added a commit that referenced this issue Feb 5, 2023
@waruqi
Copy link
Member

waruqi commented Feb 5, 2023

I have fixed it on dev.

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

No branches or pull requests

3 participants