LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1356|回复: 7

安装的软件包中有configure文件,如何使用它使make后的程序可以gdb调试?

[复制链接]
发表于 2006-5-21 21:54:05 | 显示全部楼层 |阅读模式
我安装了开源的一个软件(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
发表于 2006-5-22 09:17:05 | 显示全部楼层
试试
./configure CFLAGS=-g CXXFLAGS=-g
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-5-22 09:54:42 | 显示全部楼层
我试了怎么不行啊,./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
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-5-22 10:06:09 | 显示全部楼层
是不是这一部分需要设置一下?
--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]
回复 支持 反对

使用道具 举报

发表于 2006-5-22 12:33:08 | 显示全部楼层
应该修改Makefile文件中的
“strip <pro>”
的语句。<pro>依赖具体情况。
回复 支持 反对

使用道具 举报

发表于 2006-5-23 10:59:52 | 显示全部楼层
我也有同样问题,楼上的能否说的清楚些
回复 支持 反对

使用道具 举报

发表于 2006-5-24 10:58:12 | 显示全部楼层
还是仔细看看Makefile中CFLAG和CXXFLAG的内容,然后再自己作些修改。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-6-1 20:11:44 | 显示全部楼层
CFLAGS = -DSHOW_MESSAGE -g
CXXFLAGS = -g -O2,然后怎么改啊?
我make了一下,这是输出结果:
我file miniua输出如下:
[root@FC2 miniua]# file miniua
miniua: Bourne shell script text executable
我感觉这并不是正常的可执行文件的格式呀,用gdb这种格式无法调试的
[root@FC2 miniua]# make
if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I../include   -I../phapi  -I/usr/local/include -I/usr/local/include/ortp  -Wall -Wcast-align -Wchar-subscripts -Wformat -Winline -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -DSHOW_MESSAGE -g -pthread  -DOSIP_MT -pedantic -DENABLE_DEBUG -g -DENABLE_TRACE -DNEW_TIMER -DUSE_TMP_BUFFER `pkg-config --cflags glib-2.0` -DORTP_SUPPORT -DSHOW_MESSAGE -g -MT miniua.o -MD -MP -MF ".deps/miniua.Tpo" -c -o miniua.o miniua.c; \
then mv -f ".deps/miniua.Tpo" ".deps/miniua.Po"; else rm -f ".deps/miniua.Tpo"; exit 1; fi
miniua.c:34:1: warning: C++ style comments are not allowed in ISO C90
miniua.c:34:1: warning: (this will be reported only once per input file)
miniua.c:82: warning: no previous prototype for `usage'
miniua.c: In function `main':
miniua.c:177: warning: suggest parentheses around assignment used as truth value
miniua.c:136: warning: unused variable `c'
miniua.c:138: warning: unused variable `send_subscription'
miniua.c: At top level:
miniua.c:431: warning: `cmdloop' was used with no prototype before its definition
miniua.c: In function `cmdloop':
miniua.c:441: warning: unused variable `dtmf'
/bin/sh ../libtool --mode=link gcc -DSHOW_MESSAGE -g -pthread  -DOSIP_MT -pedantic -DENABLE_DEBUG -g -DENABLE_TRACE -DNEW_TIMER -DUSE_TMP_BUFFER `pkg-config --cflags glib-2.0` -DORTP_SUPPORT -DSHOW_MESSAGE -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++
gcc -DSHOW_MESSAGE -g -DOSIP_MT -pedantic -DENABLE_DEBUG -g -DENABLE_TRACE -DNEW_TIMER -DUSE_TMP_BUFFER -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -DORTP_SUPPORT -DSHOW_MESSAGE -g -o .libs/miniua -O miniua.o  -pthread -lnsl -lrt -lglib-2.0 ../phapi/.libs/libphapi.so ../src/.libs/libeXosip.so -L/home/libeXosip-0.9.0/phapi/gsm -lgsm -L/home/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
/bin/sh ../libtool --mode=link gcc -DSHOW_MESSAGE -g -pthread  -DOSIP_MT -pedantic -DENABLE_DEBUG -g -DENABLE_TRACE -DNEW_TIMER -DUSE_TMP_BUFFER `pkg-config --cflags glib-2.0` -DORTP_SUPPORT -DSHOW_MESSAGE -g   -o miniuacl  miniua.o ../phapi/libphapicl.a -lpthread -lstdc++
gcc -DSHOW_MESSAGE -g -DOSIP_MT -pedantic -DENABLE_DEBUG -g -DENABLE_TRACE -DNEW_TIMER -DUSE_TMP_BUFFER -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -DORTP_SUPPORT -DSHOW_MESSAGE -g -o miniuacl miniua.o  -pthread ../phapi/libphapicl.a -lpthread -lstdc++
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表