public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* gdb (gdbserver.exe) build problem under msys
@ 2011-10-26 14:36 asmwarrior
  2011-10-26 14:49 ` Pedro Alves
  2011-10-26 16:37 ` Joel Brobecker
  0 siblings, 2 replies; 9+ messages in thread
From: asmwarrior @ 2011-10-26 14:36 UTC (permalink / raw)
  To: MinGW Users List, gdb; +Cc: Chris Sutcliffe, Xun Xun

Hi, when using msys + gcc 4.6.1 to build the latest version of gdb (gdb cvs head code), I found a problem.

the build step looks like:

mkdir build
cd build
CFLAGS="-O2 -fno-omit-frame-pointer -mtune=i686" \
../gdb/configure \
--prefix=/mingw \
--host=mingw32 \
--build=mingw32 \
--target=mingw32 \
--with-python=/python/python \
--with-expat \
--disable-nls

Then, I just run "make" under the build folder.

I found that gdb.exe was successfully built, but the gdbserver.exe failed. the error log is below:

make[3]: Entering directory `/f/build_gdb/gdb/gdbgit/build/gdb'
make[4]: Entering directory `/f/build_gdb/gdb/gdbgit/build/gdb/doc'
make[4]: Nothing to be done for `all'.
make[4]: Leaving directory `/f/build_gdb/gdb/gdbgit/build/gdb/doc'
make[4]: Entering directory `/f/build_gdb/gdb/gdbgit/build/gdb/gdbserver'
CONFIG_FILES="" CONFIG_HEADERS=config.h:config.in /bin/sh ./config.status
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing default commands
gcc -c -O2 -fno-omit-frame-pointer -mtune=i686 -D__USE_MINGW_ACCESS    -I. -I../../../gdb/gdb/gdbserver -I../../../gdb/gdb/gdbserver/../common -I../../../gdb/gdb/gdbserver/../regformats -I../../../gdb/gdb/gdbserver/../../include -Wall -Wdeclaration-after-statement -Wpointer-arith -Wformat-nonliteral -Wno-char-subscripts -Werror ../../../gdb/gdb/gdbserver/inferiors.c
gcc -c -O2 -fno-omit-frame-pointer -mtune=i686 -D__USE_MINGW_ACCESS    -I. -I../../../gdb/gdb/gdbserver -I../../../gdb/gdb/gdbserver/../common -I../../../gdb/gdb/gdbserver/../regformats -I../../../gdb/gdb/gdbserver/../../include -Wall -Wdeclaration-after-statement -Wpointer-arith -Wformat-nonliteral -Wno-char-subscripts -Werror ../../../gdb/gdb/gdbserver/regcache.c
gcc -c -O2 -fno-omit-frame-pointer -mtune=i686 -D__USE_MINGW_ACCESS    -I. -I../../../gdb/gdb/gdbserver -I../../../gdb/gdb/gdbserver/../common -I../../../gdb/gdb/gdbserver/../regformats -I../../../gdb/gdb/gdbserver/../../include -Wall -Wdeclaration-after-statement -Wpointer-arith -Wformat-nonliteral -Wno-char-subscripts -Werror ../../../gdb/gdb/gdbserver/remote-utils.c
../../../gdb/gdb/gdbserver/remote-utils.c: In function 'handle_accept_event':
../../../gdb/gdb/gdbserver/remote-utils.c:150:22: error: storage size of 'sockaddr' isn't known
../../../gdb/gdb/gdbserver/remote-utils.c:157:3: error: implicit declaration of function 'accept' [-Werror=implicit-function-declaration]
....


I just looked at the build tree, and found that the file:

build/gdb/gdbserver/config.h (this file size if about 9K)

there contains some code:
/* Define if we should use the Windows API, instead of the POSIX API. On
   Windows, we use the Windows API when building for MinGW, but the POSIX API
   when building for Cygwin. */
#undef USE_WIN32API

This is wrong, because the USE_WIN32API should be defined under Windows MSYS.

But when I check the file in the parent folder "build/gdb/config.h", the USE_WIN32API is correctly defined, so that's why gdb.exe can build successfully.

By checking the file "build/gdb/gdbserver/config.log", it looks like all the checking works fine.

So, I guess that something was wrong one the time when 
"build\gdb\gdbserver\config.status" was creating the config.h.

Any one can help me to test it or find the problem?

Thanks.

asmwarrior
ollydbg from codeblocks' forum







^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: gdb (gdbserver.exe) build problem under msys
  2011-10-26 14:36 gdb (gdbserver.exe) build problem under msys asmwarrior
@ 2011-10-26 14:49 ` Pedro Alves
  2011-10-27  0:55   ` Asmwarrior
                     ` (3 more replies)
  2011-10-26 16:37 ` Joel Brobecker
  1 sibling, 4 replies; 9+ messages in thread
From: Pedro Alves @ 2011-10-26 14:49 UTC (permalink / raw)
  To: gdb; +Cc: asmwarrior, MinGW Users List, Chris Sutcliffe, Xun Xun

On Wednesday 26 October 2011 13:28:34, asmwarrior wrote:
> Hi, when using msys + gcc 4.6.1 to build the latest version of gdb (gdb cvs head code), I found a problem.
> 
> the build step looks like:
> 
> mkdir build
> cd build
> CFLAGS="-O2 -fno-omit-frame-pointer -mtune=i686" \
> ../gdb/configure \
> --prefix=/mingw \
> --host=mingw32 \
> --build=mingw32 \
> --target=mingw32 \
> --with-python=/python/python \
> --with-expat \
> --disable-nls
> 
> Then, I just run "make" under the build folder.
> 
> I found that gdb.exe was successfully built, but the gdbserver.exe failed. the error log is below:
> 
> make[3]: Entering directory `/f/build_gdb/gdb/gdbgit/build/gdb'
> make[4]: Entering directory `/f/build_gdb/gdb/gdbgit/build/gdb/doc'
> make[4]: Nothing to be done for `all'.
> make[4]: Leaving directory `/f/build_gdb/gdb/gdbgit/build/gdb/doc'
> make[4]: Entering directory `/f/build_gdb/gdb/gdbgit/build/gdb/gdbserver'
> CONFIG_FILES="" CONFIG_HEADERS=config.h:config.in /bin/sh ./config.status
> config.status: creating config.h
> config.status: config.h is unchanged
> config.status: executing default commands
> gcc -c -O2 -fno-omit-frame-pointer -mtune=i686 -D__USE_MINGW_ACCESS    -I. -I../../../gdb/gdb/gdbserver -I../../../gdb/gdb/gdbserver/../common -I../../../gdb/gdb/gdbserver/../regformats -I../../../gdb/gdb/gdbserver/../../include -Wall -Wdeclaration-after-statement -Wpointer-arith -Wformat-nonliteral -Wno-char-subscripts -Werror ../../../gdb/gdb/gdbserver/inferiors.c
> gcc -c -O2 -fno-omit-frame-pointer -mtune=i686 -D__USE_MINGW_ACCESS    -I. -I../../../gdb/gdb/gdbserver -I../../../gdb/gdb/gdbserver/../common -I../../../gdb/gdb/gdbserver/../regformats -I../../../gdb/gdb/gdbserver/../../include -Wall -Wdeclaration-after-statement -Wpointer-arith -Wformat-nonliteral -Wno-char-subscripts -Werror ../../../gdb/gdb/gdbserver/regcache.c
> gcc -c -O2 -fno-omit-frame-pointer -mtune=i686 -D__USE_MINGW_ACCESS    -I. -I../../../gdb/gdb/gdbserver -I../../../gdb/gdb/gdbserver/../common -I../../../gdb/gdb/gdbserver/../regformats -I../../../gdb/gdb/gdbserver/../../include -Wall -Wdeclaration-after-statement -Wpointer-arith -Wformat-nonliteral -Wno-char-subscripts -Werror ../../../gdb/gdb/gdbserver/remote-utils.c
> ../../../gdb/gdb/gdbserver/remote-utils.c: In function 'handle_accept_event':
> ../../../gdb/gdb/gdbserver/remote-utils.c:150:22: error: storage size of 'sockaddr' isn't known
> ../../../gdb/gdb/gdbserver/remote-utils.c:157:3: error: implicit declaration of function 'accept' [-Werror=implicit-function-declaration]
> ....
> 
> 
> I just looked at the build tree, and found that the file:
> 
> build/gdb/gdbserver/config.h (this file size if about 9K)
> 
> there contains some code:
> /* Define if we should use the Windows API, instead of the POSIX API. On
>    Windows, we use the Windows API when building for MinGW, but the POSIX API
>    when building for Cygwin. */
> #undef USE_WIN32API
> 
> This is wrong, because the USE_WIN32API should be defined under Windows MSYS.
> 
> But when I check the file in the parent folder "build/gdb/config.h", the USE_WIN32API is correctly defined, so that's why gdb.exe can build successfully.
> 
> By checking the file "build/gdb/gdbserver/config.log", it looks like all the checking works fine.
> 
> So, I guess that something was wrong one the time when 
> "build\gdb\gdbserver\config.status" was creating the config.h.
> 
> Any one can help me to test it or find the problem?

