安装的软件包中有configure文件,如何使用它使make后的程序可以gdb调试?
我安装了开源的一个软件(eXosip),解压后的程序中有configure文件,该程序我已经编译通过(./configure后,make)并产生了可执行文件,但是这个文件并不能用gdb调试,说格式不正确,我不知道如何使用configure命令可以生成可以调试的程序?高手们讲讲吧,多谢拉
我./configure --help输出如下:
System types:
--build=BUILD configure for building on BUILD [guessed]
--host=HOST cross-compile to build programs to run on HOST [BUILD]
Optional Features:
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--disable-dependency-tracking speeds up one-time build
--enable-dependency-tracking do not reject slow dependency extractors
--enable-shared[=PKGS]
build shared libraries [default=yes]
--enable-static[=PKGS]
build static libraries [default=yes]
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
--enable-josua compile josua.
--enable-tools compile tools programs.
--enable-glib compile josua with glib (yes).
--enable-ms compile with mediastreamer (yes).
--enable-ortp compile for ortp only (no).
--enable-ucl compile for ucl only (no).
--enable-debug turn on debugging (yes).
--enable-trace turn on trace (yes).
--enable-mpatrol turn on memory leak detection with patrol.
--enable-pthread enable support for POSIX threads. (autodetect)
--enable-semaphore enable support for semaphore (semaphore.h)
--enable-sysv enable support for sysV semaphore (sys/sem.h).
--disable-ncurses turn off ncurses support.
--enable-ntimer enable new timer facility. (default yes)
--disable-phapi turn off phapi library generation.
--enable-miniua compile miniua.
--disable-gsm turn on gsm codec support.
--disable-ilbc turn on ilbc codec support.
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-gnu-ld assume the C compiler uses GNU ld [default=no]
--with-pic try to use only PIC/non-PIC objects [default=use
both]
--with-tags[=TAGS]
include additional configurations [automatic]
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
headers in a nonstandard directory <include dir>
CPP C preprocessor
CXX C++ compiler command
CXXFLAGS C++ compiler flags
CXXCPP C++ preprocessor
F77 Fortran 77 compiler command
FFLAGS Fortran 77 compiler flags
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
你没有安装pkg-config这个工具,所以编译失败了。
问题已经解决了,生成的另一个叫miniuacl的文件可以用gdb调试,miniua只是一个可执行的脚本,谢谢各位了哈
不好意思,实际上还是没有解决,生成的miniuacl的运行结果不对,而且我见过别人确实编译后的miniua可以调试file了一下确实是miniua: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.5, dynamically linked (uses shared libs), not stripped,而我file一下自己的miniua是:
miniua: Bourne shell script text executable,我不知道怎样才能让miniua可以调试,pkg-config我确实安装了
gcc -g 出来的,应该是 ELF 才对。。怎么会无法识别呢。。
$ file miniua
看看输出什么
是不是这一部分需要设置一下?
--enable-dependency-tracking do not reject slow dependency extractors
--enable-shared[=PKGS]
build shared libraries [default=yes]
--enable-static[=PKGS]
build static libraries [default=yes]
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
我试了怎么不行啊,./configure --enable-debug CFLAGS=-g CXXFLAGS=-g
miniua是程序生成的可执行文件,make过程如下:
Making all in miniua
make[2]: Entering directory `/home/mxh/libeXosip-0.9.0/miniua'
/bin/sh ../libtool --mode=link gcc -g -pthread -DOSIP_MT -pedantic -DENABLE_DEBUG -g -DENABLE_TRACE -DNEW_TIMER -DUSE_TMP_BUFFER `pkg-config --cflags glib-2.0` -DORTP_SUPPORT -g -o miniua -O -lnsl -lrt `pkg-config --libs glib-2.0` miniua.o ../phapi/libphapi.la ../src/libeXosip.la -L../phapi/gsm -lgsm -L../phapi/ilbc -lilbc -L/usr/local/lib -losip2 -losipparser2 -L/usr/local/lib -lortp -lm -lstdc++
/bin/sh: line 1: pkg-config: command not found
/bin/sh: line 1: pkg-config: command not found
gcc -g -DOSIP_MT -pedantic -DENABLE_DEBUG -g -DENABLE_TRACE -DNEW_TIMER -DUSE_TMP_BUFFER -DORTP_SUPPORT -g -o .libs/miniua -O miniua.o -pthread -lnsl -lrt ../phapi/.libs/libphapi.so ../src/.libs/libeXosip.so -L/home/mxh/libeXosip-0.9.0/phapi/gsm -lgsm -L/home/mxh/libeXosip-0.9.0/phapi/ilbc -lilbc -L/usr/local/lib /usr/local/lib/libosip2.so /usr/local/lib/libosipparser2.so /usr/local/lib/libortp.so -lm -lstdc++ -Wl,--rpath -Wl,/usr/local/lib
creating miniua
make[2]: Leaving directory `/home/mxh/libeXosip-0.9.0/miniua'
make[2]: Entering directory `/home/mxh/libeXosip-0.9.0'
make[2]: Leaving directory `/home/mxh/libeXosip-0.9.0'
make[1]: Leaving directory `/home/mxh/libeXosip-0.9.0'
[mxh@fcy miniua]$ ls
Makefile Makefile.am Makefile.in miniua miniua.c miniuacl miniua.o
[mxh@fcy miniua]$ gdb
GNU gdb Red Hat Linux (5.3post-0.20021129.18rh)
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu".
(gdb) file miniua
"/home/mxh/libeXosip-0.9.0/miniua/miniua": not in executable format: File format not recognized
--enable-debug 应该也是需要的
./configure CFLAGS=-g CXXFLAGS=-g