epics-motor / motorSmarAct

EPICS motor drivers for SmarAct controllers
3 stars 13 forks source link

Making rint static breaks VxWorks builds #5

Closed kmpeters closed 4 years ago

kmpeters commented 4 years ago

Commit e3ec0a9042414144fc555348b7e11b233e3c3c15 breaks builds on VxWorks:

../smarActMCSMotorDriver.cpp: In function 'double rint(double)':
../smarActMCSMotorDriver.cpp:41: error: 'double rint(double)' was declared 'extern' and later 'static'
/APSshare/vw/vxWorks-6.9.4/vxworks-6.9.4/target/h/math.h:104: error: previous declaration of 'double rint(double)'
make[5]: *** [smarActMCSMotorDriver.o] Error 1
make[5]: Leaving directory `/net/s100dserv/xorApps/epics/motor-devel/support/motor-git/modules/motorSmarAct/smarActApp/src/O.vxWorks-ppc32'
make[4]: *** [install.vxWorks-ppc32] Error 2
make[4]: Leaving directory `/net/s100dserv/xorApps/epics/motor-devel/support/motor-git/modules/motorSmarAct/smarActApp/src'
make[3]: *** [src.install] Error 2
make[3]: Leaving directory `/net/s100dserv/xorApps/epics/motor-devel/support/motor-git/modules/motorSmarAct/smarActApp'
make[2]: *** [smarActApp.install] Error 2
make[2]: Leaving directory `/net/s100dserv/xorApps/epics/motor-devel/support/motor-git/modules/motorSmarAct'
make[1]: *** [motorSmarAct.install] Error 2
make[1]: Leaving directory `/net/s100dserv/xorApps/epics/motor-devel/support/motor-git/modules'
make: *** [modules.install] Error 2
kmpeters commented 4 years ago

@MarkRivers, can you elaborate on the problem that resulted in commit e3ec0a9042414144fc555348b7e11b233e3c3c15?

Have you successfully built motorSmarAct for VxWorks since that commit?

kmpeters commented 4 years ago

Do we need to figure out which version of VxWorks added rint?

kmpeters commented 4 years ago

It looks like VxWorks has had rint in math.h since at least Tornado 2.2.

anjohnson commented 4 years ago

That may depend on the specific target being compiled, some of the more obscure math.h functions like this were provided for m68k but not for PowerPC.

kmpeters commented 4 years ago

I see it in tornado22-ppc/target/h/math.h on APSshare.

anjohnson commented 4 years ago

That doesn't mean it's actually implemented, the target/h/math.h header is generic and contains this comment above that block of declarations:

/* Miscellaneous math functions                   *
 *    Not available on all VxWorks architectures. */
MarkRivers commented 4 years ago

@MarkRivers, can you elaborate on the problem that resulted in commit e3ec0a9?

The problem is that rint was being declared as a global function in smarActMCSMotorDriver.cpp. When I wrote the smarActSCUMotorDriver.cpp I also needed rint, but when I declared it global I got a conflict when linking because that function was multiply defined. Making it static fixed this issue.

Have you successfully built motorSmarAct for VxWorks since that commit?

No, I had not tried building on vxWorks. I just did that, and got the same error you did. Sorry about that.

kmpeters commented 4 years ago

No worries. I failed to do the necessary test builds during my rush to release R7-2, which would have caught all of the build problems. My penance was spending the day preparing R7-2-1.

kmpeters commented 4 years ago

That doesn't mean it's actually implemented, the target/h/math.h header is generic and contains this comment above that block of declarations:

/* Miscellaneous math functions                   *
 *    Not available on all VxWorks architectures. */

@anjohnson, is there a way to tell if a version of VxWorks includes an implementation of rint at compile time? Does it depend on the decisions of the person preparing the board support packages?

MarkRivers commented 4 years ago

I got Appveyor builds configured in asyn to do CI on Windows (Visual Studio and mingw). It's not hard, and would probably be worth doing in motor (and all synApps modules).

kmpeters commented 4 years ago

I'll check out asyn's appveyor config. I'd like to have CI for all the motor driver modules, so we don't need to wait until the motor submodules are updated to find a problem, but I haven't had a chance to do that yet.

anjohnson commented 4 years ago

is there a way to tell if a version of VxWorks includes an implementation of rint at compile time? Does it depend on the decisions of the person preparing the board support packages?

No, it was a CPU_FAMILY thing; some of the math functions that were implemented for the 68k didn't have equivalent versions written for the PowerPC or other CPU families. I just looked in the VxWorks-6.9 sources and build system though, and it seems that rint() may not be available for MIPS builds, but it is there for the PowerPC.