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

pgrouting module does not link properly on OSX #5

Closed
antonpa opened this Issue Nov 15, 2010 · 1 comment

Comments

Projects
None yet
2 participants
@antonpa
Member

antonpa commented Nov 15, 2010

Postgres modules on OSX should be loadable modules, or bundles, not dynamic libraries. There is a difference on OSX. -bundle is the flag used instead of -dynamiclib, and bundles don't need the install_name or version flags. pgxs also adds -multiply_defined suppress. The standard file extension for a bundle on OSX is the same as a library on linux - .so - but version numbers (if used) are still put before the suffix.

So, the basic link command for OSX would be:

c++ -bundle -multiply_defined suppress -o librouting.so
(plus the object files and extra configured flags)

@antonpa

This comment has been minimized.

Show comment
Hide comment
@antonpa

antonpa Nov 15, 2010

Member

It looks like the bundle option for cmake is MODULE, ie:
ADD_LIBRARY(routing MODULE ...)

Oh, and -bundle_loader is needed so it sees (but doesn't link) symbols in the postgres executable:
-bundle_loader /usr/local/pgsql/bin/postgres
(or wherever postgres is configured to be found)

More notes.

According to the cmake docs, the MODULE option drops back to SHARED on non-darwin platforms, so it doesn't need to be conditionalized in cmakelists.txt.

I was able to insert the extra bundle_loader flag with:
SET_TARGET_PROPERTIES(routing PROPERTIES LINK_FLAGS "-bundle_loader /usr/local/pgsql/bin/postgres")
This would have to be conditionalized on OSX or darwin somehow, I didn't get that far in the cmake docs. It would also need to use the configured/found postgres path.

Member

antonpa commented Nov 15, 2010

It looks like the bundle option for cmake is MODULE, ie:
ADD_LIBRARY(routing MODULE ...)

Oh, and -bundle_loader is needed so it sees (but doesn't link) symbols in the postgres executable:
-bundle_loader /usr/local/pgsql/bin/postgres
(or wherever postgres is configured to be found)

More notes.

According to the cmake docs, the MODULE option drops back to SHARED on non-darwin platforms, so it doesn't need to be conditionalized in cmakelists.txt.

I was able to insert the extra bundle_loader flag with:
SET_TARGET_PROPERTIES(routing PROPERTIES LINK_FLAGS "-bundle_loader /usr/local/pgsql/bin/postgres")
This would have to be conditionalized on OSX or darwin somehow, I didn't get that far in the cmake docs. It would also need to use the configured/found postgres path.

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