{"action":"created","issue":{"url":"https://api.github.com/repos/irods/irods/issues/3205","repository_url":"https://api.github.com/repos/irods/irods","labels_url":"https://api.github.com/repos/irods/irods/issues/3205/labels{/name}","comments_url":"https://api.github.com/repos/irods/irods/issues/3205/comments","events_url":"https://api.github.com/repos/irods/irods/issues/3205/events","html_url":"https://github.com/irods/irods/issues/3205","id":162421706,"number":3205,"title":"iRODS 4.1.x unusable from RTLD_LOCAL plugins","user":{"login":"jmarshall","id":70921,"avatar_url":"https://avatars.githubusercontent.com/u/70921?v=3","gravatar_id":"","url":"https://api.github.com/users/jmarshall","html_url":"https://github.com/jmarshall","followers_url":"https://api.github.com/users/jmarshall/followers","following_url":"https://api.github.com/users/jmarshall/following{/other_user}","gists_url":"https://api.github.com/users/jmarshall/gists{/gist_id}","starred_url":"https://api.github.com/users/jmarshall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmarshall/subscriptions","organizations_url":"https://api.github.com/users/jmarshall/orgs","repos_url":"https://api.github.com/users/jmarshall/repos","events_url":"https://api.github.com/users/jmarshall/events{/privacy}","received_events_url":"https://api.github.com/users/jmarshall/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-06-27T10:35:09Z","updated_at":"2016-06-29T13:59:11Z","closed_at":null,"body":"[HTSlib](https://github.com/samtools/htslib) uses a plugin mechanism for accessing data via exotic transports such as iRODS, in part so that application code can be unconcerned with such transports' APIs' exotic compilation and linking needs.  Indeed transport libraries like those of iRODS are not linked into either applications or htslib itself, but only into the individual plugins.\r\n\r\nThe plugin mechanism we have designed loads plugins with `dlopen(…, RTLD_NOW | RTLD_LOCAL)`, in part so that different plugins using similar function names and other symbols will not interfere with each other.  In particular, we designed it this way so that during a transition from iRODS 3.3.x to 4.x, our software can load both _hfile_irods3.so_ and _hfile_irods4.so_ plugins and conveniently access data simultaneously in both old and new systems.\r\n\r\nUnfortunately trying to access data via a plugin linked against the 4.1.8 API does not work:\r\n\r\n```sh\r\n$ gcc -shared -Wl,-E -pthread -L/usr/lib/irods/externals -o hfile_irods.so hfile_irods.o -lRodsAPIs -lirods_client_api /usr/lib/irods/externals/libjansson.a -lboost_program_options -lboost_filesystem -lboost_chrono -lboost_regex -lboost_thread -lboost_system -lssl -lcrypto -lrt -lstdc++\r\n# …\r\n$ htsfile irods:example.bam\r\nERROR: [-]\tiRODS/lib/core/src/sockComm.cpp:1300:sendStartupPack :  status [PLUGIN_ERROR]  errno [] -- message []\r\n\t[-]\tiRODS/lib/core/src/sockComm.cpp:1376:sendRodsMsg :  status [PLUGIN_ERROR]  errno [] -- message [failed to resolve network interface]\r\n\t\t[-]\tiRODS/lib/core/src/irods_tcp_object.cpp:95:resolve :  status [PLUGIN_ERROR]  errno [] -- message []\r\n\t\t\t[-]\tiRODS/lib/core/src/irods_network_manager.cpp:93:init_from_type :  status [PLUGIN_ERROR]  errno [] -- message [Failed to load network plugin]\r\n\t\t\t\t[-]\tiRODS/lib/core/src/irods_network_manager.cpp:74:load_network_plugin :  status [PLUGIN_ERROR]  errno [] -- message []\r\n\t\t\t\t\t[-]\tiRODS/lib/core/include/irods_load_plugin.hpp:194:load_plugin :  status [PLUGIN_ERROR]  errno [] -- message [failed to open shared object file [/opt/renci/icommands/plugins/network/libtcp.so] :: dlerror: is [/opt/renci/icommands/plugins/network/libtcp.so: undefined symbol: _ZTIN5irods10tcp_objectE]]\r\n```\r\n\r\nIf we change [HTSlib to use RTLD_GLOBAL instead](https://github.com/samtools/htslib/blob/develop/plugin.c#L132), this error disappears (thus confirming that the cause is lack of symbol availability from the RTLD_LOCAL _hfile_irods.so_), but as noted redesigning the plugin mechanism in this way is undesirable.\r\n\r\nAlternatively, if iRODS plugins like _libtcp.so_ were themselves linked against the iRODS shared libraries they need, this problem would disappear, and _libtcp.so_ and its ilk would be usable from main code and from RTLD_LOCAL and RTLD_GLOBAL plugins alike."},"comment":{"url":"https://api.github.com/repos/irods/irods/issues/comments/229364141","html_url":"https://github.com/irods/irods/issues/3205#issuecomment-229364141","issue_url":"https://api.github.com/repos/irods/irods/issues/3205","id":229364141,"user":{"login":"jasoncoposky","id":1790140,"avatar_url":"https://avatars.githubusercontent.com/u/1790140?v=3","gravatar_id":"","url":"https://api.github.com/users/jasoncoposky","html_url":"https://github.com/jasoncoposky","followers_url":"https://api.github.com/users/jasoncoposky/followers","following_url":"https://api.github.com/users/jasoncoposky/following{/other_user}","gists_url":"https://api.github.com/users/jasoncoposky/gists{/gist_id}","starred_url":"https://api.github.com/users/jasoncoposky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasoncoposky/subscriptions","organizations_url":"https://api.github.com/users/jasoncoposky/orgs","repos_url":"https://api.github.com/users/jasoncoposky/repos","events_url":"https://api.github.com/users/jasoncoposky/events{/privacy}","received_events_url":"https://api.github.com/users/jasoncoposky/received_events","type":"User","site_admin":false},"created_at":"2016-06-29T13:59:11Z","updated_at":"2016-06-29T13:59:11Z","body":"The move to shared objects is handled in the 4.2 release with #2308\r\n\r\nAlso, i noted that you are linking against libRodsAPIs.  We have broken the libraries out into smaller components for 4.x as demonstrated by the netcdf repository which may solve your runtime linking issue:\r\n\r\nhttps://github.com/irods/irods_netcdf/blob/master/icommands/Makefile#L39\r\n\r\n"}}
{"actor":{"display_login":"jasoncoposky"}}