gdbserver/configure.ac has:

if test "${srv_mingw}" = "yes"; then
  AC_DEFINE(USE_WIN32API, 1,
            [Define if we should use the Windows API, instead of the
             POSIX API.  On Windows, we use the Windows API when
             building for MinGW, but the POSIX API when building
             for Cygwin.])
fi

and gdbserver/configure.srv has:

case "${target}" in
...
  i[34567]86-*-mingw*)	srv_regobj="$srv_i386_regobj"
			srv_tgtobj="i386-low.o win32-low.o win32-i386-low.o"
			srv_xmlfiles="$srv_i386_xmlfiles"
			srv_mingw=yes
			;;
...
  x86_64-*-mingw*)	srv_regobj="$srv_amd64_regobj"
			srv_tgtobj="i386-low.o i387-fp.o win32-low.o win32-i386-low.o"
			srv_xmlfiles="$srv_i386_xmlfiles $srv_amd64_xmlfiles"
			srv_mingw=yes
			;;

So in order for USE_WIN32API not to be defined, ${target} didn't
match above.

Try, e.g., checking what does "grep ac_cv_target gdbserver/config.log"
and "grep ac_cv_host gdbserver/config.log" say.

-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: gdb (gdbserver.exe) build problem under msys
  2011-10-26 14:36 gdb (gdbserver.exe) build problem under msys asmwarrior
  2011-10-26 14:49 ` Pedro Alves
@ 2011-10-26 16:37 ` Joel Brobecker
  2011-10-26 19:10   ` Pedro Alves
  2011-10-26 23:10   ` Petr Hluzín
  1 sibling, 2 replies; 9+ messages in thread
