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

Compiling Problem #232

Open
celioregoli opened this issue Apr 5, 2023 · 7 comments · May be fixed by #238
Open

Compiling Problem #232

celioregoli opened this issue Apr 5, 2023 · 7 comments · May be fixed by #238

Comments

@celioregoli
Copy link

celioregoli commented Apr 5, 2023

celio@Lenovo-G505:~/nrjavaserial$  sudo make -C src/main/c crosstools && make arm
make: Entering directory '/home/celio/nrjavaserial/src/main/c'
JAVA_HOME.mk:112: The JAVA_HOME environment variable has not been defined.
Based on the location of the `java` binary, I've guessed it's:

    "/usr/lib/jvm/java-20-openjdk-amd64"

If that's not correct, or to suppress this message, explicitly set the
JAVA_HOME environment variable to the location of your preferred Java
installation.
apt install --install-recommends \
            gcc-i686-linux-gnu \
            gcc-arm-linux-gnueabi \
            gcc-arm-linux-gnueabihf \
            gcc-aarch64-linux-gnu \
            gcc-mingw-w64 \
            gcc-powerpc-linux-gnu
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
gcc-i686-linux-gnu is already the newest version (4:12.2.0-1ubuntu1).
gcc-arm-linux-gnueabi is already the newest version (4:12.2.0-1ubuntu1).
gcc-arm-linux-gnueabihf is already the newest version (4:12.2.0-1ubuntu1).
gcc-aarch64-linux-gnu is already the newest version (4:12.2.0-1ubuntu1).
gcc-mingw-w64 is already the newest version (10.3.0-15ubuntu1+24.4ubuntu1).
gcc-powerpc-linux-gnu is already the newest version (4:12.2.0-1ubuntu1).
0 upgraded, 0 newly installed, 0 to remove and 18 not upgraded.
make: Leaving directory '/home/celio/nrjavaserial/src/main/c'
make -C src/main/c arm
make[1]: Entering directory '/home/celio/nrjavaserial/src/main/c'
JAVA_HOME.mk:112: The JAVA_HOME environment variable has not been defined.
Based on the location of the `java` binary, I've guessed it's:

    "/usr/lib/jvm/java-20-openjdk-amd64"

If that's not correct, or to suppress this message, explicitly set the
JAVA_HOME environment variable to the location of your preferred Java
installation.
make -f natives.mk
make[2]: Entering directory '/home/celio/nrjavaserial/src/main/c'
make[2]: 'resources/native/linux/ARM_32/libNRJavaSerialv5.so' is up to date.
make[2]: Leaving directory '/home/celio/nrjavaserial/src/main/c'
make -f natives.mk
make[2]: Entering directory '/home/celio/nrjavaserial/src/main/c'
make[2]: 'resources/native/linux/ARM_32/libNRJavaSerialv6.so' is up to date.
make[2]: Leaving directory '/home/celio/nrjavaserial/src/main/c'
make -f natives.mk
make[2]: Entering directory '/home/celio/nrjavaserial/src/main/c'
make[2]: 'resources/native/linux/ARM_32/libNRJavaSerialv6_HF.so' is up to date.
make[2]: Leaving directory '/home/celio/nrjavaserial/src/main/c'
make -f natives.mk
make[2]: Entering directory '/home/celio/nrjavaserial/src/main/c'
make[2]: 'resources/native/linux/ARM_32/libNRJavaSerialv7.so' is up to date.
make[2]: Leaving directory '/home/celio/nrjavaserial/src/main/c'
make -f natives.mk
make[2]: Entering directory '/home/celio/nrjavaserial/src/main/c'
arm-linux-gnueabihf-gcc -I""/usr/lib/jvm/java-20-openjdk-amd64"/include" -I./include -I./include/target -O3 -fPIC -c -Wall -I"/usr/lib/jvm/java-20-openjdk-amd64"/include/linux -U_FORTIFY_SOURCE -march=armv7-a src/fixup.c -o build/linux/ARM_32/fixupv7_HF.o
cc1: error: '-mfloat-abi=hard': selected architecture lacks an FPU
make[2]: *** [natives.mk:15: build/linux/ARM_32/fixupv7_HF.o] Error 1
make[2]: Leaving directory '/home/celio/nrjavaserial/src/main/c'
make[1]: *** [Makefile:172: arm32v7HF] Error 2
make[1]: Leaving directory '/home/celio/nrjavaserial/src/main/c'
make: *** [Makefile:15: arm] Error 2
@MrDOS
Copy link
Contributor

