Go to Post Success is making a difference. - SlamminSammy [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 27-03-2016, 21:47
connor.worley's Avatar
connor.worley connor.worley is offline
Registered User
FRC #0973 (Greybots)
Team Role: Mentor
 
Join Date: Mar 2011
Rookie Year: 2010
Location: Berkeley/San Diego
Posts: 601
connor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond repute
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>
and running into an error resolving _ZN5nFPGA16nFRC_2016_16_1_020g_currentTargetClassE . Does anyone know what static library provides this? We are already using all static libraries available in wpilib/cpp/current/lib.
__________________
Team 973 (2016-???)
Team 5499 (2015-2016)
Team 254 (2014-2015)

Team 1538 (2011-2014)
2014 Driver (25W 17L 1T)
日本語でOK
  #2   Spotlight this post!  
Unread 27-03-2016, 23:24
AustinSchuh AustinSchuh is offline
Registered User
FRC #0971 (Spartan Robotics) #254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Feb 2005
Rookie Year: 1999
Location: Los Altos, CA
Posts: 800
AustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond repute
Re: Issues with JNI .so for FRC

Quote:
Originally Posted by connor.worley View Post
and running into an error resolving _ZN5nFPGA16nFRC_2016_16_1_020g_currentTargetClassE . Does anyone know what static library provides this? We are already using all static libraries available in wpilib/cpp/current/lib.
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;
Looks like part of libRoboRIO_FRC_ChipObject.so
  #3   Spotlight this post!  
Unread 28-03-2016, 00:54
Peter Johnson Peter Johnson is offline
WPILib Developer
FRC #0294 (Beach Cities Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Redondo Beach, CA
Posts: 247
Peter Johnson has much to be proud ofPeter Johnson has much to be proud ofPeter Johnson has much to be proud ofPeter Johnson has much to be proud ofPeter Johnson has much to be proud ofPeter Johnson has much to be proud ofPeter Johnson has much to be proud ofPeter Johnson has much to be proud of
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.
__________________
Author of cscore - WPILib CameraServer for 2017+
Author of ntcore - WPILib NetworkTables for 2016+
Creator of RobotPy - Python for FRC

2010 FRC World Champions (294, 67, 177)
2007 FTC World Champions (30, 74, 23)
2001 FRC National Champions (71, 294, 125, 365, 279)
  #4   Spotlight this post!  
Unread 28-03-2016, 01:03
connor.worley's Avatar
connor.worley connor.worley is offline
Registered User
FRC #0973 (Greybots)
Team Role: Mentor
 
Join Date: Mar 2011
Rookie Year: 2010
Location: Berkeley/San Diego
Posts: 601
connor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond repute
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.
__________________
Team 973 (2016-???)
Team 5499 (2015-2016)
Team 254 (2014-2015)

Team 1538 (2011-2014)
2014 Driver (25W 17L 1T)
日本語でOK
  #5   Spotlight this post!  
Unread 28-03-2016, 08:22
fsilberberg fsilberberg is offline
WPILib Developer
AKA: Fred Silberberg
FRC #0190
Team Role: Alumni
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Redmond
Posts: 146
fsilberberg has a spectacular aura aboutfsilberberg has a spectacular aura aboutfsilberberg has a spectacular aura about
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   Spotlight this post!  
Unread 28-03-2016, 20:43
connor.worley's Avatar
connor.worley connor.worley is offline
Registered User
FRC #0973 (Greybots)
Team Role: Mentor
 
Join Date: Mar 2011
Rookie Year: 2010
Location: Berkeley/San Diego
Posts: 601
connor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond repute
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?
__________________
Team 973 (2016-???)
Team 5499 (2015-2016)
Team 254 (2014-2015)

Team 1538 (2011-2014)
2014 Driver (25W 17L 1T)
日本語でOK
  #7   Spotlight this post!  
Unread 28-03-2016, 20:53
Thad House Thad House is online now
Volunteer, WPILib Contributor
no team (Waiting for 2021)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2010
Location: Thousand Oaks, California
Posts: 1,084
Thad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond repute
Re: Issues with JNI .so for FRC

Quote:
Originally Posted by connor.worley View Post
New issue - when the JNI library is loaded, our Talons refuse to enable in auto / teleop. Any insight into this?
Do they enable but not get commands (solid yellow), or stay disabled (blinking yellow) when you switch to auto and teleop?

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?
__________________
All statements made are my own and not the feelings of any of my affiliated teams.
Teams 1510 and 2898 - Student 2010-2012
Team 4488 - Mentor 2013-2016
Co-developer of RobotDotNet, a .NET port of the WPILib.
  #8   Spotlight this post!  
Unread 28-03-2016, 20:56
connor.worley's Avatar
connor.worley connor.worley is offline
Registered User
FRC #0973 (Greybots)
Team Role: Mentor
 
Join Date: Mar 2011
Rookie Year: 2010
Location: Berkeley/San Diego
Posts: 601
connor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond repute
Re: Issues with JNI .so for FRC

Quote:
Originally Posted by Thad House View Post
Do they enable but not get commands (solid yellow), or stay disabled (blinking yellow) when you switch to auto and teleop?

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?
They're blinking yellow/orange (pardon my colorblindness). We're wrapping some 3rd party MXP code in JNI rather than porting it. I also suspect a conflict, but I'm not sure where it would arise.
__________________
Team 973 (2016-???)
Team 5499 (2015-2016)
Team 254 (2014-2015)

Team 1538 (2011-2014)
2014 Driver (25W 17L 1T)
日本語でOK
  #9   Spotlight this post!  
Unread 28-03-2016, 21:26
connor.worley's Avatar
connor.worley connor.worley is offline
Registered User
FRC #0973 (Greybots)
Team Role: Mentor
 
Join Date: Mar 2011
Rookie Year: 2010
Location: Berkeley/San Diego
Posts: 601
connor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond repute
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.
__________________
Team 973 (2016-???)
Team 5499 (2015-2016)
Team 254 (2014-2015)

Team 1538 (2011-2014)
2014 Driver (25W 17L 1T)
日本語でOK

Last edited by connor.worley : 28-03-2016 at 22:15.
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 23:07.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi