Skip to content

Using arm64 cross compiler when on native arm64 #1080

@Sunderw3k

Description

@Sunderw3k

Version

3.4.0 (snapshot)

Platform

Linux arm64

JDK

openjdk version "21.0.8" 2025-07-15

Module

LWJGL core

Bug description

When running on arm64 and building for the native architecture, config/linux/build.xml prefers to use aarch64-linux-gnu-gcc over gcc.

I figured it's due to it only choosing gcc when on x64 or x86.
This change in config/linux/build.xml fixes it, but it's probably a workaround.

-    <condition property="gcc.prefix" value="" else="${linux.triplet}-">
-        <isset property="build.arch.x64|x86"/>
-    </condition>
+    <property name="gcc.prefix" value=""/>

To reproduce get a arm64 system, clone the repo and run ant.

output of gcc -v below, showing it is aarch64.

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/aarch64-redhat-linux/15/lto-wrapper
Target: aarch64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,objc,obj-c++,ada,go,d,m2,cobol,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --enable-libstdcxx-backtrace --with-libstdcxx-zoneinfo=/usr/share/zoneinfo --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl=/builddir/build/BUILD/gcc-15.1.1-build/gcc-15.1.1-20250521/obj-aarch64-redhat-linux/isl-install --enable-gnu-indirect-function --build=aarch64-redhat-linux --with-build-config=bootstrap-lto --enable-link-serialization=1
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 15.1.1 20250521 (Red Hat 15.1.1-2) (GCC) 

Running asahi linux 6.14.8-400.asahi.fc42.aarch64+16k.

Stacktrace or crash log output

Buildfile: /home/sun3k/Builds/lwjgl3/build.xml

init:

check-dependencies:

-compile-generator:

compile-templates:

generate:

compile:

compile-tests:

compile-native:

compile-native-platform:
     [exec] bash: line 1: aarch64-linux-gnu-gcc: command not found

BUILD FAILED
/home/sun3k/Builds/lwjgl3/build.xml:576: The following error occurred while executing this line:
/home/sun3k/Builds/lwjgl3/config/linux/build.xml:162: exec returned: 1

Total time: 0 seconds


Clearly using the cross toolchain, not the standard one.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions