2013-05-16 90 views
3

我正在嘗試在Ubuntu 12.04(32位)生成系統上爲ARM主機交叉編譯gstreamer。我將要描述的i686-linux-gnu GCC沒有任何描述。我在Ubuntu 12.04編譯使用該GCC:鏈接可執行文件時發現共享庫依賴關係

> arm-linux-gnueabihf-gcc -v 
Using built-in specs. 
COLLECT_GCC=arm-linux-gnueabihf-gcc 
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/4.6/lto-wrapper 
Target: arm-linux-gnueabihf 
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.3-1ubuntu5' 
--with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs 
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 
--enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib 
--without-included-gettext --enable-threads=posix 
--with-gxx-include-dir=/usr/arm-linux-gnueabihf/include/c++/4.6.3 --libdir=/usr/lib 
--enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes 
--enable-gnu-unique-object --enable-plugin --enable-objc-gc --enable-multilib 
--disable-sjlj-exceptions --with-arch=armv7-a --with-float=hard --with-fpu=vfpv3-d16 
--with-mode=thumb --disable-werror --enable-checking=release --build=i686-linux-gnu 
--host=i686-linux-gnu --target=arm-linux-gnueabihf --program-prefix=arm-linux-gnueabihf- 
--includedir=/usr/arm-linux-gnueabihf/include 
--with-headers=/usr/arm-linux-gnueabihf/include 
--with-libs=/usr/arm-linux-gnueabihf/lib 
Thread model: posix 
gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) 

這LD:

arm-linux-gnueabihf-ld -v GNU ld (GNU Binutils for Ubuntu) 2.22

GCC從Ubuntu默認12.04的PPA安裝。當構建系統到達鏈接GST-發現者 - 1.0可執行文件,我得到以下錯誤:

/usr/lib/gcc/arm-linux-gnueabihf/4.6/../../../../arm-linux-gnueabihf/bin/ld: warning: liborc-0.4.so.0, needed by ../gst-libs/gst/video/.libs/libgstvideo-1.0.so, not found (try using -rpath or -rpath-link) 
../gst-libs/gst/video/.libs/libgstvideo-1.0.so: undefined reference to `orc_program_compile' 
../gst-libs/gst/video/.libs/libgstvideo-1.0.so: undefined reference to `orc_program_set_backup_function' 
../gst-libs/gst/video/.libs/libgstvideo-1.0.so: undefined reference to `orc_program_new_from_static_bytecode' 
../gst-libs/gst/video/.libs/libgstvideo-1.0.so: undefined reference to `orc_program_free' 
../gst-libs/gst/video/.libs/libgstvideo-1.0.so: undefined reference to `orc_once_mutex_lock' 
../gst-libs/gst/video/.libs/libgstvideo-1.0.so: undefined reference to `orc_program_take_code' 
../gst-libs/gst/video/.libs/libgstvideo-1.0.so: undefined reference to `orc_once_mutex_unlock' 
collect2: ld returned 1 exit status 

GST-發現者 - 1.0依賴於libgstvideo-1.0.so。 libgstvideo-1.0.so(在此過程中較早建立)對liborc-0.4.so具有依賴性。檢查與ARM-Linux的gnueabihf-readelf -a的libgstvideo-1.0.so得到下面的代碼片段:

Dynamic section at offset 0x29ed8 contains 33 entries: 
    Tag  Type       Name/Value 
0x00000001 (NEEDED)      Shared library: [libgstbase-1.0.so.0] 
0x00000001 (NEEDED)      Shared library: [libgstreamer-1.0.so.0] 
0x00000001 (NEEDED)      Shared library: [libgobject-2.0.so.0] 
0x00000001 (NEEDED)      Shared library: [libglib-2.0.so.0] 
0x00000001 (NEEDED)      Shared library: [liborc-0.4.so.0] 
0x00000001 (NEEDED)      Shared library: [libgcc_s.so.1] 
0x00000001 (NEEDED)      Shared library: [libpthread.so.0] 
0x00000001 (NEEDED)      Shared library: [libc.so.6] 
0x0000000e (SONAME)      Library soname: [libgstvideo-1.0.so.0] 
0x0000000f (RPATH)      Library rpath: [/home/test/gst/gstreamer/gstreamer/libs/gst/base/.libs:/ 
home/test/gst/gstreamer/gstreamer/gst/.libs:/home/test/gst/gstreamer/orc/orc/.libs] 

的路徑liborc-0.4.so在RPATH項正確。 gst-discoverer-1.0的鏈接行不包含對liborc的引用,因爲它不直接依賴於它(僅間接依賴於libgstvideo-1.0.so)。我曾嘗試在我的LDFLAGS中添加「-rpath-link =/home/test/gst/gstreamer/orc/orc/.libs」,但它不起作用。有關爲什麼交叉編譯鏈接程序無法找到此共享庫的依賴關係的任何想法?

回答

2

看來我是在正確的軌道上,但我傳遞-rpath-link到ld(在我的配置線上使用LDFLAGS)。既然是GCC,實際上是做了鏈接,我需要使用CFLAGS和-Wl說法是這樣的:

./configure CFLAGS="-Wl,-rpath=/home/test/gst/gstreamer/orc/orc/libs" 

According to some,有可能是在交聯劑的錯誤。