首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使tcc搜索/usr/lib中的库?

如何使tcc搜索/usr/lib中的库?
EN

Stack Overflow用户
提问于 2013-09-04 12:52:58
回答 2查看 2.4K关注 0票数 1

在我的Raspberry PI计算机上,我从源代码(in /usr/local/src)编译了tcc编译器。当我链接到/usr/lib中的库时,tcc无法找到它,因此需要将-L/usr/lib添加到tcc命令中。如何配置和使tcc在其库路径中包含/usr/lib?

代码语言:javascript
复制
pi@raspberrypi /usr/local/src/tcc-0.9.26 $ tcc -vv
tcc version 0.9.26 (ARM Hard Float Linux)
install: /usr/local/lib/tcc/
crt:
  /usr/lib/arm-linux-gnueabihf
libraries:
  /usr/lib/arm-linux-gnueabihf
  /lib/arm-linux-gnueabihf
  /usr/local/lib/arm-linux-gnueabihf
include:
  /usr/local/include
  /usr/local/include/arm-linux-gnueabihf
  /usr/include
  /usr/include/arm-linux-gnueabihf
  /usr/local/lib/tcc/include
elfinterp:
  /lib/ld-linux-armhf.so.3
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2013-09-06 10:49:38

结果表明,我们需要使用libpaths选项并指定默认库目录(来自tcc -vv的输出)。我们还可以添加标准目录/lib/usr/local/lib

代码语言:javascript
复制
# ./configure --libpaths=/usr/local/lib/arm-linux-gnueabihf:/lib/arm-linux-gnueabihf:/usr/lib/arm-linux-gnueabihf:/usr/local/lib:/lib:/usr/lib
票数 0
EN

Stack Overflow用户

发布于 2013-09-05 01:59:49

这是编译tcc本身时的配置选项。如果要使用二进制tcc发行版,则必须继续使用-L选项。

然而,自己编写tcc应该是非常容易的。这些都是粗略的步骤:

代码语言:javascript
复制
% git clone git://repo.or.cz/tinycc.git 
% cd tinycc 
% ./configure --libpaths=/usr/lib
% make

还有更多选择。请参见:

代码语言:javascript
复制
% ./configure --help
Usage: configure [options]
Options: [defaults in brackets after descriptions]

Standard options:
  --help                   print this message
  --prefix=PREFIX          install in PREFIX [/usr/local]
  --exec-prefix=EPREFIX    install architecture-dependent files in EPREFIX
                           [same as prefix]
  --bindir=DIR             user executables in DIR [EPREFIX/bin]
  --libdir=DIR             object code libraries in DIR [EPREFIX/lib]
  --tccdir=DIR             installation directory [EPREFIX/lib/tcc]
  --includedir=DIR         C header files in DIR [PREFIX/include]
  --sharedir=DIR           documentation root DIR [PREFIX/share]
  --docdir=DIR             documentation in DIR [SHAREDIR/doc/tcc]
  --mandir=DIR             man documentation in DIR [SHAREDIR/man]
  --infodir=DIR            info documentation in DIR [SHAREDIR/info]

Advanced options (experts only):
  --source-path=PATH       path of source code [/Users/miki/projects/tinycc-so]
  --cross-prefix=PREFIX    use PREFIX for compile tools []
  --sysroot=PREFIX         prepend PREFIX to library/include paths []
  --cc=CC                  use C compiler CC [gcc]
  --extra-cflags=          specify compiler flags [-Wall -g -O2]
  --extra-ldflags=         specify linker options []
  --strip-binaries         strip symbol tables from resulting binaries
  --disable-static         make libtcc.so instead of libtcc.a
  --disable-rpath          disable use of -rpath with the above
  --with-libgcc            use /lib/libgcc_s.so.1 instead of libtcc.a
  --enable-mingw32         build windows version on linux with mingw32
  --enable-cygwin          build windows version on windows with cygwin
  --enable-cross           build cross compilers
  --enable-assert          enable debug assertions
  --with-selinux           use mmap for exec mem [needs writable /tmp]
  --sysincludepaths=...    specify system include paths, colon separated
  --libpaths=...           specify system library paths, colon separated
  --crtprefix=...          specify locations of crt?.o, colon separated
  --elfinterp=...          specify elf interpreter

您可能还希望将tcc安装到配置的目录中。

代码语言:javascript
复制
% make install
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/18614391

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档