gpt4 book ai didi

ruby 使用 fPIC 编译

转载 作者:数据小太阳 更新时间:2023-10-29 08:49:24 25 4
gpt4 key购买 nike

我在 Debian 7 下通过 rbenv 使用 ruby​​ 1.9.3p392,我正在尝试安装 qtbindings gem,这样我就可以运行一个使用 qt 库的旧 ruby​​ 应用程序。

这是我在输入“gem install qtbindings”时遇到的错误

make[3]: Entering directory `/usr/local/rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/qtbindings-4.8.3.0/ext/build'
[ 82%] Building CXX object ruby/qtruby/src/CMakeFiles/qtruby4shared.dir/Qt.o
[ 82%] Building CXX object ruby/qtruby/src/CMakeFiles/qtruby4shared.dir/handlers.o
[ 83%] Building CXX object ruby/qtruby/src/CMakeFiles/qtruby4shared.dir/marshall_types.o
Linking CXX shared library libqtruby4shared.so
/usr/bin/ld: /usr/local/rbenv/versions/1.9.3-p392/lib/libruby-static.a(array.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/local/rbenv/versions/1.9.3-p392/lib/libruby-static.a: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
make[3]: *** [ruby/qtruby/src/libqtruby4shared.so.2.0.0] Error 1
make[3]: Leaving directory `/usr/local/rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/qtbindings-4.8.3.0/ext/build'
make[2]: *** [ruby/qtruby/src/CMakeFiles/qtruby4shared.dir/all] Error 2
make[2]: Leaving directory `/usr/local/rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/qtbindings-4.8.3.0/ext/build'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/usr/local/rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/qtbindings-4.8.3.0/ext/build'
make: *** [build] Error 2


Gem files will remain installed in /usr/local/rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/qtbindings-4.8.3.0 for inspection.
Results logged to /usr/local/rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/qtbindings-4.8.3.0/./gem_make.out

我已经安装了以下要求

sudo aptitude install cmake build-essential bison openssl libreadline5 libreadline-dev curl git-core zlib1g zlib1g-dev libssl-dev vim libsqlite3-0 libsqlite3-dev sqlite3 libreadline5-dev libreadline6-dev libxml2-dev git-core subversion autoconf xorg-dev libgl1-mesa-dev libglu1-mesa-dev qtcreator

如何使用 fPIC 编译 ruby​​?我也试过 'gem install qtbindings -- -fPIC' 但得到了同样的错误。

最佳答案

尝试

#gem install qtbindings -- --with-cflags=\"-fPIC\"

来源: Is there any way to change gcc compilation options for a gem?

已编辑:

是的,我又看了一遍你的代码,我的错。问题出在安装的 ruby 上,而不是 gem 上。

this (最后的帖子)

尝试使用共享库重新安装 ruby​​:

CONFIGURE_OPTS="--enable-shared" rbenv install 1.9.3-p392 

关于ruby 使用 fPIC 编译,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17140679/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com