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

Some libraries and executables could be placed in the wrong path during the build process #784

Closed
sgiraz opened this issue Mar 3, 2022 · 8 comments · Fixed by #790
Closed
Assignees

Comments

@sgiraz
Copy link
Contributor

sgiraz commented Mar 3, 2022

Bug description

SW Configuration:

  • Windows 11
  • Visual Studio Code 1.64.2 (with CMake and C++ extensions installed)
  • Vcpkg package management program version 2022-02-24-7efe7f2b04912a7d674f86a406f9f2711c0221c6 (with robotology dependencies manually installed)
  • Yarp@master version 3.6.102+20220302.2+git01b3de525
  • icub-firmware-shared@devel 1.24.0
  • icub-main@devel version 1.24.0
    • ENABLE_icubmod_embObjMotionControl --> ON
    • ICUB_USE_icub_firmware_shared --> ON
    • ENABLE_icubmod_parametricCalibratorEth --> ON
  • User Environment Variables:
    • YARP_DATA_DIRS=C:\dev\yarp\build\share\yarp;C:\dev\icub-main\build\share\iCub
    • YARP_DIR=C:\dev\yarp\build
    • YCM_DIR=C:\dev\ycm\build
    • Path=\C:...;C:\dev\yarp\build\bin\Debug;C:\dev\icub-main\build\bin\Debug;C:\dev\icub-firmware-shared\build\eth\Debug

⚠️ When I open this issue the verion of yarp, icub-main, icub-firmware-shared mentioned above are not merged yet in the official repository (you can find them in my forks).


Description:
Trying to run the yarprobotinterface the following error stops the execution:

[ERROR] |yarp.os.YarpPluginSettings| Error while opening C:/dev/icub-main/build/lib/iCub/Debug/embObjMotionControld.dll:
  The specified module could not be found.

[WARNING] |yarp.os.YarpPluginSettings| Cannot load plugin from shared library (embObjMotionControl)
[WARNING] |yarp.os.YarpPluginSettings| (The specified module could not be found.

Thanks to @traversaro, using the Dependencies tool on embObjMotionControld.dll, I spotted that among all its dependencies the ethResourcesd.dll cannot be found (see the image below)

image

After the building process the ethResourcesd.dll library should be in C:\dev\icub-main\build\bin\Debug folder, but it was in C:\dev\icub-main\build\lib\Debug folder.


How to solve
In my case, the fix has been the introduction of the following variable inside the main CMakeLists.txt:

set_property(GLOBAL PROPERTY ICUB_INCLUDE_DIRS)
set_property(GLOBAL PROPERTY ICUB_TARGETS)
set_property(GLOBAL PROPERTY ICUB_DEPENDENCIES_FLAGS) # this is populated iCubFindDependencies.cmake

+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}")
+set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
+set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")

🔍 After a quick discussion with @pattacini, the problem seems to be inside the CMakeLists.txt of the ethResources project, which uses an old macro that should be updated with the new one (here is an example from iKin project).

Steps to reproduce

  1. Install the tools and build the projects as written in the description above
  2. Open a 2 Terminals windows/tab
  3. Run
  • Terminal 1: yarpserver
  • Terminal 2: yarprobotinterface
  1. Looking at the log of the yarprobotinterface, it should be as the following:
Click to expand
  C:\dev\aea2-setup-with-friction>yarprobotinterface
[DEBUG] Reading file C:\dev\aea2-setup-with-friction\.\head-face.xml
[DEBUG] yarprobotinterface: using xml parser for DTD v3.x
[DEBUG] Reading file C:\dev\aea2-setup-with-friction\.\head-face.xml
[DEBUG] Preprocessor complete in:  0.0037751 s
[INFO] |yarp.os.Port|/icub/yarprobotinterface| Port /icub/yarprobotinterface active at tcp://10.0.1.104:10002/
[INFO] startup phase starting...
[INFO] Opening device head-eb21-j2_5-mc with parameters [("robotName" = "icub"), ("GENERAL" [group] = "(skipCalibration false) (useRawEncoderData false) (useLimitedPWM false) (verbose false)"), ("PC104" [group] = "(PC104IpAddress 10.0.1.104) (PC104IpPort 12345) (PC104TXrate 1) (PC104RXrate 5)"), ("ETH_BOARD" [group] = "(ETH_BOARD_PROPERTIES (IpAddress 10.0.1.1) (IpPort 12345) (Type mc4plus) (maxSizeRXpacket 768) (maxSizeROP 384)) (ETH_BOARD_SETTINGS (Name "head-eb21-j2_5") (RUNNINGMODE (period 1000) (maxTimeOfRXactivity 400) (maxTimeOfDOactivity 300) (maxTimeOfTXactivity 300) (TXrateOfRegularROPs 5))) (ETH_BOARD_ACTIONS (MONITOR_ITS_PRESENCE (enabled true) (timeout 0.020) (periodOfMissingReport 60.0)))"), ("GENERAL" [group] = "(MotioncontrolVersion 6) (Joints 1) (AxisMap 0) (AxisName "neck_yaw") (AxisType "revolute") (Encoder 182.044) (fullscalePWM 3360) (ampsToSensor 1000.0) (Gearbox_M2J 100) (Gearbox_E2J 1) (useMotorSpeedFbk 1) (MotorType "DC") (Verbose 0)"), ("LIMITS" [group] = "(hardwareJntPosMin -180) (hardwareJntPosMax 180) (rotorPosMin 0) (rotorPosMax 0)"), ("COUPLINGS" [group] = "(matrixJ2M 1.000 0.000 0.000 0.000 0.000 1.000 0.000 0.000 0.000 0.000 1.000 0.000 0.000 0.000 0.000 1.000) (matrixM2J 1.000 0.000 0.000 0.000 0.000 1.000 0.000 0.000 0.000 0.000 1.000 0.000 0.000 0.000 0.000 1.000) (matrixE2J 1.000 0.000 0.000 0.000 0.000 0.000 0.000 1.000 0.000 0.000 0.000 0.000 0.000 0.000 1.000 0.000 0.000 0.000 0.000 0.000 0.000 1.000 0.000 0.000)"), ("JOINTSET_CFG" [group] = "(numberofsets 1) (JOINTSET_0 (listofjoints 0) (constraint none) (param1 0) (param2 0))"), ("SERVICE" [group] = "(type eomn_serv_MC_mc4plus) (PROPERTIES (ETHBOARD (type mc4plus)) (JOINTMAPPING (ACTUATOR (type pwm) (port CONN:P4)) (ENCODER1 (type aea) (port CONN:P10) (position atjoint) (resolution 4096) (tolerance 0.703)) (ENCODER2 (type qenc) (port CONN:P4) (position atmotor) (resolution 2048) (tolerance 0))))"), ("LIMITS" [group] = "(jntPosMin -180) (jntPosMax +180) (jntVelMax 1000) (motorOverloadCurrents 2000) (motorNominalCurrents 700) (motorPeakCurrents 1500) (motorPwmLimit 3360)"), ("TIMEOUTS" [group] = "(velocity 100)"), ("IMPEDANCE" [group] = "(stiffness 0.0) (damping 0.0)"), ("CONTROLS" [group] = "(positionControl POS_PID_DEFAULT) (velocityControl POS_PID_DEFAULT) (mixedControl POS_PID_DEFAULT) (torqueControl TRQ_PID_OUTPUT_CURR) (currentPid none) (speedPid none)"), ("POS_PID_DEFAULT" [group] = "(controlLaw minjerk) (outputType pwm) (fbkControlUnits metric_units) (outputControlUnits machine_units) (kp -772.9) (ki -63.4) (kd 0) (maxOutput 3360) (maxInt 3360) (stictionUp 94) (stictionDown 95) (kff 0)"), ("TRQ_PID_OUTPUT_CURR" [group] = "(controlLaw torque) (outputType current) (fbkControlUnits metric_units) (outputControlUnits machine_units) (kp 0) (kd 0) (ki 0) (maxOutput 2500) (maxInt 200) (ko 0) (stictionUp 0) (stictionDown 0) (viscousPos 96) (viscousNeg 97) (coulombPos 98) (coulombNeg 99) (kff 1) (kbemf 0.00) (filterType 0) (ktau 50.0)"), ("OTHER_CONTROL_PARAMETERS" [group] = "(deadZone 0.0495)")]
[ERROR] |yarp.os.YarpPluginSettings| Error while opening C:/dev/icub-main/build/lib/iCub/Debug/embObjMotionControld.dll:
  The specified module could not be found.

[WARNING] |yarp.os.YarpPluginSettings| Cannot load plugin from shared library (embObjMotionControl)
[WARNING] |yarp.os.YarpPluginSettings| (The specified module could not be found.

The specified module could not be found.

...

[ERROR] Cannot run detach action on device head-mc_wrapper
[INFO] All actions for action level 5 of shutdown phase started. Waiting for unfinished actions.
[INFO] All actions for action level 5 of shutdown phase finished.
[WARNING] There was some problem running actions for shutdown phase . Please check the log and your configuration
[INFO] Closing device head-calibrator
[INFO] Closing device head-mc_wrapper
[INFO] Closing device head-eb21-j2_5-mc
[INFO] shutdown phase finished.
[ERROR] Error in shutdown phase... see previous messages for more info
[INFO] |yarp.os.RFModule| RFModule failed to open.

Expected behavior

When we run the yarprobotinterface the output should be the following:

Click to expand
C:\dev\aea2-setup-with-friction>yarprobotinterface
[DEBUG] Reading file C:\dev\aea2-setup-with-friction\.\head-face.xml
[DEBUG] yarprobotinterface: using xml parser for DTD v3.x
[DEBUG] Reading file C:\dev\aea2-setup-with-friction\.\head-face.xml
[DEBUG] Preprocessor complete in:  0.0035485 s
[INFO] |yarp.os.Port|/icub/yarprobotinterface| Port /icub/yarprobotinterface active at tcp://10.0.1.104:10002/
[INFO] startup phase starting...
[INFO] Opening device head-eb21-j2_5-mc with parameters [("robotName" = "icub"), ("GENERAL" [group] = "(skipCalibration false) (useRawEncoderData false) (useLimitedPWM false) (verbose false)"), ("PC104" [group] = "(PC104IpAddress 10.0.1.104) (PC104IpPort 12345) (PC104TXrate 1) (PC104RXrate 5)"), ("ETH_BOARD" [group] = "(ETH_BOARD_PROPERTIES (IpAddress 10.0.1.1) (IpPort 12345) (Type mc4plus) (maxSizeRXpacket 768) (maxSizeROP 384)) (ETH_BOARD_SETTINGS (Name "head-eb21-j2_5") (RUNNINGMODE (period 1000) (maxTimeOfRXactivity 400) (maxTimeOfDOactivity 300) (maxTimeOfTXactivity 300) (TXrateOfRegularROPs 5))) (ETH_BOARD_ACTIONS (MONITOR_ITS_PRESENCE (enabled true) (timeout 0.020) (periodOfMissingReport 60.0)))"), ("GENERAL" [group] = "(MotioncontrolVersion 6) (Joints 1) (AxisMap 0) (AxisName "neck_yaw") (AxisType "revolute") (Encoder 182.044) (fullscalePWM 3360) (ampsToSensor 1000.0) (Gearbox_M2J 100) (Gearbox_E2J 1) (useMotorSpeedFbk 1) (MotorType "DC") (Verbose 0)"), ("LIMITS" [group] = "(hardwareJntPosMin -180) (hardwareJntPosMax 180) (rotorPosMin 0) (rotorPosMax 0)"), ("COUPLINGS" [group] = "(matrixJ2M 1.000 0.000 0.000 0.000 0.000 1.000 0.000 0.000 0.000 0.000 1.000 0.000 0.000 0.000 0.000 1.000) (matrixM2J 1.000 0.000 0.000 0.000 0.000 1.000 0.000 0.000 0.000 0.000 1.000 0.000 0.000 0.000 0.000 1.000) (matrixE2J 1.000 0.000 0.000 0.000 0.000 0.000 0.000 1.000 0.000 0.000 0.000 0.000 0.000 0.000 1.000 0.000 0.000 0.000 0.000 0.000 0.000 1.000 0.000 0.000)"), ("JOINTSET_CFG" [group] = "(numberofsets 1) (JOINTSET_0 (listofjoints 0) (constraint none) (param1 0) (param2 0))"), ("SERVICE" [group] = "(type eomn_serv_MC_mc4plus) (PROPERTIES (ETHBOARD (type mc4plus)) (JOINTMAPPING (ACTUATOR (type pwm) (port CONN:P4)) (ENCODER1 (type aea) (port CONN:P10) (position atjoint) (resolution 4096) (tolerance 0.703)) (ENCODER2 (type qenc) (port CONN:P4) (position atmotor) (resolution 2048) (tolerance 0))))"), ("LIMITS" [group] = "(jntPosMin -180) (jntPosMax +180) (jntVelMax 1000) (motorOverloadCurrents 2000) (motorNominalCurrents 700) (motorPeakCurrents 1500) (motorPwmLimit 3360)"), ("TIMEOUTS" [group] = "(velocity 100)"), ("IMPEDANCE" [group] = "(stiffness 0.0) (damping 0.0)"), ("CONTROLS" [group] = "(positionControl POS_PID_DEFAULT) (velocityControl POS_PID_DEFAULT) (mixedControl POS_PID_DEFAULT) (torqueControl TRQ_PID_OUTPUT_CURR) (currentPid none) (speedPid none)"), ("POS_PID_DEFAULT" [group] = "(controlLaw minjerk) (outputType pwm) (fbkControlUnits metric_units) (outputControlUnits machine_units) (kp -772.9) (ki -63.4) (kd 0) (maxOutput 3360) (maxInt 3360) (stictionUp 94) (stictionDown 95) (kff 0)"), ("TRQ_PID_OUTPUT_CURR" [group] = "(controlLaw torque) (outputType current) (fbkControlUnits metric_units) (outputControlUnits machine_units) (kp 0) (kd 0) (ki 0) (maxOutput 2500) (maxInt 200) (ko 0) (stictionUp 0) (stictionDown 0) (viscousPos 96) (viscousNeg 97) (coulombPos 98) (coulombNeg 99) (kff 1) (kbemf 0.00) (filterType 0) (ktau 50.0)"), ("OTHER_CONTROL_PARAMETERS" [group] = "(deadZone 0.0495)")]
[DEBUG] |yarp.dev.PolyDriver|head-eb21-j2_5-mc| Parameters are (CONTROLS (positionControl POS_PID_DEFAULT) (velocityControl POS_PID_DEFAULT) (mixedControl POS_PID_DEFAULT) (torqueControl TRQ_PID_OUTPUT_CURR) (currentPid none) (speedPid none)) (COUPLINGS (matrixJ2M 1.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 1.0) (matrixM2J 1.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 1.0) (matrixE2J 1.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0)) (ETH_BOARD (ETH_BOARD_PROPERTIES (IpAddress "10.0.1.1") (IpPort 12345) (Type mc4plus) (maxSizeRXpacket 768) (maxSizeROP 384)) (ETH_BOARD_SETTINGS (Name head-eb21-j2_5) (RUNNINGMODE (period 1000) (maxTimeOfRXactivity 400) (maxTimeOfDOactivity 300) (maxTimeOfTXactivity 300) (TXrateOfRegularROPs 5))) (ETH_BOARD_ACTIONS (MONITOR_ITS_PRESENCE (enabled true) (timeout 0.02) (periodOfMissingReport 60.0)))) (GENERAL (skipCalibration false) (useRawEncoderData false) (useLimitedPWM false) (verbose false) (MotioncontrolVersion 6) (Joints 1) (AxisMap 0) (AxisName neck_yaw) (AxisType revolute) (Encoder 182.04400000000001) (fullscalePWM 3360) (ampsToSensor 1000.0) (Gearbox_M2J 100) (Gearbox_E2J 1) (useMotorSpeedFbk 1) (MotorType DC) (Verbose 0)) (IMPEDANCE (stiffness 0.0) (damping 0.0)) (JOINTSET_CFG (numberofsets 1) (JOINTSET_0 (listofjoints 0) (constraint none) (param1 0) (param2 0))) (LIMITS (hardwareJntPosMin -180) (hardwareJntPosMax 180) (rotorPosMin 0) (rotorPosMax 0) (jntPosMin -180) (jntPosMax 180) (jntVelMax 1000) (motorOverloadCurrents 2000) (motorNominalCurrents 700) (motorPeakCurrents 1500) (motorPwmLimit 3360)) (OTHER_CONTROL_PARAMETERS (deadZone 0.049500000000000002)) (PC104 (PC104IpAddress "10.0.1.104") (PC104IpPort 12345) (PC104TXrate 1) (PC104RXrate 5)) (POS_PID_DEFAULT (controlLaw minjerk) (outputType pwm) (fbkControlUnits metric_units) (outputControlUnits machine_units) (kp -772.89999999999998) (ki -63.399999999999999) (kd 0) (maxOutput 3360) (maxInt 3360) (stictionUp 94) (stictionDown 95) (kff 0)) (SERVICE (type eomn_serv_MC_mc4plus) (PROPERTIES (ETHBOARD (type mc4plus)) (JOINTMAPPING (ACTUATOR (type pwm) (port "CONN:P4")) (ENCODER1 (type aea) (port "CONN:P10") (position atjoint) (resolution 4096) (tolerance 0.70299999999999996)) (ENCODER2 (type qenc) (port "CONN:P4") (position atmotor) (resolution 2048) (tolerance 0))))) (TIMEOUTS (velocity 100)) (TRQ_PID_OUTPUT_CURR (controlLaw torque) (outputType current) (fbkControlUnits metric_units) (outputControlUnits machine_units) (kp 0) (kd 0) (ki 0) (maxOutput 2500) (maxInt 200) (ko 0) (stictionUp 0) (stictionDown 0) (viscousPos 96) (viscousNeg 97) (coulombPos 98) (coulombNeg 99) (kff 1) (kbemf 0.0) (filterType 0) (ktau 50.0)) (device embObjMotionControl) (id head-eb21-j2_5-mc) (robotName icub)
[DEBUG] eth::parser::print(pc104Data) for PC104:
[DEBUG] PC104/PC104IpAddress:PC104IpPort =  10.0.1.104:12345
[DEBUG] PC104/PC104TXrate =  1
[DEBUG] PC104/PC104RXrate =  5
[DEBUG] EthSender is a PeriodicThread with txrate = 1 ms
[DEBUG] EthReceiver is a PeriodicThread with rxrate = 5 ms
[WARNING] in EthReceiver::config() the config socket has queue size =  1048576 ; you request ETHRECEIVER_BUFFER_SIZE=
[DEBUG] eth::parser::print(boardData) for BOARD head-eb21-j2_5
[DEBUG] ETH_BOARD/ETH_BOARD_PROPERTIES:
[DEBUG] ETH_BOARD/ETH_BOARD_PROPERTIES/IpAddress =  10.0.1.1
[DEBUG] ETH_BOARD/ETH_BOARD_PROPERTIES/IpPort =  12345
[DEBUG] ETH_BOARD/ETH_BOARD_PROPERTIES/Type =  mc4plus
[DEBUG] ETH_BOARD/ETH_BOARD_PROPERTIES/maxSizeRXpacket =  768
[DEBUG] ETH_BOARD/ETH_BOARD_PROPERTIES/maxSizeROP =  384
[DEBUG] ETH_BOARD/ETH_BOARD_SETTINGS:
[DEBUG] ETH_BOARD/ETH_BOARD_SETTINGS/Name =  head-eb21-j2_5
[DEBUG] ETH_BOARD/ETH_BOARD_SETTINGS/RUNNINGMODE/(period, maxTimeOfRXactivity, maxTimeOfDOactivity, maxTimeOfTXactivity, TXrateOfRegularROPs) =  1000 400 300 300 5
[DEBUG] ETH_BOARD/ETH_BOARD_ACTIONS/MONITOR_ITS_PRESENCE
[DEBUG] ETH_BOARD/ETH_BOARD_ACTIONS/MONITOR_ITS_PRESENCE/(enabled, timeout, periodOfMissingReport) =  true 0.02 60
[DEBUG] eth::EthMonitorPresence::config(): monitoring of presence is ON for BOARD 10.0.1.1 (head-eb21-j2_5) with timeout = 0.02 sec and period of missing report = 60 sec        
[DEBUG] TheEthManager::requestResource2(): has just succesfully created a new EthResource for board of type mc4plus with IP =  10.0.1.1
[INFO] ServiceParser::parse_encoder_port(): ===========================>  eomc_enc_aea
[INFO] ServiceParser::parse_encoder_port(): ===========================>  eomc_enc_qenc
[INFO]  from BOARD 10.0.1.1 (░Ä≥ Æ☺), src LOCAL, adr 0, time 27958s 363m 454u: (code 0x00000034, par16 0x0001 par64 0x0000000000000017) -> SYS: the board has detected a restart of the remote transceiver because the rx ropframe sequence number is 1. In par64 there is the expected number. + .
[DEBUG] EthResource::verifyBoardPresence() found BOARD head-eb21-j2_5 with IP 10.0.1.1 after 0.0028385 seconds
[DEBUG] EthResource::verifyBoardTransceiver() has validated the transceiver of BOARD head-eb21-j2_5 with IP 10.0.1.1
[DEBUG] EthResource::cleanBoardBehaviour() has cleaned the application in BOARD head-eb21-j2_5 with IP 10.0.1.1 : config mode + cleared all its regulars
[DEBUG] EthResource::setTimingOfRunningCycle() for BOARD head-eb21-j2_5 with IP 10.0.1.1 has succesfully set: cycletime = 1000 usec, RX DO TX = ( 400 300 300 ) usec and TX rate = 5  every cycle
[INFO] EthResource::askBoardVersion() found BOARD head-eb21-j2_5 @ IP 10.0.1.1 of type mc4plus with FW = ver 3.48 built on 2022 Mar 02 21:11
[DEBUG]  from BOARD 10.0.1.1 (░Ä≥ Æ☺), src LOCAL, adr 0, time 27958s 406m 290u: (code 0x05000015, par16 0x1000 par64 0x0000000000000000) -> CFG: EOtheEncoderReader can be correctly configured. p16&0xf000: number of joint; primary encs: failure mask in p16&0x000f and errorcodes in p64&0x0000ffff; secondary encs: failure mask in p16&0x00f0 and errorcodes in p64&0xffff0000 + .
[DEBUG] embObjMotionControl:serviceVerifyActivate OK!
[DEBUG]  from BOARD 10.0.1.1 (░Ä≥ Æ☺), src LOCAL, adr 0, time 27958s 406m 567u: (code 0x05000013, par16 0x0000 par64 0x0000000000000000) -> CFG: EOtheMotionController can correctly configure mc4plus-based motion. more info will follow + .
[INFO] |yarp.dev.PolyDriver|head-eb21-j2_5-mc| Created device <embObjMotionControl>. See C++ class yarp::dev::embObjMotionControl for documentation.

...

[DEBUG] HeadV3_Calibrator : set 1 : Calibration ended, going to zero!
[DEBUG] HeadV3_Calibrator : Sending positionMove to joint 0  (desired pos:  0 desired speed:  10  )
[DEBUG] HeadV3_Calibrator: checkGoneToZeroThreshold: joint: 0 curr: 0.000 des: 0.000 -> delta: 0.000 threshold: 90.000 output: 0.000 mode: pos
[DEBUG] HeadV3_Calibrator: checkGoneToZeroThreshold: joint: 0 completed with delta: 0.000 over: 90.000
[DEBUG] HeadV3_Calibrator : set 1 : Reached zero position!
[DEBUG] head-calibrator finished calibration of device head-mc_wrapper
[INFO] All actions for action level 10 of startup phase finished.
[INFO] startup phase finished.
[INFO] run phase starting...
[DEBUG] yarprobotinterface running happily

Example repository

No response

Additional context

No response

@pattacini
Copy link
Member

pattacini commented Mar 3, 2022

Very nice bug report @sgiraz, thanks!

The old macro icub_export_library is also used in a few other places, namely:

  • embObjLib
  • ethLoaderLib
  • canLoaderLib
  • strainCalibLib

We should therefore address the fix extensively.

@pattacini pattacini self-assigned this Mar 3, 2022
@pattacini
Copy link
Member

cc @marcoaccame

@sgiraz
Copy link
Contributor Author

sgiraz commented Mar 18, 2022

Thanks to the suggestions provided by @traversaro and confirmations by @Nicogene the solution for the issue reported in here relies in the following 3 instructions applied on each libraries mentioned above by @pattacini:

+set_target_properties(${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}")
+set_target_properties(${PROJECT_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
+set_target_properties(${PROJECT_NAME} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")

Talking with @Nicogene, we think that unless these libraries are necessary for other repositories, we could leave the old macros.
Otherwise, we can change them as suggested and then we have to test the installation on the real robot.

@pattacini
Copy link
Member

pattacini commented Mar 18, 2022

The solution proposed in #784 (comment) seems to be exactly the same as that reported in the OP with the difference that it acts at the level of the single libraries.

My point was:

  • Why do all the other libraries (e.g., ctrlLib, iKin...) build flawlessly as intended (meaning they put the products in the expected paths) without resorting to this change?
  • Is there any particular difference among these libraries and the ones that do not behave correctly?

Can we answer these questions?

@traversaro
Copy link
Member

traversaro commented Mar 18, 2022

Why do all the other libraries (e.g., ctrlLib, iKin...) build flawlessly as intended (meaning they put the products in the expected paths) without resorting to this change?

From what I understand, the question is rather why all other libraries (e.g., ctrlLib, iKin...) do not put their products as intended, as I do not understand why they should put their product there, even if indeed they do. :D To clarify, by default a CMakeLists.txt in ${CMAKE_SOURCE_DIR}/src/libraries/iKin should place its binaries in ${CMAKE_BINARY_DIR}/src/libraries/iKin unless someone changes all those target properties, while for some reason in this case all those libraries place its binaries in ${CMAKE_BINARY_DIR}/lib.

@pattacini
Copy link
Member

Yep, investigating the reason for this difference was my original aim. Applying the patch lightheartedly will quickly fix this particular problem but will potentially hide some others.

@Nicogene
Copy link
Member

The solution proposed in #784 (comment) seems to be exactly the same as that reported in the OP with the difference that it acts at the level of the single libraries.

My point was:

* Why do all the other libraries (e.g., `ctrlLib`, `iKin`...) build flawlessly as intended (meaning they put the products in the expected paths) without resorting to this change?

* Is there any particular difference among these libraries and the ones that do not behave correctly?

Can we answer these questions?

I had the same doubts, the libraries of the embobj part have a quite old cmake structure (~ 9/12 years) and I hope that here #652 I did not change something unintentionally. I probably forgot to test the case of using the build directory, that is probably the reason why @sgiraz spotted this problem only now.

while for some reason in this case all those libraries place its binaries in ${CMAKE_BINARY_DIR}/lib.

I thought that was that the default one 🤔 If not, I don't know who is setting ${CMAKE_BINARY_DIR}/lib

@traversaro
Copy link
Member

while for some reason in this case all those libraries place its binaries in ${CMAKE_BINARY_DIR}/lib.

I thought that was that the default one 🤔

Actually no! You can try to compile https://github.com/robotology/how-to-export-cpp-library/ after commenting the three lines https://github.com/robotology/how-to-export-cpp-library/blob/afb21efb655e7b1cc11636c3d42aad9e02fb626f/CMakeLists.txt#L41 and checking where the libraries are placed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants