web-dev-qa-db-ja.com

gcc -m32はライブラリを見つけることができません

32ビットと64ビットの両方のコンパイルが機能し、11.10から12.04にアップグレードしました。 -m64は機能しますが、-m32はライブラリを見つけることができません。

ライブラリとgcc-multilibを再インストールしようとしましたが、喜びはありません。誰かが私が見逃した何かを見つけましたか?

デビッド

gcc -m32 -Wall -W -L/usr/lib/x86_64-linux-gnu/libusb-1.0.so.0 -lusb-1.0
-lX11 LMSS.c -o LMSS32
/usr/bin/ld: skipping incompatible /usr/local/lib/libusb-1.0.so when searching for -lusb-1.0
/usr/bin/ld: skipping incompatible /usr/local/lib/libusb-1.0.a when searching for -lusb-1.0
/usr/bin/ld: cannot find -lusb-1.0
/usr/bin/ld: cannot find -lX11
collect2: ld returned 1 exit status

locate libusb-1.0
/home/david/Downloads/libusb-1.0.8
/home/david/Downloads/libusb-1.0.8.tar.bz2
/home/david/Downloads/libusb-1.0.8/AUTHORS
/home/david/Downloads/libusb-1.0.8/COPYING
/home/david/Downloads/libusb-1.0.8/ChangeLog
/home/david/Downloads/libusb-1.0.8/INSTALL
/home/david/Downloads/libusb-1.0.8/Makefile
/home/david/Downloads/libusb-1.0.8/Makefile.am
/home/david/Downloads/libusb-1.0.8/Makefile.in
/home/david/Downloads/libusb-1.0.8/NEWS
/home/david/Downloads/libusb-1.0.8/PORTING
/home/david/Downloads/libusb-1.0.8/README
/home/david/Downloads/libusb-1.0.8/THANKS
/home/david/Downloads/libusb-1.0.8/TODO
/home/david/Downloads/libusb-1.0.8/aclocal.m4
/home/david/Downloads/libusb-1.0.8/compile
/home/david/Downloads/libusb-1.0.8/config.guess
/home/david/Downloads/libusb-1.0.8/config.h
/home/david/Downloads/libusb-1.0.8/config.h.in
/home/david/Downloads/libusb-1.0.8/config.log
/home/david/Downloads/libusb-1.0.8/config.status
/home/david/Downloads/libusb-1.0.8/config.sub
/home/david/Downloads/libusb-1.0.8/configure
/home/david/Downloads/libusb-1.0.8/configure.ac
/home/david/Downloads/libusb-1.0.8/depcomp
/home/david/Downloads/libusb-1.0.8/doc
/home/david/Downloads/libusb-1.0.8/examples
/home/david/Downloads/libusb-1.0.8/install-sh
/home/david/Downloads/libusb-1.0.8/libtool
/home/david/Downloads/libusb-1.0.8/libusb
/home/david/Downloads/libusb-1.0.8/libusb-1.0.pc
/home/david/Downloads/libusb-1.0.8/libusb-1.0.pc.in
/home/david/Downloads/libusb-1.0.8/ltmain.sh
/home/david/Downloads/libusb-1.0.8/missing
/home/david/Downloads/libusb-1.0.8/stamp-h1
/home/david/Downloads/libusb-1.0.8/doc/Makefile
/home/david/Downloads/libusb-1.0.8/doc/Makefile.am
/home/david/Downloads/libusb-1.0.8/doc/Makefile.in
/home/david/Downloads/libusb-1.0.8/doc/doxygen.cfg
/home/david/Downloads/libusb-1.0.8/doc/doxygen.cfg.in
/home/david/Downloads/libusb-1.0.8/examples/.deps
/home/david/Downloads/libusb-1.0.8/examples/Makefile
/home/david/Downloads/libusb-1.0.8/examples/Makefile.am
/home/david/Downloads/libusb-1.0.8/examples/Makefile.in
/home/david/Downloads/libusb-1.0.8/examples/dpfp.c
/home/david/Downloads/libusb-1.0.8/examples/dpfp_threaded.c
/home/david/Downloads/libusb-1.0.8/examples/lsusb.c
/home/david/Downloads/libusb-1.0.8/examples/.deps/dpfp.Po
/home/david/Downloads/libusb-1.0.8/examples/.deps/dpfp_threaded-dpfp_threaded.Po
/home/david/Downloads/libusb-1.0.8/examples/.deps/lsusb.Po
/home/david/Downloads/libusb-1.0.8/libusb/.deps
/home/david/Downloads/libusb-1.0.8/libusb/.libs
/home/david/Downloads/libusb-1.0.8/libusb/Makefile
/home/david/Downloads/libusb-1.0.8/libusb/Makefile.am
/home/david/Downloads/libusb-1.0.8/libusb/Makefile.in
/home/david/Downloads/libusb-1.0.8/libusb/core.c
/home/david/Downloads/libusb-1.0.8/libusb/descriptor.c
/home/david/Downloads/libusb-1.0.8/libusb/io.c
/home/david/Downloads/libusb-1.0.8/libusb/libusb-1.0.la
/home/david/Downloads/libusb-1.0.8/libusb/libusb.h
/home/david/Downloads/libusb-1.0.8/libusb/libusb_1_0_la-core.lo
/home/david/Downloads/libusb-1.0.8/libusb/libusb_1_0_la-core.o
/home/david/Downloads/libusb-1.0.8/libusb/libusb_1_0_la-descriptor.lo
/home/david/Downloads/libusb-1.0.8/libusb/libusb_1_0_la-descriptor.o
/home/david/Downloads/libusb-1.0.8/libusb/libusb_1_0_la-io.lo
/home/david/Downloads/libusb-1.0.8/libusb/libusb_1_0_la-io.o
/home/david/Downloads/libusb-1.0.8/libusb/libusb_1_0_la-linux_usbfs.lo
/home/david/Downloads/libusb-1.0.8/libusb/libusb_1_0_la-linux_usbfs.o
/home/david/Downloads/libusb-1.0.8/libusb/libusb_1_0_la-sync.lo
/home/david/Downloads/libusb-1.0.8/libusb/libusb_1_0_la-sync.o
/home/david/Downloads/libusb-1.0.8/libusb/libusbi.h
/home/david/Downloads/libusb-1.0.8/libusb/os
/home/david/Downloads/libusb-1.0.8/libusb/sync.c
/home/david/Downloads/libusb-1.0.8/libusb/.deps/libusb_1_0_la-core.Plo
/home/david/Downloads/libusb-1.0.8/libusb/.deps/libusb_1_0_la-darwin_usb.Plo
/home/david/Downloads/libusb-1.0.8/libusb/.deps/libusb_1_0_la-descriptor.Plo
/home/david/Downloads/libusb-1.0.8/libusb/.deps/libusb_1_0_la-io.Plo
/home/david/Downloads/libusb-1.0.8/libusb/.deps/libusb_1_0_la-linux_usbfs.Plo
/home/david/Downloads/libusb-1.0.8/libusb/.deps/libusb_1_0_la-sync.Plo
/home/david/Downloads/libusb-1.0.8/libusb/.libs/libusb-1.0.a
/home/david/Downloads/libusb-1.0.8/libusb/.libs/libusb-1.0.la
/home/david/Downloads/libusb-1.0.8/libusb/.libs/libusb-1.0.lai
/home/david/Downloads/libusb-1.0.8/libusb/.libs/libusb-1.0.so
/home/david/Downloads/libusb-1.0.8/libusb/.libs/libusb-1.0.so.0
/home/david/Downloads/libusb-1.0.8/libusb/.libs/libusb-1.0.so.0.0.0
/home/david/Downloads/libusb-1.0.8/libusb/.libs/libusb_1_0_la-core.o
/home/david/Downloads/libusb-1.0.8/libusb/.libs/libusb_1_0_la-descriptor.o
/home/david/Downloads/libusb-1.0.8/libusb/.libs/libusb_1_0_la-io.o
/home/david/Downloads/libusb-1.0.8/libusb/.libs/libusb_1_0_la-linux_usbfs.o
/home/david/Downloads/libusb-1.0.8/libusb/.libs/libusb_1_0_la-sync.o
/home/david/Downloads/libusb-1.0.8/libusb/os/darwin_usb.c
/home/david/Downloads/libusb-1.0.8/libusb/os/darwin_usb.h
/home/david/Downloads/libusb-1.0.8/libusb/os/linux_usbfs.c
/home/david/Downloads/libusb-1.0.8/libusb/os/linux_usbfs.h
/lib/x86_64-linux-gnu/libusb-1.0.so.0
/lib/x86_64-linux-gnu/libusb-1.0.so.0.1.0
/usr/include/libusb-1.0
/usr/include/libusb-1.0/libusb.h
/usr/lib/x86_64-linux-gnu/libusb-1.0.a
/usr/lib/x86_64-linux-gnu/libusb-1.0.so
/usr/lib/x86_64-linux-gnu/libusb-1.0.so.0
/usr/lib/x86_64-linux-gnu/pkgconfig/libusb-1.0.pc
/usr/local/include/libusb-1.0
/usr/local/include/libusb-1.0/libusb.h
/usr/local/lib/libusb-1.0.a
/usr/local/lib/libusb-1.0.la
/usr/local/lib/libusb-1.0.so
/usr/local/lib/libusb-1.0.so.0
/usr/local/lib/libusb-1.0.so.0.0.0
/usr/local/lib/pkgconfig/libusb-1.0.pc
/usr/share/doc/libusb-1.0-0
/usr/share/doc/libusb-1.0-0-dev
/usr/share/doc/libusb-1.0-0/README
/usr/share/doc/libusb-1.0-0/changelog.Debian.gz
/usr/share/doc/libusb-1.0-0/copyright
/usr/share/doc/libusb-1.0-0-dev/PORTING
/usr/share/doc/libusb-1.0-0-dev/README
/usr/share/doc/libusb-1.0-0-dev/changelog.Debian.gz
/usr/share/doc/libusb-1.0-0-dev/copyright
/usr/share/doc/libusb-1.0-0-dev/html
/usr/share/doc/libusb-1.0-0-dev/html/annotated.html
/usr/share/doc/libusb-1.0-0-dev/html/bc_s.png
/usr/share/doc/libusb-1.0-0-dev/html/caveats.html
/usr/share/doc/libusb-1.0-0-dev/html/classes.html
/usr/share/doc/libusb-1.0-0-dev/html/closed.png
/usr/share/doc/libusb-1.0-0-dev/html/contexts.html
/usr/share/doc/libusb-1.0-0-dev/html/doxygen.css
/usr/share/doc/libusb-1.0-0-dev/html/doxygen.png
/usr/share/doc/libusb-1.0-0-dev/html/dynsections.js
/usr/share/doc/libusb-1.0-0-dev/html/files.html
/usr/share/doc/libusb-1.0-0-dev/html/functions.html
/usr/share/doc/libusb-1.0-0-dev/html/functions_vars.html
/usr/share/doc/libusb-1.0-0-dev/html/group__asyncio.html
/usr/share/doc/libusb-1.0-0-dev/html/group__desc.html
/usr/share/doc/libusb-1.0-0-dev/html/group__dev.html
/usr/share/doc/libusb-1.0-0-dev/html/group__lib.html
/usr/share/doc/libusb-1.0-0-dev/html/group__misc.html
/usr/share/doc/libusb-1.0-0-dev/html/group__poll.html
/usr/share/doc/libusb-1.0-0-dev/html/group__syncio.html
/usr/share/doc/libusb-1.0-0-dev/html/index.html
/usr/share/doc/libusb-1.0-0-dev/html/io.html
/usr/share/doc/libusb-1.0-0-dev/html/libusb_8h_source.html
/usr/share/doc/libusb-1.0-0-dev/html/modules.html
/usr/share/doc/libusb-1.0-0-dev/html/mtasync.html
/usr/share/doc/libusb-1.0-0-dev/html/nav_f.png
/usr/share/doc/libusb-1.0-0-dev/html/nav_h.png
/usr/share/doc/libusb-1.0-0-dev/html/open.png
/usr/share/doc/libusb-1.0-0-dev/html/packetoverflow.html
/usr/share/doc/libusb-1.0-0-dev/html/pages.html
/usr/share/doc/libusb-1.0-0-dev/html/structlibusb__config__descriptor.html
/usr/share/doc/libusb-1.0-0-dev/html/structlibusb__control__setup.html
/usr/share/doc/libusb-1.0-0-dev/html/structlibusb__device__descriptor.html
/usr/share/doc/libusb-1.0-0-dev/html/structlibusb__endpoint__descriptor.html
/usr/share/doc/libusb-1.0-0-dev/html/structlibusb__interface.html
/usr/share/doc/libusb-1.0-0-dev/html/structlibusb__interface__descriptor.html
/usr/share/doc/libusb-1.0-0-dev/html/structlibusb__iso__packet__descriptor.html
/usr/share/doc/libusb-1.0-0-dev/html/structlibusb__pollfd.html
/usr/share/doc/libusb-1.0-0-dev/html/structlibusb__transfer.html
/usr/share/doc/libusb-1.0-0-dev/html/tab_a.png
/usr/share/doc/libusb-1.0-0-dev/html/tab_b.png
/usr/share/doc/libusb-1.0-0-dev/html/tab_h.png
/usr/share/doc/libusb-1.0-0-dev/html/tab_s.png
/usr/share/doc/libusb-1.0-0-dev/html/tabs.css
/usr/share/doc/libusb-1.0-0-dev/html/version_8h_source.html
/usr/share/doc-base/libusb-1.0-0-dev
/var/cache/apt/archives/libusb-1.0-0-dev_2%3a1.0.9~rc3-2ubuntu1_AMD64.deb
/var/cache/apt/archives/libusb-1.0-0_2%3a1.0.9~rc3-2ubuntu1_AMD64.deb
/var/lib/doc-base/documents/libusb-1.0-0-dev
/var/lib/doc-base/omf/libusb-1.0-0-dev
/var/lib/doc-base/omf/libusb-1.0-0-dev/libusb-1.0-0-dev-C.omf
/var/lib/dpkg/info/libusb-1.0-0-dev.list
/var/lib/dpkg/info/libusb-1.0-0-dev.md5sums
/var/lib/dpkg/info/libusb-1.0-0:AMD64.list
/var/lib/dpkg/info/libusb-1.0-0:AMD64.md5sums
/var/lib/dpkg/info/libusb-1.0-0:AMD64.postinst
/var/lib/dpkg/info/libusb-1.0-0:AMD64.postrm
/var/lib/dpkg/info/libusb-1.0-0:AMD64.shlibs
3
David

