Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#19871 closed defect (wontfix)

gdb @ 6.8 fails to build everything

Reported by: dweber@… Owned by: dweber@…
Priority: Normal Milestone:
Component: ports Version: 1.7.1
Keywords: Cc: SiggyF, karoly@…, alexoedelman@…, CaptSolo, larryv (Lawrence Velázquez)
Port: gdb

Description

I put this Portfile together in the hope that the build and install would be smooth. It's not. It may be that the automatic detection of the target architecture is wrong. The main concern is this:

checking build system type... i386-apple-darwin9.7.0
checking host system type... i386-apple-darwin9.7.0
checking target system type... i386-apple-darwin9.7.0
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for gcc... /usr/bin/gcc-4.0
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether /usr/bin/gcc-4.0 accepts -g... yes
checking for /usr/bin/gcc-4.0 option to accept ANSI C... none needed
checking whether we are using the GNU C++ compiler... yes
checking whether /usr/bin/g++-4.0 accepts -g... yes
checking for gnatbind... no
checking for gnatmake... no
checking whether compiler driver understands Ada... no
checking how to compare bootstrapped objects... cmp --ignore-initial=16 $$f1 $$f2
*** This configuration is not supported in the following subdirectories:
     bfd opcodes gdb sim
    (Any other directories should still work fine.)

So what is happening is the build and install is working, but only partially. It would be preferable that the build fails at this point, but it does not!

It looks like the main thing to get right is the target platform identifier. I looked into it briefly, but it's not resolved yet. I would hope that if the target platform is identified correctly (and fully supported by gdb 6.8), the port will be functional.

If anyone has the motivation and patience to look into it further (as I will when I get time), the first thing to do is to run port in debug mode, i.e.:

sudo port -d destroot gdb

This will provide a lot of information on what port is doing. The destroot target does the configure and build, then runs make install with a custom DESTDIR. MacPorts uses that DESTDIR, called destroot, as a way to parse the files in the port, install the files into /opt/local/var/macports/software/gdb/ and then activate the port with hard links in /opt/local to the files in the software/gdb installation.

The destroot path for this port is

/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_devel_gdb/work/destroot

The pitiful truth is that the only files currently installed there are:

.../destroot/
.../destroot//opt
.../destroot//opt/local
.../destroot//opt/local/lib
.../destroot//opt/local/lib/libiberty.a
.../destroot//opt/local/share
.../destroot//opt/local/share/info
.../destroot//opt/local/share/info/configure.info
.../destroot//opt/local/share/info/standards.info

Attachments (3)

Portfile-gdb-7.0.1 (1.8 KB) - added by raimue (Rainer Müller) 11 years ago.
gdb-7.0.1.log (279.5 KB) - added by raimue (Rainer Müller) 11 years ago.
Portfile-gdb-7.1.50.20100223 (1.8 KB) - added by CaptSolo 11 years ago.

Download all attachments as: .zip

Change History (28)

comment:1 Changed 12 years ago by dweber@…

According to this bug in 2008, this port may not get fixed without access to Apple patches, see:

http://www.nabble.com/build-2464:-Build-fails-on-OSX-Leopard-td17680261.html

comment:2 Changed 12 years ago by dweber@…

Owner: changed from dweber to dweber@…
Status: newassigned

comment:3 Changed 12 years ago by dweber@…

comment:5 Changed 12 years ago by dweber@…

For reference:

[ root@X ~/src/gdb-6.8 ]# /usr/bin/gdb --version
GNU gdb 6.3.50-20050815 (Apple version gdb-962) (Sat Jul 26 08:14:40 UTC 2008)
Copyright 2004 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-apple-darwin".

So the target config name is "i386-apple-darwin" for the gdb supplied by Apple.

comment:6 Changed 12 years ago by dweber@…

Interesting thread about some success in cross-compiling gdb 6.8 for mingw target:

http://sourceware.org/ml/gdb/2008-04/msg00201.html

comment:7 Changed 12 years ago by dweber@…

Apple release notes are outdated:

http://developer.apple.com/releasenotes/developertools/idxCompilersDebuggers-date.html#doclist

#--target=i686-apple-darwin  # failed
#--target=i386-apple-macos   # failed at BFD
#--target=i686-apple-macos   # failed at BFD

comment:8 Changed 12 years ago by dweber@…

Just for the record:

[ root@X ~/src/gdb-6.8/gdb ]# ./configure 
checking whether to enable maintainer-specific portions of Makefiles... no
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking how to run the C preprocessor... gcc -E
checking for egrep... grep -E
checking for AIX... no
checking for library containing strerror... none required
checking for gcc option to accept ANSI C... none needed
checking build system type... i386-apple-darwin9.7.0
checking host system type... i386-apple-darwin9.7.0
checking target system type... i386-apple-darwin9.7.0
checking whether NLS is requested... no
checking libunwind.h usability... no
checking libunwind.h presence... no
checking for libunwind.h... no
checking libunwind-ia64.h usability... no
checking libunwind-ia64.h presence... no
checking for libunwind-ia64.h... no
checking for monstartup... yes
checking for _mcleanup... no
checking for _etext... no
checking for etext... no
checking for gawk... gawk
checking for a BSD-compatible install... /opt/local/bin/ginstall -c
checking whether ln -s works... yes
checking for ranlib... ranlib
checking for bison... bison -y
checking for ar... ar
checking for dlltool... no
checking for windres... no
checking for mig... mig
checking for main in -lm... yes
checking for wctype... yes
checking for library containing gethostbyname... none required
checking for library containing socketpair... none required
checking for library containing waddstr... -lncurses
checking for library containing dlgetmodinfo... no
checking for library containing tgetent... none required
checking whether to use expat... auto
checking for ld used by GCC... /usr/libexec/gcc/i686-apple-darwin9/4.0.1/ld
checking if the linker (/usr/libexec/gcc/i686-apple-darwin9/4.0.1/ld) is GNU ld... no
checking for shared library run path origin... done
checking for libexpat... yes
checking how to link with libexpat... -lexpat
checking for XML_StopParser... yes
checking for dirent.h that defines DIR... yes
checking for library containing opendir... none required
checking whether stat file-mode macros are broken... rm: conftest.dSYM: is a directory
no
checking for ANSI C header files... rm: conftest.dSYM: is a directory
rm: conftest.dSYM: is a directory
yes
checking nlist.h usability... yes
checking nlist.h presence... yes
checking for nlist.h... yes
checking for link.h... no
checking machine/reg.h usability... no
checking machine/reg.h presence... no
checking for machine/reg.h... no
checking poll.h usability... yes
checking poll.h presence... yes
checking for poll.h... yes
checking sys/poll.h usability... yes
checking sys/poll.h presence... yes
checking for sys/poll.h... yes
checking proc_service.h usability... no
checking proc_service.h presence... no
checking for proc_service.h... no
checking thread_db.h usability... no
checking thread_db.h presence... no
checking for thread_db.h... no
checking gnu/libc-version.h usability... no
checking gnu/libc-version.h presence... no
checking for gnu/libc-version.h... no
checking signal.h usability... yes
checking signal.h presence... yes
checking for signal.h... yes
checking stddef.h usability... yes
checking stddef.h presence... yes
checking for stddef.h... yes
checking stdlib.h usability... yes
checking stdlib.h presence... yes
checking for stdlib.h... yes
checking stdint.h usability... yes
checking stdint.h presence... yes
checking for stdint.h... yes
checking string.h usability... yes
checking string.h presence... yes
checking for string.h... yes
checking memory.h usability... yes
checking memory.h presence... yes
checking for memory.h... yes
checking strings.h usability... yes
checking strings.h presence... yes
checking for strings.h... yes
checking sys/fault.h usability... no
checking sys/fault.h presence... no
checking for sys/fault.h... no
checking sys/file.h usability... yes
checking sys/file.h presence... yes
checking for sys/file.h... yes
checking sys/filio.h usability... yes
checking sys/filio.h presence... yes
checking for sys/filio.h... yes
checking sys/ioctl.h usability... yes
checking sys/ioctl.h presence... yes
checking for sys/ioctl.h... yes
checking sys/param.h usability... yes
checking sys/param.h presence... yes
checking for sys/param.h... yes
checking sys/resource.h usability... yes
checking sys/resource.h presence... yes
checking for sys/resource.h... yes
checking for sys/proc.h... no
checking sys/procfs.h usability... no
checking sys/procfs.h presence... no
checking for sys/procfs.h... no
checking sys/ptrace.h usability... no
checking sys/ptrace.h presence... yes
configure: WARNING: sys/ptrace.h: present but cannot be compiled
configure: WARNING: sys/ptrace.h:     check for missing prerequisite headers?
configure: WARNING: sys/ptrace.h: see the Autoconf documentation
configure: WARNING: sys/ptrace.h:     section "Present But Cannot Be Compiled"
configure: WARNING: sys/ptrace.h: proceeding with the preprocessor's result
configure: WARNING: sys/ptrace.h: in the future, the compiler will take precedence
configure: WARNING:     ## ------------------------------------------ ##
configure: WARNING:     ## Report this to the AC_PACKAGE_NAME lists.  ##
configure: WARNING:     ## ------------------------------------------ ##
checking for sys/ptrace.h... yes
checking ptrace.h usability... no
checking ptrace.h presence... no
checking for ptrace.h... no
checking sys/reg.h usability... no
checking sys/reg.h presence... no
checking for sys/reg.h... no
checking sys/debugreg.h usability... no
checking sys/debugreg.h presence... no
checking for sys/debugreg.h... no
checking sys/select.h usability... yes
checking sys/select.h presence... yes
checking for sys/select.h... yes
checking sys/syscall.h usability... yes
checking sys/syscall.h presence... yes
checking for sys/syscall.h... yes
checking sys/types.h usability... yes
checking sys/types.h presence... yes
checking for sys/types.h... yes
checking for sys/user.h... yes
checking sys/wait.h usability... yes
checking sys/wait.h presence... yes
checking for sys/wait.h... yes
checking wait.h usability... no
checking wait.h presence... no
checking for wait.h... no
checking termios.h usability... yes
checking termios.h presence... yes
checking for termios.h... yes
checking termio.h usability... no
checking termio.h presence... no
checking for termio.h... no
checking sgtty.h usability... yes
checking sgtty.h presence... yes
checking for sgtty.h... yes
checking unistd.h usability... yes
checking unistd.h presence... yes
checking for unistd.h... yes
checking curses.h usability... yes
checking curses.h presence... yes
checking for curses.h... yes
checking cursesX.h usability... no
checking cursesX.h presence... no
checking for cursesX.h... no
checking ncurses.h usability... yes
checking ncurses.h presence... yes
checking for ncurses.h... yes
checking ncurses/ncurses.h usability... no
checking ncurses/ncurses.h presence... no
checking for ncurses/ncurses.h... no
checking ncurses/term.h usability... no
checking ncurses/term.h presence... no
checking for ncurses/term.h... no
checking for term.h... yes
checking elf_hp.h usability... no
checking elf_hp.h presence... no
checking for elf_hp.h... no
checking ctype.h usability... yes
checking ctype.h presence... yes
checking for ctype.h... yes
checking time.h usability... yes
checking time.h presence... yes
checking for time.h... yes
looking for a compliant stdint.h in stdint.h, checking for uintmax_t... yes
checking for uintptr_t... yes
checking for int_least32_t... yes
checking for int_fast32_t... yes
checking for uint64_t... yes
checking what to include in gdb_stdint.h... stdint.h (already complete)
checking whether free is declared... yes
checking whether malloc is declared... yes
checking whether realloc is declared... yes
checking whether strerror is declared... yes
checking whether strstr is declared... yes
checking whether getopt is declared... yes
checking whether snprintf is declared... yes
checking whether vsnprintf is declared... yes
checking for struct stat.st_blocks... no
checking for struct stat.st_blksize... no
checking return type of signal handlers... void
checking for socklen_t... yes
checking for uintptr_t... (cached) yes
checking for an ANSI C-conforming const... yes
checking for inline... inline
checking whether byte ordering is bigendian... no
checking for working alloca.h... yes
checking for alloca... yes
checking for stdlib.h... (cached) yes
checking for unistd.h... (cached) yes
checking for getpagesize... yes
checking for working mmap... yes
checking for pid_t... yes
checking for unistd.h... (cached) yes
checking vfork.h usability... no
checking vfork.h presence... no
checking for vfork.h... no
checking for fork... yes
checking for vfork... yes
checking for working fork... yes
checking for working vfork... (cached) yes
checking for canonicalize_file_name... no
checking for realpath... yes
checking for getrusage... yes
checking for getuid... yes
checking for getgid... yes
checking for poll... yes
checking for pread64... no
checking for sbrk... yes
checking for setpgid... yes
checking for setpgrp... yes
checking for sigaction... yes
checking for sigprocmask... yes
checking for sigsetmask... yes
checking for socketpair... yes
checking for syscall... yes
checking for ttrace... no
checking for wborder... yes
checking whether ptrace is declared... yes
checking return type of ptrace... int
checking types of arguments for ptrace... int,pid_t,caddr_t,int
checking whether setpgrp takes no argument... yes
checking for sigsetjmp... yes
checking for GNU regex... no
checking for struct thread.td_pcb... no
checking for struct lwp... no
checking for struct reg in machine/reg.h... no
checking for struct reg.r_fs... no
checking for struct reg.r_gs... no
checking for PTRACE_GETREGS... no
checking for PTRACE_GETFPXREGS... no
checking for PT_GETDBREGS... no
checking for PT_GETXMMREGS... no
checking for member l_addr in struct link_map... no
checking for member lm_addr in struct link_map... no
checking for member som_addr in struct so_map... no
checking for struct link_map32 in sys/link.h... no
checking for long long support in compiler... yes
checking for long long support in printf... yes
checking for decfloat support in printf... no
checking for long double support in compiler... yes
checking for long double support in printf... yes
checking for long double support in scanf... yes
checking whether <sys/syscall.h> has __NR_tkill... no
checking compiler warning flags...  -Wall -Wdeclaration-after-statement -Wpointer-arith -Wformat-nonliteral -Wno-pointer-sign -Wno-unused -Wno-switch -Wno-char-subscripts -Werror
checking for cygwin... rm: conftest.dSYM: is a directory
no
checking for ELF support in BFD... no
checking for X... libraries /opt/local/lib, headers /opt/local/include
configure: error: "*** Gdb does not support native target i386-apple-darwin9.7.0"

comment:9 Changed 12 years ago by dweber@…

Resolution: wontfix
Status: assignedclosed

Similarly, these fail too:

./configure --build=i386-apple-darwin --host=i386-apple-darwin --target=i386-apple-darwin
.
[snipped]
.
configure: error: "*** Gdb does not support native target i386-apple-darwin"

./configure --build=i386-bsd --host=i386-bsd --target=i386-bsd
.
[snipped]
.
configure: error: "*** Gdb does not support native target i386-pc-bsd"

According to bfd/config.bfd, one of the supported targets is:

  i[3-7]86-*-darwin* | i[3-7]86-*-macos10* | i[3-7]86-*-rhapsody*)
    targ_defvec=mach_o_le_vec
    targ_selvecs="mach_o_le_vec mach_o_be_vec mach_o_fat_vec pef_vec pef_xlib_vec sym_vec"
    targ_archs="bfd_i386_arch bfd_powerpc_arch bfd_rs6000_arch"
    ;;

That concludes the examination of the problem to date. The current state of development (testing) for the port may be seen in this Portfile:

https://svn.macosforge.org/repository/macports/users/dweber/devel/gdb/Portfile

The MacPorts trunk Portfile will be disabled at the fetch stage, with a ui_msg about this ticket.

comment:10 Changed 12 years ago by voodoochild2006@…

