我正在尝试在Ubuntu 10.04下编译Android源代码.我收到一个错误说,
/ usr/bin/ld:找不到-lz
你能告诉我怎么解决它?什么cannot find -lz意思?这是完整的错误消息:
external/qemu/Makefile.android:1101: warning: overriding commands for target `external/qemu/android/avd/hw-config-defs.h'
external/qemu/Makefile.android:933: warning: ignoring old commands for target `external/qemu/android/avd/hw-config-defs.h'
host SharedLib: libneo_cgi (out/host/linux-x86/obj/lib/libneo_cgi.so)
/usr/bin/ld: skipping incompatible /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../libz.so when searching for -lz
/usr/bin/ld: skipping incompatible /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../libz.a when searching for -lz
/usr/bin/ld: skipping incompatible /usr/lib/libz.so when searching for -lz
/usr/bin/ld: skipping incompatible /usr/lib/libz.a when searching for -lz
/usr/bin/ld: cannot find -lz
collect2: ld returned 1 exit status
make: *** [out/host/linux-x86/obj/lib/libneo_cgi.so] Error 1
Run Code Online (Sandbox Code Playgroud)
我的GCC版本输出:
scheung@scheung-virtual-box:/media/EXTDIV/mydroid$ gcc --version
gcc …Run Code Online (Sandbox Code Playgroud) 我试图Boost在我的项目中包含库,并且一直面临着相同的问题.我在使用Codeblocks IDE的Ubuntu 12.10上,尝试手动从站点读取指令来安装库,但是在使用头文件以及使用前构建的库时出现了错误.
然后我通过terminalby安装了库sudo apt-get install libboost-all-dev.在此之后,在我的Codeblocks程序中,我可以包含标题,#include <boost/regex.hpp>但是当我尝试包含Filesystem库(#include "boost/filesystem/operations.hpp" )的标题时,我收到以下错误:
/usr/include/boost/system/error_code.hpp|214|undefined reference to boost::system::generic_category()'|
Run Code Online (Sandbox Code Playgroud)
我不知道如何解决此错误(特别是在Linux上的Codeblocks中).我真的可以在这里使用一些帮助.
编译器:Gcc
程序代码:仅尝试包含上述文件系统operations.hpp文件.
从Codeblocks构建日志:
Build started on: 20-11-2012 at 18:02.53
Build ended on: 20-11-2012 at 18:02.54
-------------- Build: Debug in libopenFrameworks ---------------
Target is up to date.
-------------- Build: Debug in reader1 ---------------
make -s -f Makefile Debug
linking i686 bin/reader1_debug linux
obj/i686Debug/src/testApp.o: In function `__static_initialization_and_destruction_0':
/usr/include/boost/system/error_code.hpp:214: undefined reference to `boost::system::generic_category()'
/usr/include/boost/system/error_code.hpp:215: undefined reference to `boost::system::generic_category()'
/usr/include/boost/system/error_code.hpp:216: …Run Code Online (Sandbox Code Playgroud) 我在ubuntu 12.04上安装pyipopt时遇到问题.在链接期间,我收到错误:
/usr/bin/ld: cannot find -lcoinhsl
即使我知道已安装此库,并且可以使用.so和.la文件 /home/mostafa/MyBuilds/CoinIpopt/build/lib/
有没有人有这个解决方案?
下面是运行setup.py build的完整返回:
root@ubuntu:~/MyBuilds/pyipopt# sudo python setup.py build running build running build_ext building 'pyipopt' extension gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/home/mostafa/MyBuilds/CoinIpopt/build/include/coin/ -I/usr/include/python2.7 -c src/callback.c -o build/temp.linux-x86_64-2.7/src/callback.o gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/home/mostafa/MyBuilds/CoinIpopt/build/include/coin/ -I/usr/include/python2.7 -c src/pyipopt.c -o build/temp.linux-x86_64-2.7/src/pyipopt.o src/pyipopt.c: In function ‘set_intermediate_callback’: src/pyipopt.c:452:15: warning: variable ‘myowndata’ set but not used [-Wunused-but-set-variable] gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relrobuild/temp.linux-x86_64-2.7/src/callback.o build/temp.linux-x86_64-2.7/src/pyipopt.o -L/home/mostafa/MyBuilds/CoinIpopt/build/lib/ -lipopt …
我有一个单一的.RS文件。当我编译它时rustc test1.rs,我收到一个错误:
error: linking with `cc` failed: exit code: 1
note: cc '-m64' '-L' '/usr/local/Cellar/rust/1.0.0-alpha/lib/rustlib/x86_64-apple-darwin/lib' '-o' 'test1' 'test1.o' '-Wl,-force_load,/usr/local/Cellar/rust/1.0.0-alpha/lib/rustlib/x86_64-apple-darwin/lib/libmorestack.a' '-Wl,-dead_strip' '-nodefaultlibs' '/usr/local/Cellar/rust/1.0.0-alpha/lib/rustlib/x86_64-apple-darwin/lib/libstd-4e7c5e5c.rlib' '/usr/local/Cellar/rust/1.0.0-alpha/lib/rustlib/x86_64-apple-darwin/lib/libcollections-4e7c5e5c.rlib' '/usr/local/Cellar/rust/1.0.0-alpha/lib/rustlib/x86_64-apple-darwin/lib/libunicode-4e7c5e5c.rlib' '/usr/local/Cellar/rust/1.0.0-alpha/lib/rustlib/x86_64-apple-darwin/lib/librand-4e7c5e5c.rlib' '/usr/local/Cellar/rust/1.0.0-alpha/lib/rustlib/x86_64-apple-darwin/lib/liballoc-4e7c5e5c.rlib' '/usr/local/Cellar/rust/1.0.0-alpha/lib/rustlib/x86_64-apple-darwin/lib/liblibc-4e7c5e5c.rlib' '/usr/local/Cellar/rust/1.0.0-alpha/lib/rustlib/x86_64-apple-darwin/lib/libcore-4e7c5e5c.rlib' '-L' '/usr/local/Cellar/rust/1.0.0-alpha/lib/rustlib/x86_64-apple-darwin/lib' '-L' '/Users/alex/Documents/projects/rust/.rust/lib/x86_64-apple-darwin' '-L' '/Users/alex/Documents/projects/rust/lib/x86_64-apple-darwin' '-lSystem' '-lpthread' '-lc' '-lm' '-lcompiler-rt'
note: ld: warning: directory not found for option '-L/Users/alex/Documents/projects/rust/.rust/lib/x86_64-apple-darwin'
ld: warning: directory not found for option '-L/Users/alex/Documents/projects/rust/lib/x86_64-apple-darwin'
ld: can't open output file for writing: test1, errno=21 for architecture x86_64
clang: error: linker command failed with exit code …Run Code Online (Sandbox Code Playgroud) 我最近不得不在Ubuntu系统上做一些小编程(我是一个非常低级的初学者)而且我真的只是熟悉makefile.
我注意到告诉链接器要包含哪些库的参数总是-l {library name},其中相应的库在/ usr/lib文件夹中称为"lib {library name} .a".
我想知道:这是一个会议吗?我原以为我需要输入-llibNAME来查找一个名为libNAME.a的库,但它似乎假设一个lib前缀.
总是这样吗?我可以在不使用lib前缀的情况下命名库吗?
我将首先说我是gcc和makefile的新手.我在桌面(〜/桌面)上有一个.so文件lib.so.我想将我的程序(称为myProgram)链接到它.我在makefile中写的是:
g++ myProgram.o -L ~/Desktop -l lib -o myProgram
Run Code Online (Sandbox Code Playgroud)
当我跑步时,make我得到一个错误:
/usr/bin/ld: cannot find -llib
Run Code Online (Sandbox Code Playgroud)
我也试过-l lib.so并得到了同样的错误.链接的正确方法是什么?
我正在尝试将开源库libsndfile与 Android NDK 交叉编译。我的主机是 Windows 10 下的 Ubuntu 子系统,目标是 Android 系统(目前任何人都会这样做)。对于构建,我使用 autogen+configure 设置,如 libsndfile文档中所述。编译在链接阶段停止,生成一个冗长的日志文件(略多于 400 行),其中包含多个错误。开始时的错误似乎并不重要,但请配置探测编译器设置,如 本文所述。最后一条错误消息指向链接器问题。我认为这是日志文件的相关摘录:
#include "..." search starts here:
#include <...> search starts here:
/home/alan/android-ndk-r18/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/7.0.2/include
End of search list.
"/usr/bin/ld" --sysroot=../android-ndk-r18/platforms/android-17/arch-arm -z relro -X --enable-new-dtags --eh-frame-hdr -m armelf_linux_eabi -dynamic-linker /system/bin/linker -o a.out ../android-ndk-r18/platforms/android-17/arch-arm/usr/lib/../lib/crtbegin_dynamic.o -L../android-ndk-r18/platforms/android-17/arch-arm/usr/lib -L../android-ndk-r18/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib -L/home/alan/android-ndk-r18/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/7.0.2/lib/linux/arm -L../android-ndk-r18/platforms/android-17/arch-arm/usr/lib/../lib -L../android-ndk-r18/platforms/android-17/arch-arm/usr/lib /tmp/conftest-5c2dd3.o -lgcc -ldl -lc -lgcc -ldl ../android-ndk-r18/platforms/android-17/arch-arm/usr/lib/../lib/crtend_android.o
/usr/bin/ld: unrecognised emulation mode: armelf_linux_eabi
Supported emulations: elf_x86_64 elf32_x86_64 elf_i386 elf_iamcu i386linux elf_l1om elf_k1om i386pep i386pe
clang: …Run Code Online (Sandbox Code Playgroud) gem install json
Building native extensions. This could take a while...
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
/home/user/.rvm/rubies/ruby-2.2.3/bin/ruby -r ./siteconf20150916-3216-1xudd6p.rb extconf.rb
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling generator.c
linking shared-object json/ext/generator.so
/usr/bin/ld: cannot find -lgmp
collect2: error: ld returned 1 exit status
make: *** [generator.so] Error 1
make failed, exit code 2
Gem files will remain installed in /home/user/.rvm/gems/ruby-2.2.3/gems/json-1.8.3 for inspection.
Results logged to /home/user/.rvm/gems/ruby-2.2.3/extensions/x86_64-linux/2.2.0/json-1.8.3/gem_make.out
Run Code Online (Sandbox Code Playgroud)
嘿.我正试图推进到heroku但是用这个结束了.首先,有sqlit3问题.现在,当我输入bundle时,我无法安装json.我现在应该怎么做?
提前致谢.
我似乎无法在我的amazon linux服务器上安装任何R软件包,在EC2上运行.这是一个尝试安装"扫帚"包的简单示例.知道这里发生了什么吗?任何帮助将不胜感激,因为我已经坚持了约5个小时.我已经粘贴了下面的所有控制台输出.
install.packages( "扫帚")
Installing package into ‘/home/rstudio/R/x86_64-redhat-linux-gnu-library/3.4’
(as ‘lib’ is unspecified)
also installing the dependencies ‘mnormt’, ‘psych’
trying URL 'https://cran.rstudio.com/src/contrib/mnormt_1.5-5.tar.gz'
Content type 'application/x-gzip' length 37169 bytes (36 KB)
==================================================
downloaded 36 KB
trying URL 'https://cran.rstudio.com/src/contrib/psych_1.7.8.tar.gz'
Content type 'application/x-gzip' length 3311758 bytes (3.2 MB)
==================================================
downloaded 3.2 MB
trying URL 'https://cran.rstudio.com/src/contrib/broom_0.4.3.tar.gz'
Content type 'application/x-gzip' length 1397648 bytes (1.3 MB)
==================================================
downloaded 1.3 MB
* installing *source* package ‘mnormt’ ...
** package ‘mnormt’ successfully unpacked and MD5 sums checked
** libs …Run Code Online (Sandbox Code Playgroud) 我已经查看了usr/bin/ld:cannot find -l<nameOfTheLibrary>中的答案,但它们都不适用于此上下文。
我刚刚买了一台新笔记本电脑并设置了 Go。一个简单的 hello world 程序可以工作,但是当我尝试一个更复杂的程序时,我得到:
go run .
# runtime/cgo
/usr/bin/ld: cannot find -lavcodec
/usr/bin/ld: cannot find -lavformat
/usr/bin/ld: cannot find -lavutil
/usr/bin/ld: cannot find -lswscale
/usr/bin/ld: cannot find -lswresample
/usr/bin/ld: cannot find -lavdevice
/usr/bin/ld: cannot find -lavfilter
collect2: error: ld returned 1 exit status
Run Code Online (Sandbox Code Playgroud)
我不确定我的程序中哪里发生了错误,因为上面是我得到的唯一输出。
$ gcc --version
gcc (Ubuntu 10.3.0-1ubuntu1) 10.3.0
Run Code Online (Sandbox Code Playgroud)
编辑:这是一个重现错误的小样本:
package main
import "net/http"
func main() {
cli := &http.Client{}
rsp, err := cli.Get("https://google.com")
if err != nil {
panic(err)
}
defer …Run Code Online (Sandbox Code Playgroud)