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

Running JSerialComm on M1 Mac. 'java.lang.UnsatisfiedLinkError' #572

Open
jimenezjose opened this issue Sep 24, 2024 · 3 comments
Open

Running JSerialComm on M1 Mac. 'java.lang.UnsatisfiedLinkError' #572

jimenezjose opened this issue Sep 24, 2024 · 3 comments

Comments

@jimenezjose
Copy link

I already tried the following:

  1. Use the latest JSerialComm jar file
  2. Override the os.arch_full=armv8_64.

I am still running into issues.

It wasn't well documented, but the way I tried overriding the architecture was by using java -Dos.arch_full=armv8_64 -cp ...

Thank you in advance. I left the complete error at the bottom.

mkdir -p build
javac -Xlint:unchecked -cp lib/jSerialComm-2.11.0.jar:lib/commons-lang3-3.11.jar -g src/MazeGUI.java src/Mouse.java src/Maze.java src/MazeNode.java src/utility/Pair.java src/utility/PQNode.java src/utility/strings/ParsingStrings.java src/utility/comm/SerialRoute.java src/utility/comm/SerialRouteEvent.java  -d build
Exception in thread "main" java.lang.UnsatisfiedLinkError: /private/var/folders/9b/1k0116695fl2ql5xg_hqwrx800w1n9/T/1727145213540-libjSerialComm.jnilib: dlopen(/private/var/folders/9b/1k0116695fl2ql5xg_hqwrx800w1n9/T/1727145213540-libjSerialComm.jnilib, 0x0001): tried: '/private/var/folders/9b/1k0116695fl2ql5xg_hqwrx800w1n9/T/1727145213540-libjSerialComm.jnilib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/private/var/folders/9b/1k0116695fl2ql5xg_hqwrx800w1n9/T/1727145213540-libjSerialComm.jnilib' (no such file), '/private/var/folders/9b/1k0116695fl2ql5xg_hqwrx800w1n9/T/1727145213540-libjSerialComm.jnilib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64'))
	at java.lang.ClassLoader$NativeLibrary.load(Native Method)
	at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1934)
	at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1817)
	at java.lang.Runtime.load0(Runtime.java:782)
	at java.lang.System.load(System.java:1100)
	at com.fazecast.jSerialComm.SerialPort.<clinit>(SerialPort.java:248)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:264)
	at MazeGUI.main(MazeGUI.java:1098)
@jimenezjose
Copy link
Author

Here is the Makefile, and the run script

@jimenezjose
Copy link
Author

I also tried specifying a tmpdir -Djava.io.tmpdir=/Users/josejimenezjr/micromouse-simulator-temp

@jskubick
Copy link
Contributor

FYI, I just ran into the same issue myself after building the current source from scratch, then attempting to call SerialPort.getCommPorts():

Exception in thread "main" java.lang.UnsatisfiedLinkError: Cannot load native library. Errors as follows:
[1]: no jSerialComm in java.library.path: /Users/jeff/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.

	at com.fazecast.jSerialComm.SerialPort.<clinit>(SerialPort.java:273)
	at com.fazecast.jSerialComm.HighThroughputNullmodemTest.main(HighThroughputNullmodemTest.java:64)

Execution failed for task ':com.fazecast.jSerialComm.HighThroughputNullmodemTest.main()'.

NOTE: In order to get it to compile, I had to change sourceCompatibility and targetCompatibility (in build.gradle) from 6 to 7. This might (or might not) be significant.

  • M3 Macbook Pro,
  • Sonoma 14.6.1,
  • IntelliJ community 2024.2.1
  • JDK 17

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

No branches or pull requests

2 participants