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

Trying to execute it in Mac, after some issues in configuration now I am able to start it, but hackrf is not detected and a Java exception raises. #33

Open
All3xJ opened this issue Jul 14, 2020 · 4 comments

Comments

@All3xJ
Copy link

All3xJ commented Jul 14, 2020

I'm in Mac

$ ./hackrf_sweep_spectrum_analyzer_linux.sh 
Persistent image set to 320x240
HackRFSweep thread stopped.
Starting hackrf_sweep... 2400-2500MHz 
hackrf_sweep params:  freq 2400-2500MHz  FFTBin 100000Hz  samples 8192  lna: 40 vga: 0 antenna_lna: false
Exception in thread "hackrf_sweep" java.lang.UnsatisfiedLinkError: Unable to load library 'hackrf-sweep': Native library (darwin/libhackrf-sweep.dylib) not found in resource path ([rsrc:./, jar:rsrc:miglayout15-swing.jar!/, jar:rsrc:jcommon-1.0.17.jar!/, jar:rsrc:jfreechart-1.0.14.jar!/, jar:rsrc:jna-4.5.1.jar!/])
	at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:303)
	at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:427)
	at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:369)
	at jspectrumanalyzer.nativebridge.HackRFSweepNativeBridge.<clinit>(Unknown Source)
	at jspectrumanalyzer.HackRFSweepSpectrumAnalyzer.sweep(Unknown Source)
	at jspectrumanalyzer.HackRFSweepSpectrumAnalyzer.lambda$restartHackrfSweepExecute$6(Unknown Source)
	at java.base/java.lang.Thread.run(Thread.java:832)
Persistent image set to 256x256
HackRFSweep thread stopped.
Processing thread stopped.

What is due to? How could I try to fix it?

@bialybudyn
Copy link

bialybudyn commented Sep 8, 2020

Same issue on Kali Linux. "hackrf_sweep" works fine

Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true
Persistent image set to 320x240
HackRFSweep thread stopped.
Starting hackrf_sweep... 2400-2500MHz
hackrf_sweep params: freq 2400-2500MHz FFTBin 100000Hz samples 8192 lna: 40 vga: 0 antenna_lna: false
Exception in thread "hackrf_sweep" java.lang.UnsatisfiedLinkError: Unable to load library 'hackrf-sweep': Native library (linux-x86-64/libhackrf-sweep.so) not found in resource path ([rsrc:./, jar:rsrc:miglayout15-swing.jar!/, jar:rsrc:jcommon-1.0.17.jar!/, jar:rsrc:jfreechart-1.0.14.jar!/, jar:rsrc:jna-4.5.1.jar!/])
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:303)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:427)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:369)
at jspectrumanalyzer.nativebridge.HackRFSweepNativeBridge.(Unknown Source)
at jspectrumanalyzer.HackRFSweepSpectrumAnalyzer.sweep(Unknown Source)
at jspectrumanalyzer.HackRFSweepSpectrumAnalyzer.lambda$restartHackrfSweepExecute$6(Unknown Source)
at java.base/java.lang.Thread.run(Thread.java:834)
Persistent image set to 380x380
HackRFSweep thread stopped.
Processing thread stopped.

2020-09-08, 15:35:16, 3770000000, 3775000000, 1000000.00, 20, -63.48, -64.78, -70.03, -64.35, -59.14
2020-09-08, 15:35:16, 3765000000, 3770000000, 1000000.00, 20, -61.46, -71.30, -75.11, -63.74, -60.81
2020-09-08, 15:35:16, 3775000000, 3780000000, 1000000.00, 20, -63.78, -62.88, -71.11, -68.35, -62.99
2020-09-08, 15:35:16, 3780000000, 3785000000, 1000000.00, 20, -63.87, -63.54, -80.88, -74.94, -63.09
2020-09-08, 15:35:16, 3790000000, 3795000000, 1000000.00, 20, -63.46, -63.91, -65.76, -64.44, -62.35
2020-09-08, 15:35:16, 3785000000, 3790000000, 1000000.00, 20, -64.68, -68.42, -60.41, -65.51, -66.79
2020-09-08, 15:35:16, 3795000000, 3800000000, 1000000.00, 20, -62.21, -61.16, -58.96, -57.39, -56.93
2020-09-08, 15:35:16, 3800000000, 3805000000, 1000000.00, 20, -71.38, -69.32, -61.48, -61.30, -65.79
2020-09-08, 15:35:16, 3810000000, 3815000000, 1000000.00, 20, -62.05, -66.71, -61.57, -62.28, -62.60
2020-09-08, 15:35:16, 3805000000, 3810000000, 1000000.00, 20, -66.35, -58.48, -70.12, -62.72, -62.91
2020-09-08, 15:35:16, 3815000000, 3820000000, 1000000.00, 20, -66.07, -66.77, -68.59, -68.19, -65.15
2020-09-08, 15:35:16, 3820000000, 3825000000, 1000000.00, 20, -67.19, -65.53, -68.79, -68.43, -67.37
2020-09-08, 15:35:16, 3830000000, 3835000000, 1000000.00, 20, -73.09, -60.43, -60.04, -62.80, -66.63
2020-09-08, 15:35:16, 3825000000, 3830000000, 1000000.00, 20, -64.18, -65.89, -71.14, -73.55, -64.15
2020-09-08, 15:35:16, 3835000000, 3840000000, 1000000.00, 20, -70.56, -68.35, -65.17, -62.07, -62.75
2020-09-08, 15:35:16, 3840000000, 3845000000, 1000000.00, 20, -59.46, -67.64, -65.86, -68.54, -64.18
2020-09-08, 15:35:16, 3850000000, 3855000000, 1000000.00, 20, -70.49, -62.31, -63.47, -59.10, -59.09
2020-09-08, 15:35:16, 3845000000, 3850000000, 1000000.00, 20, -60.97, -64.41, -70.29, -73.78, -61.37
2020-09-08, 15:35:16, 3855000000, 3860000000, 1000000.00, 20, -66.65, -66.09, -59.59, -62.46, -64.99
2020-09-08, 15:35:16, 3860000000, 3865000000, 1000000.00, 20, -60.49, -67.99, -60.45, -61.21, -60.37
2020-09-08, 15:35:16, 3870000000, 3875000000, 1000000.00, 20, -67.72, -63.47, -63.28, -62.76, -58.86
2020-09-08, 15:35:16, 3865000000, 3870000000, 1000000.00, 20, -68.29, -69.62, -61.01, -62.74, -85.46
2020-09-08, 15:35:16, 3875000000, 3880000000, 1000000.00, 20, -74.90, -65.99, -57.86, -56.20, -59.78
2020-09-08, 15:35:16, 3880000000, 3885000000, 1000000.00, 20, -65.68, -64.26, -58.73, -59.91, -69.71
2020-09-08, 15:35:16, 3890000000, 3895000000, 1000000.00, 20, -62.26, -68.07, -75.74, -65.77, -68.12
2020-09-08, 15:35:16, 3885000000, 3890000000, 1000000.00, 20, -65.45, -65.85, -62.78, -66.46, -69.35
2020-09-08, 15:35:16, 3895000000, 3900000000, 1000000.00, 20, -67.38, -62.84, -60.36, -59.54, -60.95
^CCaught signal 2
3.1 MiB / 0.226 sec = 13.9 MiB/second

Exiting...
Total time: 1.22655 s
hackrf_stop_rx() done
hackrf_close() done
hackrf_exit() done
fclose(fd) done
exit

@cpatulea
Copy link

For Mac specifically:

It is not too difficult.. just make a symlink, where Java expects the library to be:

$ mkdir darwin
$ cd darwin/
$ ln -s ../build/lib/linux-x86-64/libhackrf-sweep.so libhackrf-sweep.dylib
$ cd ..
$ build/hackrf_sweep_spectrum_analyzer_linux.sh

@cpatulea
Copy link

although, on my machine it crashes with SIGILL after about ~5 seconds of runtime:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGILL (0x4) at pc=0x00007fff2ab74abc, pid=21033, tid=54787
#
# JRE version: OpenJDK Runtime Environment (14.0.1+14) (build 14.0.1+14)
# Java VM: OpenJDK 64-Bit Server VM (14.0.1+14, mixed mode, sharing, tiered, compressed oops, g
# Problematic frame:
# C  [AppKit+0x3e5abc]  -[NSOpenGLContext setView:]+0xe5
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "uli
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
---------------  S U M M A R Y ------------

Command Line: -Djna.platform.library.path=lib/linux-x86-64 build/lib/hackrf_sweep_spectrum_anal

Host: MacBookAir6,1 x86_64 1700 MHz, 4 cores, 8G, Darwin 19.6.0
Time: Tue Oct 20 23:39:51 2020 EDT elapsed time: 11 seconds (0d 0h 0m 11s)

---------------  T H R E A D  ---------------

Current thread (0x00007ffa82836000):  JavaThread "Java2D Queue Flusher" daemon [_thread_in_nati

Stack: [0x0000700004e50000,0x0000700004f50000],  sp=0x0000700004f4f820,  free space=1022k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=na
C  [AppKit+0x3e5abc]  -[NSOpenGLContext setView:]+0xe5
C  [libawt_lwawt.dylib+0x2120f]  CGLSD_MakeCurrentToScratch+0x45
C  [libawt_lwawt.dylib+0x21318]  OGLSD_MakeOGLContextCurrent+0x58
C  [libawt_lwawt.dylib+0x40481]  OGLContext_SetSurfaces+0x85
C  [libawt_lwawt.dylib+0x43f1d]  Java_sun_java2d_opengl_OGLRenderQueue_flushBuffer+0x62d
J 3315  sun.java2d.opengl.OGLRenderQueue.flushBuffer(JI)V [email protected] (0 bytes) @ 0x000
J 3284 c1 sun.java2d.opengl.OGLRenderQueue.flushBuffer()V [email protected] (41 bytes) @ 0x00
j  sun.java2d.opengl.OGLRenderQueue$QueueFlusher.run()V+81 [email protected]
j  java.lang.Thread.run()V+11 [email protected]
v  ~StubRoutines::call_stub
V  [libjvm.dylib+0x35a5e7]  JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArg
V  [libjvm.dylib+0x3599f0]  JavaCalls::call_virtual(JavaValue*, Klass*, Symbol*, Symbol*, JavaC
V  [libjvm.dylib+0x359aaa]  JavaCalls::call_virtual(JavaValue*, Handle, Klass*, Symbol*, Symbol
V  [libjvm.dylib+0x3e9f23]  thread_entry(JavaThread*, Thread*)+0x78
V  [libjvm.dylib+0x770436]  JavaThread::thread_main_inner()+0x86
V  [libjvm.dylib+0x77027a]  JavaThread::run()+0x11c
V  [libjvm.dylib+0x76e0d7]  Thread::call_run()+0x71
V  [libjvm.dylib+0x605d1d]  thread_native_entry(Thread*)+0x126
C  [libsystem_pthread.dylib+0x6109]  _pthread_start+0x94
C  [libsystem_pthread.dylib+0x1b8b]  thread_start+0xf

@cpatulea
Copy link

cpatulea commented Oct 21, 2020

something very similar reported here: https://bugs.openjdk.java.net/browse/JDK-8240759

[edit:] looks like https://bugs.openjdk.java.net/browse/JDK-8244818 - "move to external monitor" and this is exactly what I did, so likely just an issue with my setup, not a general Mac OS 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

No branches or pull requests

3 participants