couldこれらのライブラリの32ビットパッケージをインストールします。

$ Sudo apt-get install libusb-dev:i386 libX11-dev:i386

ただし、これにより64ビットバージョンが削除されることに注意してください。おそらく、この種のことには、chroot(カウビルダーやpbuilderなど)またはQemuイメージを使用する方が良いでしょう。例えば。ファイル~/.pbuilderrc-precise-i386を作成します:

# Set this to the distribution you want to build for
DISTRIBUTION=precise
# The architecture you want to build for
ARCHITECTURE=i386
# The directory in which to store the chroot base image
BASEPATH=/var/cache/pbuilder/base-precise-i386.cow
# The repositories to be enabled in the /etc/apt/sources.list
COMPONENTS="main universe"
# If you want to speed things up with ccache, enable these options
export CCACHE_DIR="/var/cache/pbuilder/ccache"
export PATH="/usr/lib/ccache:${PATH}"
# List here all packages you need to build your software
# (e.g. build-essential, libusb-dev, libX11-dev, etc.)
EXTRAPACKAGES=ccache
# List here all directories from you system that should be visible inside the chroot
BINDMOUNTS="${CCACHE_DIR} ${HOME}/projects"

次にcowbuilderをインストールし、次のようにベースイメージを作成します。

$ Sudo apt-get install cowbuilder
$ Sudo cowbuilder --create --configfile ~/.pbuilderrc-precise-i386