MrDOS commented Apr 5, 2023

This may be related to Ubuntu bug #1939379 (I assume you're using Ubuntu here). Can you try modifying the makefile for the native libraries to pass -march=armv7-a+fp to the compiler and linker instead of -march=armv7-a?

diff --git a/src/main/c/Makefile b/src/main/c/Makefile
index d7c5a39..56b2b82 100644
--- a/src/main/c/Makefile
+++ b/src/main/c/Makefile
@@ -164,8 +164,8 @@ arm32v7:
 
 # Requires gcc-arm-linux-gnueabihf.
 arm32v7HF: export CC := arm-linux-gnueabihf-gcc
-arm32v7HF: export CFLAGS += $(LINUX_CFLAGS) -march=armv7-a
-arm32v7HF: export LDFLAGS += -march=armv7-a
+arm32v7HF: export CFLAGS += $(LINUX_CFLAGS) -march=armv7-a+fp
+arm32v7HF: export LDFLAGS += -march=armv7-a+fp
 arm32v7HF: export platform := linux/ARM_32
 arm32v7HF: export variant := v7_HF
 arm32v7HF:

@celioregoli
Copy link
Author

celioregoli commented Apr 6, 2023

thank you very much for the advice, yes , exactly , I have kubuntu 22.10, I did as you said and now it continues without that error, but it gives another one.

sudo make -C src/main/c crosstools && make arm
make: Entering directory '/home/celio/nrjavaserial/src/main/c'
JAVA_HOME.mk:112: The JAVA_HOME environment variable has not been defined.
Based on the location of the `java` binary, I've guessed it's:

    "/usr/lib/jvm/java-20-openjdk-amd64"

If that's not correct, or to suppress this message, explicitly set the
JAVA_HOME environment variable to the location of your preferred Java
installation.
apt install --install-recommends \
            gcc-i686-linux-gnu \
            gcc-arm-linux-gnueabi \
            gcc-arm-linux-gnueabihf \
            gcc-aarch64-linux-gnu \
            gcc-mingw-w64 \
            gcc-powerpc-linux-gnu
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
gcc-i686-linux-gnu is already the newest version (4:12.2.0-1ubuntu1).
gcc-arm-linux-gnueabi is already the newest version (4:12.2.0-1ubuntu1).
gcc-arm-linux-gnueabihf is already the newest version (4:12.2.0-1ubuntu1).
gcc-aarch64-linux-gnu is already the newest version (4:12.2.0-1ubuntu1).
gcc-mingw-w64 is already the newest version (10.3.0-15ubuntu1+24.4ubuntu1).
gcc-powerpc-linux-gnu is already the newest version (4:12.2.0-1ubuntu1).
0 upgraded, 0 newly installed, 0 to remove and 18 not upgraded.
make: Leaving directory '/home/celio/nrjavaserial/src/main/c'
make -C src/main/c arm
make[1]: Entering directory '/home/celio/nrjavaserial/src/main/c'
JAVA_HOME.mk:112: The JAVA_HOME environment variable has not been defined.
Based on the location of the `java` binary, I've guessed it's:

    "/usr/lib/jvm/java-20-openjdk-amd64"

