开发者

AIX dynamic linking

开发者 https://www.devze.com 2023-01-14 19:31 出处:网络
I\'m working on porting a library onto AIX. It works on Solaris, Windows and Linux but AIX is giving me headaches. I\'m at a point where it builds and runs but I have an issue with some of the librari

I'm working on porting a library onto AIX. It works on Solaris, Windows and Linux but AIX is giving me headaches. I'm at a point where it builds and runs but I have an issue with some of the libraries it's linking in. Ideally I want to be able to ship a library that just requires the c runtime to be available with no other dependencies. At the moment I'm having a problem with libpthread which I can see is a symlink to an AIX specific threading library. My issue is this: If I don't link pthread (I don't seem to need to on Solaris for the same code base) then I get undefined symbols. That's fine I am using pthreads. If I link it in then it works fine, 开发者_C百科except that any calling application also has to link to pthreads. I don't really understand is why does my calling app, which has no dependency on pthread, need to link against it just because it's calling a library which links to the shared object?

I'm on AIX 6.1 using gcc 4.2.4.

I'd be OK with shipping a library that requires pthreads to be present on the library path (ideally we'd get a static version) but I'm a bit unhappy about shipping a library that places linker rqeuirements on the client.

Any ideas on what I might be doing wrong?


I defeinitely seem to be going in circles. I removed the -shared flag on the linker to resolve an earlier problem and that, of course, makes the library static. So the behaviour is just normal behaviour in that if you depend on a dynamic library from a static one you have to link both into your app. So I've put the shared flag back and now half of my functions are no longer accessible. It does explain the problem I was seeing though.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号