Recent CVS version of gdb seems to be working on OS X 10.5.8 ... I'm able to get it compiled and running it with emacs 23.

comment:11 Changed 11 years ago by blair (Blair Zajac)

7.0 was announced and it gets further in the build for me, but fails at

libtool: compile:  /usr/bin/gcc-4.2 -DHAVE_CONFIG_H -I. -I. -I. -I./../include -DBINDIR=\"/opt/local/bin\" -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror -O2 -arch x86_64 -MT bfd.lo -MD -MP -MF .deps/bfd.Tpo -c bfd.c -o bfd.o
libtool: compile:  /usr/bin/gcc-4.2 -DHAVE_CONFIG_H -I. -I. -I. -I./../include -DBINDIR=\"/opt/local/bin\" -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror -O2 -arch x86_64 -MT archive.lo -MD -MP -MF .deps/archive.Tpo -c archive.c -o archive.o
In file included from bfdio.c:26:
sysdep.h:173:21: error: libintl.h: No such file or directory
In file included from ./archures.c:24:
./sysdep.h:173:21: error: libintl.h: No such file or directory
In file included from bfd.c:293:
sysdep.h:173:21: error: libintl.h: No such file or directory
In file included from archive.c:132:
sysdep.h:173:21: error: libintl.h: No such file or directory
make[4]: *** [archures.lo] Error 1
make[4]: *** Waiting for unfinished jobs....
make[4]: *** [bfdio.lo] Error 1