If that's not correct, or to suppress this message, explicitly set the
JAVA_HOME environment variable to the location of your preferred Java
installation.
make -f natives.mk
make[2]: Entering directory '/home/celio/nrjavaserial/src/main/c'
make[2]: 'resources/native/linux/ARM_32/libNRJavaSerialv5.so' is up to date.
make[2]: Leaving directory '/home/celio/nrjavaserial/src/main/c'
make -f natives.mk
make[2]: Entering directory '/home/celio/nrjavaserial/src/main/c'
make[2]: 'resources/native/linux/ARM_32/libNRJavaSerialv6.so' is up to date.
make[2]: Leaving directory '/home/celio/nrjavaserial/src/main/c'
make -f natives.mk
make[2]: Entering directory '/home/celio/nrjavaserial/src/main/c'
make[2]: 'resources/native/linux/ARM_32/libNRJavaSerialv6_HF.so' is up to date.
make[2]: Leaving directory '/home/celio/nrjavaserial/src/main/c'
make -f natives.mk
make[2]: Entering directory '/home/celio/nrjavaserial/src/main/c'
make[2]: 'resources/native/linux/ARM_32/libNRJavaSerialv7.so' is up to date.
make[2]: Leaving directory '/home/celio/nrjavaserial/src/main/c'
make -f natives.mk
make[2]: Entering directory '/home/celio/nrjavaserial/src/main/c'
make[2]: 'resources/native/linux/ARM_32/libNRJavaSerialv7_HF.so' is up to date.
make[2]: Leaving directory '/home/celio/nrjavaserial/src/main/c'
make -f natives.mk
make[2]: Entering directory '/home/celio/nrjavaserial/src/main/c'
make[2]: 'resources/native/linux/ARM_32/libNRJavaSerialv8.so' is up to date.
make[2]: Leaving directory '/home/celio/nrjavaserial/src/main/c'
make -f natives.mk
make[2]: Entering directory '/home/celio/nrjavaserial/src/main/c'
arm-linux-gnueabihf-gcc -I""/usr/lib/jvm/java-20-openjdk-amd64"/include" -I./include -I./include/target -O3 -fPIC -c -Wall -I"/usr/lib/jvm/java-20-openjdk-amd64"/include/linux -U_FORTIFY_SOURCE -march=armv8-a src/fixup.c -o build/linux/ARM_32/fixupv8_HF.o
cc1: error: '-mfloat-abi=hard': selected architecture lacks an FPU
make[2]: *** [natives.mk:15: build/linux/ARM_32/fixupv8_HF.o] Error 1
make[2]: Leaving directory '/home/celio/nrjavaserial/src/main/c'
make[1]: *** [Makefile:190: arm32v8HF] Error 2
make[1]: Leaving directory '/home/celio/nrjavaserial/src/main/c'
make: *** [Makefile:15: arm] Error 2

@celioregoli
Copy link
Author

celioregoli commented Apr 6, 2023

I tried, searching on the internet, to modify

# Requires gcc-arm-linux-gnueabihf.
arm32v8HF: export CC := arm-linux-gnueabihf-gcc
arm32v8HF: export CFLAGS += $(LINUX_CFLAGS) -march=armv8-a
arm32v8HF: export LDFLAGS += -march=armv8-a
arm32v8HF: export platform := linux/ARM_32
arm32v8HF: export variant := v8_HF
arm32v8HF:
	$(MAKE) -f natives.mk

with

# Requires gcc-arm-linux-gnueabihf.
arm32v8HF: export CC := arm-linux-gnueabihf-gcc
arm32v8HF: export CFLAGS += $(LINUX_CFLAGS) -with-arch=armv8-a+fp
arm32v8HF: export LDFLAGS += -with-arch=armv8-a+fp
arm32v8HF: export platform := linux/ARM_32
arm32v8HF: export variant := v8_HF
arm32v8HF:

now continues but
give another error

@MrDOS
Copy link
Contributor

MrDOS commented Apr 6, 2023

You probably need to add +fp to the -march flag for the arm64v8 target on lines 194 and 195, too (i.e., -march=armv8-a+fp):

arm64v8: export CFLAGS += $(LINUX_CFLAGS) -march=armv8-a
arm64v8: export LDFLAGS += -march=armv8-a

@celioregoli
Copy link
Author

I had already tried -march=armv8-a+fp and it gave me error, so after searching on the web I put arm32v8HF: export LDFLAGS += -with-arch=armv8-a+fp and it worked.

@celioregoli
Copy link
Author

celioregoli commented Apr 6, 2023

celio@Lenovo-G505:~/nrjavaserial$ sudo make -C src/main/c crosstools && make arm
make: Entering directory '/home/celio/nrjavaserial/src/main/c'
JAVA_HOME.mk:112: The JAVA_HOME environment variable has not been defined.
Based on the location of the `java` binary, I've guessed it's:

    "/usr/lib/jvm/java-20-openjdk-amd64"

