将静态库(不带-fPIC)链接到64位OS上的共享库 [英] link static library (without -fPIC) to shared library on 64bit OS

查看:106
本文介绍了将静态库(不带-fPIC)链接到64位OS上的共享库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用c ++编写programm,从中将成为共享库-并由JNI使用.我有3rd party库(libexample.a),需要将其链接到共享库(libshared.so).问题是,我在64位CentOS上工作,并且需要-fPIC来创建共享库,但是第3方库不是使用-fPIC编译的.

I write programm in c++, from which will be made shared library - and done it will be used by JNI. I have 3rd party library ( libexample.a ) and need to link it to shared library ( libshared.so ). The problem is, that I work on 64bit CentOS and -fPIC is needed to create shared lib, but 3rd party library wasnt compiled with -fPIC.

直到我恢复建筑: /usr/bin/ld: /home/tom/Project/src/libexample.a(SomeObject.o): relocation R_X86_64_32 against 'someData' can not be used when making a shared object; recompile with -fPIC

在这种情况下是否可以制作共享库? (我没有libexample.a的源代码...)

Is it possible to make shared library in this situation? (I dont have source code of libexample.a ...)

是否有任何解决方法可以使其正常工作?甚至在我不得不编写其他应用程序时的想法.

Is there any workaround to make it work? Even ideas when I will have to write additional apps.

我希望我的问题不会重复(或多或少),因为我花了很长时间寻找可能性. 谢谢,贝兹

I hope that my question isn`t duplicate (more or less) because I spent long time at searching of possibilities. Thanks, bez

推荐答案

无法进行任何解决.我不得不写信给第三方图书馆的开发人员,以便再次使用-fPIC

there was not way to make any workaround. I had to write to 3rd party library developers to compile once again with -fPIC

这篇关于将静态库(不带-fPIC)链接到64位OS上的共享库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