wpilibsuite / romi-vendordep

WPILib Romi Vendordep
0 stars 6 forks source link

Linker is failing for vendordep #10

Open Piphi5 opened 3 years ago

Piphi5 commented 3 years ago

When trying to build sysid with the romi vendordep, the linker is failing to identify the RomiGyro constructor.

> Task :sysid-projects:drive:linkFrcUserProgramLinuxathenaDebugExecutable                                                                              /home/piphi5/sysid/sysid-projects/drive/build/objs/frcUserProgram/linuxathena/debug/frcUserProgramCpp/9760xtgdau9jsoxxi90ozrpww/Robot.o: In function `std::_MakeUniq<frc::RomiGyro>::__single_object std::make_unique<frc::RomiGyro>()':                                                                      /home/piphi5/.gradle/toolchains/frc/2021/roborio/arm-frc2021-linux-gnueabi/usr/include/c++/7.3.0/bits/unique_ptr.h:825: undefined reference to `frc::RomiGyro::RomiGyro()'                                                                                                                                    collect2: error: ld returned 1 exit status

Also see this workflow.

sciencewhiz commented 2 years ago

Is this still an issue? I didn't see a problem using a regular C++ project

Piphi5 commented 2 years ago
SysIdSetup.cpp:(.text+0x286c): undefined reference to `frc::RomiGyro::RomiGyro()'                                                                                                                                                            collect2: error: ld returned 1 exit status 

Seems like it still is

Piphi5 commented 2 years ago

@sciencewhiz Does declaring a romi gyro like this this work for you?

sciencewhiz commented 2 years ago

In the header I had std::unique_ptr<frc::Gyro> m_gyro; and in the constructor I had m_gyro = std::make_unique<frc::RomiGyro>(); m_gyro->Calibrate(); and that compiled and linked.

sciencewhiz commented 2 years ago

unless I missed it, it doesn't look like you've added the Romi vendordep.

Piphi5 commented 2 years ago

Oops that didn't get committed

Piphi5 commented 2 years ago

That's very strange though. It may be an issue with how we're downloading vendordeps for sysid.

sciencewhiz commented 2 years ago

The issue is that the Romi Vendordep doesn't declare linuxathena as a cpp binary platform. Given that Romi is only used on the desktop, I think the right solution is for SysID to ifdef out the RomiGyro on the roboRIO.

Piphi5 commented 2 years ago

Ah that makes sense