|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||||
|
|||||
|
Issues with JNI .so for FRC
We are attempting to build a JNI shared library for use in our java code. We are using ant to build the library as follows:
Code:
<target name="CowMXP_JNI-build">
<echo>Building CowGyroJNI shared object for RoboRIO...</echo>
<apply executable="/usr/local/bin/arm-frc-linux-gnueabi-g++">
<arg value="-I${user.home}/wpilib/cpp/current/include"/>
<arg value="-I${java.home}/../include"/>
<arg value="-I${java.home}/../include/darwin"/>
<arg value="-std=c++14"/>
<arg value="-fPIC"/>
<arg value="-shared"/>
<arg value="-oCowMXP_JNI.so"/>
<arg value="-Wl,--whole-archive"/>
<arg value="-L${user.home}/wpilib/cpp/current/lib"/>
<arg value="-lwpilib_nonshared"/>
<arg value="-lntcore"/>
<arg value="-lHALAthena"/>
<arg value="-Wl,--no-whole-archive"/>
<fileset dir="src/com/team1538/lib/c">
<include name="*.cpp"/>
</fileset>
</apply>
</target>
|
|
#2
|
|||
|
|||
|
Re: Issues with JNI .so for FRC
Quote:
Code:
austin[23463] iron ~/local/robotics/971-Robot-Code/bazel-971-Robot-Code/external/allwpilib_ni_libraries_repo $ grep -R "_ZN5nFPGA16nFRC_2016_16_1_020g_currentTargetClassE" ./ Binary file ./libFRC_NetworkCommunicationLV.so.16.0.0 matches Binary file ./libRoboRIO_FRC_ChipObject.so.16.0.0 matches austin[23464] iron ~/local/robotics/971-Robot-Code/bazel-971-Robot-Code/external/allwpilib_ni_libraries_repo $ c++filt _ZN5nFPGA16nFRC_2016_16_1_020g_currentTargetClassE nFPGA::nFRC_2016_16_1_0::g_currentTargetClass austin[23461] iron (master) ~/local/robotics/971-Robot-Code $ git grep g_currentTargetClass third_party/allwpilib_2016/hal/lib/Athena/FRC_FPGA_ChipObject/nInvariantFPGANamespace/nInterfaceGlobals.h: extern unsigned int g_currentTargetClass; third_party/allwpilib_2016/hal/lib/Athena/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/nInterfaceGlobals.h: extern unsigned int g_currentTargetClass; third_party/allwpilib_2016/hal/lib/Athena/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/nInterfaceGlobals.h: extern unsigned int g_currentTargetClass; |
|
#3
|
|||
|
|||
|
Re: Issues with JNI .so for FRC
Note that libRoboRIO_FRC_ChipObject requires other libraries, so you'll probably need to link to nearly every .so in cpp/current/lib. There's two ways to do this: the standard JNI .so (which is built using gradle) explicitly links every .so except libwpi.so and libwpi_2015.so. When building C++ via eclipse, libwpi.so is referenced, which is actually a text file which references libwpi_2015.so, which is also a text file which references a bunch of .so's as well as a couple of .a's.
|
|
#4
|
|||||
|
|||||
|
Re: Issues with JNI .so for FRC
Got it - we later found that libHALAthena.so was missing from the roboRIO and copied over all libs to /usr/lib. Finally worked.
|
|
#5
|
|||
|
|||
|
All of of those libraries (with the exception of libHALAthena.so) were taken directly from the roboRIO to start with. They're in a few ni locations, a find on /usr should show them.
|
|
#6
|
|||||
|
|||||
|
Re: Issues with JNI .so for FRC
New issue - when the JNI library is loaded, our Talons refuse to enable in auto / teleop. Any insight into this?
|
|
#7
|
||||
|
||||
|
Re: Issues with JNI .so for FRC
Quote:
One thing I do wonder about is if you are using the default WPILib in addition to the custom built JNI. The default WPILib has the JNI library built into the JAR, and I wonder if the built in one is conflicting with the custom one you built. Are you modifying WPILib completely, or just trying to add something on top? |
|
#8
|
|||||
|
|||||
|
Re: Issues with JNI .so for FRC
Quote:
|
|
#9
|
|||||
|
|||||
|
Re: Issues with JNI .so for FRC
Nevermind - found the bug in our JNI code! Had multiple calls to HALInitialize. I'll post notes on the stuff we did when I have some free time.
Last edited by connor.worley : 28-03-2016 at 22:15. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|