If that's not correct, or to suppress this message, explicitly set the
JAVA_HOME environment variable to the location of your preferred Java
installation.
apt install --install-recommends \
            gcc-i686-linux-gnu \
            gcc-arm-linux-gnueabi \
            gcc-arm-linux-gnueabihf \
            gcc-aarch64-linux-gnu \
            gcc-mingw-w64 \
            gcc-powerpc-linux-gnu
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
gcc-i686-linux-gnu is already the newest version (4:12.2.0-1ubuntu1).
gcc-arm-linux-gnueabi is already the newest version (4:12.2.0-1ubuntu1).
gcc-arm-linux-gnueabihf is already the newest version (4:12.2.0-1ubuntu1).
gcc-aarch64-linux-gnu is already the newest version (4:12.2.0-1ubuntu1).
gcc-mingw-w64 is already the newest version (10.3.0-15ubuntu1+24.4ubuntu1).
gcc-powerpc-linux-gnu is already the newest version (4:12.2.0-1ubuntu1).
0 upgraded, 0 newly installed, 0 to remove and 29 not upgraded.
make: Leaving directory '/home/celio/nrjavaserial/src/main/c'
make -C src/main/c arm
make[1]: Entering directory '/home/celio/nrjavaserial/src/main/c'
JAVA_HOME.mk:112: The JAVA_HOME environment variable has not been defined.
Based on the location of the `java` binary, I've guessed it's:

    "/usr/lib/jvm/java-20-openjdk-amd64"

If that's not correct, or to suppress this message, explicitly set the
JAVA_HOME environment variable to the location of your preferred Java
installation.
make -f natives.mk
make[2]: Entering directory '/home/celio/nrjavaserial/src/main/c'
make[2]: 'resources/native/linux/ARM_32/libNRJavaSerialv5.so' is up to date.
make[2]: Leaving directory '/home/celio/nrjavaserial/src/main/c'
make -f natives.mk
make[2]: Entering directory '/home/celio/nrjavaserial/src/main/c'
make[2]: 'resources/native/linux/ARM_32/libNRJavaSerialv6.so' is up to date.
make[2]: Leaving directory '/home/celio/nrjavaserial/src/main/c'
make -f natives.mk
make[2]: Entering directory '/home/celio/nrjavaserial/src/main/c'
make[2]: 'resources/native/linux/ARM_32/libNRJavaSerialv6_HF.so' is up to date.
make[2]: Leaving directory '/home/celio/nrjavaserial/src/main/c'
make -f natives.mk
make[2]: Entering directory '/home/celio/nrjavaserial/src/main/c'
make[2]: 'resources/native/linux/ARM_32/libNRJavaSerialv7.so' is up to date.
make[2]: Leaving directory '/home/celio/nrjavaserial/src/main/c'
make -f natives.mk
make[2]: Entering directory '/home/celio/nrjavaserial/src/main/c'
make[2]: 'resources/native/linux/ARM_32/libNRJavaSerialv7_HF.so' is up to date.
make[2]: Leaving directory '/home/celio/nrjavaserial/src/main/c'
make -f natives.mk
make[2]: Entering directory '/home/celio/nrjavaserial/src/main/c'
make[2]: 'resources/native/linux/ARM_32/libNRJavaSerialv8.so' is up to date.
make[2]: Leaving directory '/home/celio/nrjavaserial/src/main/c'
make -f natives.mk
make[2]: Entering directory '/home/celio/nrjavaserial/src/main/c'
make[2]: 'resources/native/linux/ARM_32/libNRJavaSerialv8_HF.so' is up to date.
make[2]: Leaving directory '/home/celio/nrjavaserial/src/main/c'
make -f natives.mk
make[2]: Entering directory '/home/celio/nrjavaserial/src/main/c'
make[2]: 'resources/native/linux/ARM_64/libNRJavaSerialv8.so' is up to date.
make[2]: Leaving directory '/home/celio/nrjavaserial/src/main/c'
make[1]: Leaving directory '/home/celio/nrjavaserial/src/main/c'
./gradlew build

FAILURE: Build failed with an exception.

* What went wrong:
Could not initialize class org.codehaus.groovy.runtime.InvokerHelper
> Exception java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.reflection.ReflectionCache [in thread "Daemon worker"]

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 4s
make: *** [Makefile:16: arm] Error 1

@celioregoli
Copy link
Author

i solved, i had java 17 , i put java 11 and all went well.
Thanks for your suggestions.
Problem Solved

@MrDOS MrDOS linked a pull request Aug 25, 2023 that will close this issue
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

Successfully merging a pull request may close this issue.

2 participants