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

osgDB hardcodes path to build machine #939

Open
skelly-energid opened this issue Mar 31, 2020 · 2 comments
Open

osgDB hardcodes path to build machine #939

skelly-energid opened this issue Mar 31, 2020 · 2 comments

Comments

@skelly-energid
Copy link

The FileUtils.cpp function appendInstallationLibraryFilePaths returns OSG_DEFAULT_LIBRARY_PATH, which is set in cmake:

ADD_DEFINITIONS(-DOSG_DEFAULT_LIBRARY_PATH=\"${CMAKE_INSTALL_PREFIX}/${OSG_INSTALL_LIBDIR}/${OSG_PLUGINS}\")

The ${CMAKE_INSTALL_PREFIX} is hardcoded, meaning that the path on the build machine is searched for plugins. That is inappropriate. Instead, osgDB should search relative to the osgDB library itself.

@skelly-energid
Copy link
Author

For reference, appendInstallationLibraryFilePaths can be patched like so to find the plugin relative to the osgDB binary:

    Dl_info info;
    int result = dladdr(reinterpret_cast<void *>(&osgDB::findFileInDirectory), &info);
    if (result > 0 && info.dli_fname) {
        filepath.push_back(dirname(const_cast<char*>(info.dli_fname)));
    }

An implementation for Windows/Apple is also possible, but left as an excercise :).

@openscenegraph
Copy link
Owner

openscenegraph commented Apr 1, 2020 via email

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

No branches or pull requests

2 participants