最後に、chrootを入力して構成を完了します(構成ファイルをコピーします:

$ Sudo cowbuilder --login --save-after-exec --configfile ~/.pbuilderrc-precise-i386

次を使用してchrootを終了できます。 Ctrl+D またはexitを使用します。これで、ベースイメージのセットアップが完了しました。将来、chrootに入るときに--save-after-execフラグを使用しないでください。これにより、chrootを離れた後にすべての変更が破棄され、将来のビルドのためのクリーンなビルド環境が確保されます。

これで、chrootに入ってソフトウェアをビルドできるはずです。

$ Sudo cowbuilder --login --configfile ~/.pbuilderrc-precise-i386
% cd $HOME/projects/foo
% # build project foo

ただし、この方法で作成されたファイルはrootが所有することに注意してください。したがって、アウトソースビルドは非常に良いアイデアです。

3
Michael Wild

Multiarchで何かが壊れています。-m32スイッチを使用して、新しい12.04.1とそのmultiarch(すべてインストール済み)で64ビットマシンで32ビットアプリをコンパイルできなくなりました。私の場合、libQtCoreが必要でしたが、libqt4-dev:i386をインストールしようとすると、libqt4-devをアンインストールしようとしました。いじくり回した後、「/ usr/lib/i386-linux-gnu」にいくつかのシンボリックリンクが欠けていることがわかり、コンパイルが続行されました。

2
dashesy