From: Joel Brobecker @ 2011-10-26 16:37 UTC (permalink / raw)
  To: asmwarrior; +Cc: gdb

> --host=mingw32 \
> --build=mingw32 \
> --target=mingw32 \

I've never configure with just `mingw32'. It's always been a triplet
(such as 'i686-pc-mingw32'). Is that supposed to work?

-- 
Joel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: gdb (gdbserver.exe) build problem under msys
  2011-10-26 16:37 ` Joel Brobecker
@ 2011-10-26 19:10   ` Pedro Alves
  2011-10-26 23:10   ` Petr Hluzín
  1 sibling, 0 replies; 9+ messages in thread
From: Pedro Alves @ 2011-10-26 19:10 UTC (permalink / raw)
  To: gdb; +Cc: Joel Brobecker, asmwarrior

On Wednesday 26 October 2011 16:55:56, Joel Brobecker wrote:
> > --host=mingw32 \
> > --build=mingw32 \
> > --target=mingw32 \
> 
> I've never configure with just `mingw32'. It's always been a triplet
> (such as 'i686-pc-mingw32'). Is that supposed to work?

I think so.  config.sub will expand it to canonical form:

$ src/config.sub mingw32
i386-pc-mingw32

But it's likely that something is going on with that.

-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: gdb (gdbserver.exe) build problem under msys
  2011-10-26 16:37 ` Joel Brobecker
  2011-10-26 19:10   ` Pedro Alves
@ 2011-10-26 23:10   ` Petr Hluzín
  1 sibling, 0 replies; 9+ messages in thread
From: Petr Hluzín @ 2011-10-26 23:10 UTC (permalink / raw)
  To: asmwarrior; +Cc: Joel Brobecker, gdb

On 26 October 2011 17:55, Joel Brobecker <brobecker@adacore.com> wrote:
>> --host=mingw32 \
>> --build=mingw32 \
>> --target=mingw32 \
>
> I've never configure with just `mingw32'. It's always been a triplet
> (such as 'i686-pc-mingw32'). Is that supposed to work?

I successfully used this line (if it is any use for you):
./configure  --host=mingw32 --target=avr --with-expat CFLAGS="-s
-L/C/Python27/libs -I/C/Python27/PH-temp/include
-I/c/gdb-7.3/expat-2.0.1/include -static -L/c/gdb-7.3/expat-2.0.1/lib"
 --with-python --with-expat

-- 
Petr Hluzin

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: gdb (gdbserver.exe) build problem under msys
  2011-10-26 14:49 ` Pedro Alves
@ 2011-10-27  0:55   ` Asmwarrior
  2011-10-27  2:31   ` Asmwarrior
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: Asmwarrior @ 2011-10-27  0:55 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb, MinGW Users List, Chris Sutcliffe, Xun Xun

On 2011-10-26 22:36, Pedro Alves wrote:
> Try, e.g., checking what does "grep ac_cv_target gdbserver/config.log"
> and "grep ac_cv_host gdbserver/config.log" say.
Thanks for your help.
I just check the config.log, and found that:

ac_cv_target = i386-pc-mingw32
ac_cv_host= i386-pc-mingw32

So, it looks like they are correct.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: gdb (gdbserver.exe) build problem under msys
  2011-10-26 14:49 ` Pedro Alves
  2011-10-27  0:55   ` Asmwarrior
@ 2011-10-27  2:31   ` Asmwarrior
  2011-10-27  7:10   ` Asmwarrior
  2011-10-27 14:48   ` asmwarrior
  3 siblings, 0 replies; 9+ messages in thread
From: Asmwarrior @ 2011-10-27  2:31 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb, MinGW Users List, Chris Sutcliffe, Xun Xun

The strange thing is that at the bottom of the file:
build\gdb\gdbserver\config.log, there are some thing like:

## ----------- ##
## confdefs.h. ##
## ----------- ##

/* confdefs.h */
#define PACKAGE_NAME ""
#define PACKAGE_TARNAME ""
#define PACKAGE_VERSION ""
#define PACKAGE_STRING ""
#define PACKAGE_BUGREPORT ""
#define PACKAGE_URL ""
#define STDC_HEADERS 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRING_H 1
#define HAVE_MEMORY_H 1
#define HAVE_STRINGS_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_STDINT_H 1
#define HAVE_UNISTD_H 1
#define __EXTENSIONS__ 1
#define _ALL_SOURCE 1
#define _GNU_SOURCE 1
#define _POSIX_PTHREAD_SEMANTICS 1
#define _TANDEM_SOURCE 1
#define STDC_HEADERS 1
#define HAVE_DIRENT_H 1
#define HAVE_ALLOCA 1
#define HAVE_STRING_H 1
#define HAVE_STDLIB_H 1
#define HAVE_UNISTD_H 1
#define HAVE_ERRNO_H 1
#define HAVE_FCNTL_H 1
#define HAVE_SIGNAL_H 1
#define HAVE_SYS_FILE_H 1
#define HAVE_MALLOC_H 1
#define HAVE_VSNPRINTF 1
#define HAVE_ERRNO 1
#define HAVE_DECL_STRERROR 1
#define HAVE_DECL_PERROR 1
#define HAVE_DECL_MEMMEM 0
#define HAVE_DECL_VASPRINTF 0
#define HAVE_DECL_VSNPRINTF 1
#define PKGVERSION "(GDB) "
#define REPORT_BUGS_TO "<http://www.gnu.org/software/gdb/bugs/>"
#define USE_WIN32API 1
#define HAVE_LIBDL 1
#define USE_XML 1
#define HAVE_SYNC_BUILTINS 1
#define HAVE_DECL_ADDR_NO_RANDOMIZE 0

configure: exit 0


So, the value:  USE_WIN32API is defined.

But I'm not sure why the generated config.h was not respect the value in
config.log.

asmwarrior


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: gdb (gdbserver.exe) build problem under msys
  2011-10-26 14:49 ` Pedro Alves
  2011-10-27  0:55   ` Asmwarrior
  2011-10-27  2:31   ` Asmwarrior
@ 2011-10-27  7:10   ` Asmwarrior
  2011-10-27 14:48   ` asmwarrior
  3 siblings, 0 replies; 9+ messages in thread
From: Asmwarrior @ 2011-10-27  7:10 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb, MinGW Users List, Chris Sutcliffe, Xun Xun

I tried again, and still failed.

This time, I found the config.h under gdbserver was overwritten by some
script I don't know when running make.
Here is the base steps:
1, running the toplevel configure.
2, running "make" command. (this will automatically run configure and
make in each sub-folders)

I monitor the folder build/gdb/gdbserver

At some time there will be a config.h file generated, and I opened it.
and all the definition macros seems correct.

But after building the gdb.exe, I found that the config.h file under
 build/gdb/gdbserver was changed (overwritten by some unknown reason),
and its definition was wrong. so building gdbserver.exe failed.

That's too strange. It looks like other configuration/make stages will
change the config.h under gdbsever?

---------------------------------------------------------------------
Here is another test:

If I create a new build folder, and did the things below:
cd build
mkdir gdb
CFLAGS="-O2 -fno-omit-frame-pointer -mtune=i686" \
../../gdb/gdb/configure \
--prefix=/mingw \
--host=mingw32 \
--build=mingw32 \
--target=mingw32 \
--with-python=/python/python \
--with-expat \
--disable-nls
---------------------------------------------------------------------
After the configure, I check the file build/gdb/gdbserver/config.h
It was correct.


But if I run such configure steps on my previous build tree.(the build
tree I failed building gdbserver.exe)
then, the generated build/gdb/gdbserver/config.h was wrong.

So, what I can guess is that some parent level configure setting will
affect the inner folder setting? Or the make command will later change
the inner folder's config.h?

thanks.
asmwarrior


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: gdb (gdbserver.exe) build problem under msys
  2011-10-26 14:49 ` Pedro Alves
                     ` (2 preceding siblings ...)
  2011-10-27  7:10   ` Asmwarrior
@ 2011-10-27 14:48   ` asmwarrior
  3 siblings, 0 replies; 9+ messages in thread
From: asmwarrior @ 2011-10-27 14:48 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb, MinGW Users List, Chris Sutcliffe, Xun Xun

Hi, all, I have solved my problem. 

It's quite simple problem due to the Line Ending. 

As some days ago, I updated the MSYSGit to a new version, and then MsysGit by default will convert the Linux LF line ending to Windows CRLF format. (when I used this new MSYSGit to pull from the remote gdb git, the new updated file in my local copy will have CRLF format). So, I found that in the source tree, the file gdb/gdbserver/config.in has the CRLF format, and this will result a wrong file in the build tree gdb/gdbserver/config.h.

(I have used to run the "config.status --debug" to see whether the awk script works fine to replace macros in config.in)

Changing all the related files to LF format solved the problem, and now all was built successfully. 

Sorry, for the inconvenience.

In fact, I have meet such kind of problem one years ago, see: (The problem bite me again today)
See the post of mine on how to solve such problem.
http://sourceware.org/ml/gdb/2010-12/msg00043.html

Thank you!

Asmwarrior
ollydbg from codeblocks' forum

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-10-27  7:37 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-26 14:36 gdb (gdbserver.exe) build problem under msys asmwarrior
2011-10-26 14:49 ` Pedro Alves
2011-10-27  0:55   ` Asmwarrior
2011-10-27  2:31   ` Asmwarrior
2011-10-27  7:10   ` Asmwarrior
2011-10-27 14:48   ` asmwarrior
2011-10-26 16:37 ` Joel Brobecker
2011-10-26 19:10   ` Pedro Alves
2011-10-26 23:10   ` Petr Hluzín

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).