sdformat icon indicating copy to clipboard operation
sdformat copied to clipboard

sdformat install not relocatable: sdf::findFile searches original install location

Open osrf-migration opened this issue 7 years ago • 5 comments

Original report (archived issue) by Steve Peters (Bitbucket: Steven Peters, GitHub: scpeters).


As reported here: https://github.com/osrf/homebrew-simulation/issues/479

The issue is that the install path searched by sdf::findFile is the install location at compile time:

  • https://github.com/osrf/sdformat/blob/f3ab32d891e619861c513a86e9c10f72cac480bf/src/SDF.cc#L90:103
  • https://github.com/osrf/sdformat/blob/f3ab32d891e619861c513a86e9c10f72cac480bf/cmake/sdf_config.h.in#L30:31

We would need to change the logic of sdf::findFile to make it fully relocatable.

osrf-migration avatar Sep 04 '18 07:09 osrf-migration

Original comment by Jeongseok Lee (Bitbucket: jlee02, GitHub: jslee02).


DART also had the same issue and adopted the workaround of using the environment variable, which I believe sdformat already does. One possible solution I can think of now is searching typical install locations (like find_package does), which are platform dependent.

osrf-migration avatar Sep 04 '18 07:09 osrf-migration

Original comment by Steve Peters (Bitbucket: Steven Peters, GitHub: scpeters).


Yes, SDF already checks the SDF_PATH environment variable:

  • https://github.com/osrf/sdformat/blob/f3ab32d891e619861c513a86e9c10f72cac480bf/src/SDF.cc#L105:120

but it does take an extra step to set that.

osrf-migration avatar Sep 04 '18 18:09 osrf-migration

Original comment by Silvio Traversaro (Bitbucket: traversaro).


Relevant issue (I was not finding it anymore, so I think it is useful to link it here): https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/issues/141/embed-sdf-xml-files-into-library (#141) .

osrf-migration avatar Sep 13 '18 10:09 osrf-migration

xref: https://github.com/gazebosim/gz-sim/issues/626#issuecomment-1681348298

traversaro avatar Aug 31 '23 07:08 traversaro

I guess this was fixed by https://github.com/gazebosim/sdformat/pull/1414 and explicitly enabling the GZ_ENABLE_RELOCATABLE_INSTALL option. The original issue mentioned homebrew, where I think relocatable install is not supported, but I am not sure if this is relevant or we can just close the issue.

traversaro avatar Sep 10 '25 10:09 traversaro