comment:12 Changed 11 years ago by dweber@…

Please feel free to submit any Portfiles that work with gdb.

Debugging the builds is beyond me. I gave up on this port a long time ago, but it's still around (somehow). Does anyone want to take this on? If so, please remove me as the Portfile maintainer.

Thanks, Darren

comment:13 in reply to:  11 Changed 11 years ago by mf2k (Frank Schima)

Replying to blair@…:

sysdep.h:173:21: error: libintl.h: No such file or directory

This looks like it needs a dependency on gettext added.

comment:14 Changed 11 years ago by SiggyF

Cc: f.baart@… added

Cc Me!

comment:15 Changed 11 years ago by karoly@…

Cc: karoly@… added

Cc Me!

Changed 11 years ago by raimue (Rainer Müller)

Attachment: Portfile-gdb-7.0.1 added

Changed 11 years ago by raimue (Rainer Müller)

Attachment: gdb-7.0.1.log added

comment:16 Changed 11 years ago by raimue (Rainer Müller)

Tried updating to gdb 7.0.1, but fails at a different point. See attached Portfile and log.

comment:17 in reply to:  16 Changed 11 years ago by raimue (Rainer Müller)

Replying to raimue@…:

Tried updating to gdb 7.0.1, but fails at a different point. See attached Portfile and log.

Looks like the error is the 64-bit build, upstream bug report: http://sourceware.org/bugzilla/show_bug.cgi?id=10751

comment:18 Changed 11 years ago by alexoedelman@…

Cc: alexoedelman@… added

Cc Me!

comment:19 Changed 11 years ago by CaptSolo

Regarding errors building gdb 7.0.1 (see below), is there a way to prevent gdb from building amd64 related stuff?

After all, Mac OS X builds are likely to run on Intel CPUs (though perhaps AMD related code is needed for debugging cross-compiled code).

P.S. should this ticket be re-opened?

:info:build                ../readline/libreadline.a ../opcodes/libopcodes.a ../bfd/libbfd.a -lintl -liconv -lc  ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a    -lncurses -lz -lm   -liconv  -lpython2.6 -lexpat ../libiberty/libiberty.a  gnulib/libgnu.a 
:info:build UndefinedUndefined symbols:
:info:build   " symbols:
:info:build   "_amd64_darwin_thread_state_reg_offset", referenced from:
:info:build       _darwin_complete_target in libgdb.a(i386-darwin-nat.o)
:info:build   "_amd64_darwin_thread_state_num_regs", referenced from:
:info:build       _darwin_complete_target in libgdb.a(i386-darwin-nat.o)
:info:build ld: symbol(s) not found
:info:build _amd64_darwin_thread_state_reg_offset"collect2: ld returned 1 exit status
:info:build , referenced from:
:info:build       _darwin_complete_target in libgdb.a(i386-darwin-nat.o)
:info:build   "_amd64_darwin_thread_state_num_regs", referenced from:
:info:build       _darwin_complete_target in libgdb.a(i386-darwin-nat.o)
:info:build ld: symbol(s) not found
:info:build collect2: ld returned 1 exit status

comment:20 Changed 11 years ago by CaptSolo

Cc: captsolo@… added

Cc Me!

Changed 11 years ago by CaptSolo

comment:21 Changed 11 years ago by CaptSolo

daily tarball of GDB 7.1.50 (.20100223) compiles fine. see attached Portfile.

there is just a small issue when activating the compiled port, which can be worked around by using -f:

--->  Activating gdb @7.1.50.20100223_0
Error: Target org.macports.activate returned: Image error: /opt/local/share/info/standards.info is being used by the active autoconf port.  Please deactivate this port first, or use 'port -f activate gdb' to force the activation.
Error: Status 1 encountered during processing.

comment:22 Changed 11 years ago by CaptSolo

an update: GDB 7.1.50 gets installed fine, but there are problems when trying to load a program to debug (e.g. python in this case):

(gdb) run
Starting program: /opt/local/bin/python 
Unable to find Mach task port for process-id 37881: (os/kern) failure (0x5).
 (please check gdb is codesigned - see taskgated(8))

any ideas how to fix this?

comment:23 Changed 11 years ago by larryv (Lawrence Velázquez)

Cc: larry.velazquez@… added

Cc Me!

comment:24 in reply to:  22 ; Changed 11 years ago by chris.walter@…

Replying to captsolo@…:

an update: GDB 7.1.50 gets installed fine, but there are problems when trying to load a program to debug (e.g. python in this case):

(gdb) run
Starting program: /opt/local/bin/python 
Unable to find Mach task port for process-id 37881: (os/kern) failure (0x5).
 (please check gdb is codesigned - see taskgated(8))

any ideas how to fix this?

I followed the apple discussion thread above to:

http://sourceware.org/gdb/wiki/BuildingOnDarwin

following the advice there and in:

http://lists.apple.com/archives/Darwin-dev/2009/Sep/msg00097.html

I did the following to my local copy (on 10.6.2)

sudo chgrp procmod gdb sudo chmod g+s gdb

after building from the 7.1 cvs branch.

after doing this I was able to successfully debug a fortran program built with mp gfortran 4.4 and 4.5.

It only works for dwarf-2 not stabs+ (so -g alone should work but remember to keep the .o files).

As a plus I can see fortran common block variables which doesn't work in the apple gdb.

I do get a warning like this:

warning: can't find section 'DATA.common' in OSO file XXX

Also there are *lots* of warning like: warning: `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_gcc44/work/build/x86_64-apple-darwin10/libgcc/letf2_s.o': can't open to read symbols: No such file or directory.

when you start the program but it seems to work anyway.

comment:25 in reply to:  24 Changed 11 years ago by chris.walter@…

Also there are *lots* of warning like: warning: `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_gcc44/work/build/x86_64-apple-darwin10/libgcc/letf2_s.o': can't open to read symbols: No such file or directory.

This problem seems to be described here: http://trac.macports.org/ticket/22198

Also, my previous entry had two lines concatenated. It should be:

sudo chgrp procmod gdb

sudo chmod g+s gdb

Note: See TracTickets for help on using tickets.