Skip to content
New issue

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

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

Already on GitHub? # to your account

Unable to Cross Compile for aarch64 on Linux #6204

Closed
Doekin opened this issue Mar 10, 2025 · 2 comments
Closed

Unable to Cross Compile for aarch64 on Linux #6204

Doekin opened this issue Mar 10, 2025 · 2 comments
Labels

Comments

@Doekin
Copy link
Contributor

Doekin commented Mar 10, 2025

Xmake Version

v2.9.8+20250204

Operating System Version and Architecture

Arch Linux

Describe Bug

Despite having aarch64-linux-gnu-gcc available, executing xmake f -c -vD -m release -a arm64-v8a still compiles for x86_64. Updating to the dev branch and running xmake f -c -vD -m release -a arm64 yields the same result.

Expected Behavior

The build should target aarch64 as specified.

Project Configuration

xmake f -c -vD -m release -a arm64-v8a
xmake -r -vD hello_c

Additional Information and Error Logs

xmake f -c -vD -m release -a arm64-v8a
checking for platform ... linux
checking for gcc ... /usr/bin/gcc
checkinfo: cannot runv(nim --version), No such file or directory
checking for nim ... no
checkinfo: cannot runv(nim --version), No such file or directory
checking for nim ... no
configure
{
    network = public
    mode = release
    plat = linux
    host = linux
    clean = true
    ccache = true
    theme = default
    arch = arm64-v8a
    ndk_stdcxx = true
    kind = static
    mingw = /usr/x86_64-w64-mingw32
    diagnosis = true
    buildir = build
}

$ xmake -r -vD hello_c
checking for gcc ... /usr/bin/gcc
checking for the c compiler (cc) ... gcc
checking for /usr/bin/gcc ... ok
checking for flags (-fPIC) ... ok
> gcc "-fPIC"
checking for flags (-O3) ... ok
> gcc "-O3"
checking for flags (-DNDEBUG) ... ok
> gcc "-DNDEBUG"
[ 50%]: cache compiling.release src/hello.c
/usr/bin/gcc -c -fvisibility=hidden -Wall -Wextra -Wpedantic -O3 -DNDEBUG -o build/.objs/hello_c/linux/arm64-v8a/release/src/hello.c.o src/hello.c
checking for flags (-MMD -MF) ... ok
> gcc "-MMD" "-MF" "/dev/null"
checking for flags (-fdiagnostics-color=always) ... ok
> gcc "-fdiagnostics-color=always"
checking for flags (-Wno-gnu-line-marker -Werror) ... ok
> gcc "-Wno-gnu-line-marker" "-Werror"
checking for g++ ... /usr/bin/g++
checking for the linker (ld) ... g++
checking for /usr/bin/g++ ... ok
checking for flags (-fPIC) ... ok
> g++ "-fPIC"
[ 75%]: linking.release hello_c
/usr/bin/g++ -o build/linux/arm64-v8a/release/hello_c build/.objs/hello_c/linux/arm64-v8a/release/src/hello.c.o -s
@Doekin Doekin added the bug label Mar 10, 2025
@waruqi
Copy link
Member

waruqi commented Mar 10, 2025

please swith to cross platform to cross compilation, and set --cross

xmake f -p cross --cross=aarch64-linux-gnu-
xmake -rv

@Doekin
Copy link
Contributor Author

Doekin commented Mar 10, 2025

Oh, I see. Thank you for pointing that out. It was my configuration mistake.

@Doekin Doekin closed this as completed Mar 10, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants