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
Link with -Bsymbolic to make sure we use the local copy of houdini #32
Conversation
I think we actually want |
That would work as well, yes, so long as the symbol(s) that ruby needs to lookup when loading the module are still visible with |
Yes, that works so long as you also add |
Yeah exactly |
Note the visibility trick broke with rbx2. Would be nice to find a way to do and still stay compatible. /cc vmg/rinku#29 Also I've never heard of |
Well it adds |
I'm afraid this is worryingly not portable. The right way to go about this would be to hide the conflicting Houdini calls using |
Really? Surely the the attributes are the non-portable thing and what you apply them to doesn't matter so much? or are you saying there are platforms where more than the main init routine needs to be exposed to ruby for a module to work? In any case I don't really mind how it's fixed, but it would be nice to be able to load both gems at the same time ;-) |
The attributes are a GCC extension, but an extension that works across all platforms.
Yes, that would be Rubinius. Maybe there is a way to export the RBX c extension identifier, but I'm not sure of how. Let me look into it. |
Well the easy way to add the attributes to just the houdini routines is probably to add pragmas around the houdini code: #pragma GCC visibility push(hidden)
...
#pragma GCC visibility pop which should also avoid conflicts with non-gcc compilers which will likely ignore, or at most warn about, the pragma. |
I just got rubinius/rubinius#2302 merged, which means that the visibility trick with |
This avoids conflicts with other gems that may have some of the same symbols, such as redcarpet which also uses houdini.
Done. Also opened vmg/redcarpet#229 to make the same change to redcarpet. |
Brilliant. Thank you so much, Tom. |
Link with -Bsymbolic to make sure we use the local copy of houdini
If
escape_utils
is used with another gem (likeredcarpet
) that also has a copy of houdini inside then the dynamic linker can wind up using the wrong version of the houdini routines.Adding
-Bsymbolic
to the linker flags tells the linker to prefer the local version when resolving symbols.I assume this will actually need some guarding so that it only happens on ELF systems using the
binutils
linker but I have no idea how to achieve that...