Menu

How build gdb for windows target and arm-none-eabi?

Marcin
2016-02-16
2016-02-20
  • Marcin

    Marcin - 2016-02-16

    Hi.
    How can I build gdb for windows target and arm-none-eabi?
    What am I doing wrong?

    I installed msys2-x86_64-20160205.exe for windows 7.
    Run mingw64_shell.bat

    Run update-core
    Run pacman -Su

    Install toolchain packages and others

    pacman -S mingw-w64-x86_64-toolchain

    PATH=/c/msys64/bin:/c/msys64/mingw64/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/c/gnu/cross-gcc/out/bin:/usr/bin/site_perl:/usr/bin/core_perl:/c/windows/system32

    export PATH=/c/msys64/bin:/c/msys64/mingw64/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/c/gnu/cross-gcc/out/bin:/usr/bin/site_perl:/usr/bin/core_perl:/c/windows/system32

    cd /c/gnu/gcc-source/

    I downloaded from the server ftp://ftp.gnu.org/gnu/gdb archive gdb-7.10.tar.gz and unpacked it in the directory /c/gnu/gcc-source/

    tar xzfv gdb-7.10.tar.gz

    mkdir /c/gnu/gcc-source/gdb-7.10-build
    mkdir /c/gnu/cross-gcc/out

    cd gdb-7.10-build/

    ../gdb-7.10/configure --prefix=/c/gnu/cross-gcc/out --with-system-readline

    Configuration completed successfully.
    Compilation failed.

    In file included from ../../gdb-7.10/gdb/ser-base.c:25:0:
    ../../gdb-7.10/gdb/gdb_select.h:33:31: error: unknown type name 'fd_set'
    extern int gdb_select (int n, fd_set readfds, fd_set writefds,
    ^
    ../../gdb-7.10/gdb/gdb_select.h:33:48: error: unknown type name 'fd_set'
    extern int gdb_select (int n, fd_set readfds, fd_set writefds,
    ^
    ../../gdb-7.10/gdb/gdb_select.h:34:10: error: unknown type name 'fd_set'
    fd_set exceptfds, struct timeval timeout);
    ^
    ../../gdb-7.10/gdb/ser-base.c: In function 'ser_base_wait_for':
    ../../gdb-7.10/gdb/ser-base.c:209:7: error: unknown type name 'fd_set'
    fd_set readfds, exceptfds;
    ^
    ../../gdb-7.10/gdb/ser-base.c:218:7: warning: implicit declaration of function 'FD_ZERO' [-Wimplicit-function-declaration]
    FD_ZERO (&readfds);
    ^
    ../../gdb-7.10/gdb/ser-base.c:220:7: warning: implicit declaration of function 'FD_SET' [-Wimplicit-function-declaration]
    FD_SET (scb->fd, &readfds);
    ^
    ../../gdb-7.10/gdb/ser-base.c:224:11: warning: implicit declaration of function 'gdb_select' [-Wimplicit-function-declaration]
    numfds = gdb_select (scb->fd + 1, &readfds, 0, &exceptfds, &tv);
    ^
    Makefile: 1123: command object 'cheese-base.o' failed
    make [2]: [ser-base.o] Error 1
    make [2]: Leaving directory '/c/gnu/gcc-source/gdb-7.10-build/gdb'
    Makefile: 9096: command object 'all-gdb' failed
    make [1]:
    [all-gdb] Error 2
    make [1]: Leaving directory '/c/gnu/gcc-source/gdb-7.10-build'
    Makefile: 852: command object 'all' failed
    make: *** [all] Error 2

    Please help solve the problem
    Greetings.

     

    Last edit: Marcin 2016-02-16
  • Marcin

    Marcin - 2016-02-16

    That works for target x86_64-w64-mingw32.

    cd /c/gnu/gcc-source/gdb-7.10-build/
    make distclean
    rm -r -d *

    ../gdb-7.10/configure --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=/c/gnu/out/gdb --with-system-readline
    make
    make install

    You need a library libreadline6.dll and libtermcap-0.dll in gdb directory.
    Greetings.

     
  • Marcin

    Marcin - 2016-02-17

    It does not work.
    Build gdb for arm-none-eabi failed.
    Anybody help me?

    Compiler for arm compiled properly and is in the directory /c/cross-gcc/out/bin


    ../gcc-5.3.0/configure --target=arm-none-eabi --prefix=/c/gnu/cross-gcc/out \
    --enable-twoprocess
    --enable-win32-registry=MyToolchain \
    --enable-interwork \
    --enable-multilib \
    --enable-languages=c,c++ \
    --with-newlib \
    --with-headers=../newlib-2.3.0.20160104/newlib/libc/include \
    --with-system-zlib

    $ LANG=us_US.UTF8
    PATH=/c/msys64/bin:/c/msys64/mingw64/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/c/gnu/cross-gcc/out/bin:/usr/bin/site_perl:/usr/bin/core_perl:/c/windows/system32
    export PATH=/c/msys64/bin:/c/msys64/mingw64/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/c/gnu/cross-gcc/out/bin:/usr/bin/site_perl:/usr/bin/core_perl:/c/windows/system32

    cd /c/gnu/gcc-source/gdb-7.10-build/
    make distclean
    rm -r -d *


    ../gdb-7.10/configure --target=arm-none-eabi \
    --build=x86_64-w64-mingw32 \
    --host=x86_64-w64-mingw32 \
    --prefix=/c/gnu/cross-gcc/out \
    --with-system-readline
    make

    ...
    In file included from ../../gdb-7.10/gdb/ser-base.c:25:0:
    ../../gdb-7.10/gdb/gdb_select.h:33:31: error: unknown type name 'fd_set'
    extern int gdb_select (int n, fd_set readfds, fd_set writefds,
    ^
    ../../gdb-7.10/gdb/gdb_select.h:33:48: error: unknown type name 'fd_set'
    extern int gdb_select (int n, fd_set readfds, fd_set writefds,
    ^
    ../../gdb-7.10/gdb/gdb_select.h:34:10: error: unknown type name 'fd_set'
    fd_set exceptfds, struct timeval timeout);
    ^
    ../../gdb-7.10/gdb/ser-base.c: In function 'ser_base_wait_for':
    ../../gdb-7.10/gdb/ser-base.c:209:7: error: unknown type name 'fd_set'
    fd_set readfds, exceptfds;
    ^
    ../../gdb-7.10/gdb/ser-base.c:218:7: warning: implicit declaration of function 'FD_ZERO' [-Wimplicit-function-declaration]
    FD_ZERO (&readfds);
    ^
    ../../gdb-7.10/gdb/ser-base.c:220:7: warning: implicit declaration of function 'FD_SET' [-Wimplicit-function-declaration]
    FD_SET (scb->fd, &readfds);
    ^
    ../../gdb-7.10/gdb/ser-base.c:224:11: warning: implicit declaration of function 'gdb_select' [-Wimplicit-function-declaration]
    numfds = gdb_select (scb->fd + 1, &readfds, 0, &exceptfds, &tv);
    ^
    Makefile:1122: recipe for target 'ser-base.o' failed
    make[2]: [ser-base.o] Error 1
    make[2]: Leaving directory '/c/gnu/gcc-source/gdb-7.10-build/gdb'
    Makefile:9096: recipe for target 'all-gdb' failed
    make[1]:
    [all-gdb] Error 2
    make[1]: Leaving directory '/c/gnu/gcc-source/gdb-7.10-build'
    Makefile:852: recipe for target 'all' failed
    make: *** [all] Error 2

     

    Last edit: Marcin 2016-02-17
    • Matthieu Vachon

      Matthieu Vachon - 2016-02-17

      Hi Marcin,

      A year or so from today, I had compiled a full cross-compiler suite
      targeting the Rpi architecture (compiler running on Windows, target ). This
      is of course slightly different than you, but I had written down
      instructions and exact commands I had run to produce it.The target is
      indeed different than yours, but I think the steps might help you get it to
      work correctly.

      In the process, I had compiled GDB version 7.4.1 at that time. I don't know
      what is your error currently, but I'm linking links to my old notes so
      maybe you can sort it out.

      Hope this help you get it to work.

      Regards,
      Matt

      On Wed, Feb 17, 2016 at 3:19 AM Marcin matong@users.sf.net wrote:

      It does not work.
      Compiler for arm compiled properly and is in the directory
      /c/cross-gcc/out/bin
      ../gcc-5.3.0/configure --enable-twoprocess --target=arm-none-eabi
      --prefix=/c/gnu/cross-gcc/out \ --enable-win32-registry=MyToolchain \ --enable-interwork \ --enable-multilib \ --enable-languages=c,c++ \ --with-newlib \ --with-headers=../newlib-2.3.0.20160104/newlib/libc/include
      \ --with-system-zlib

      $ LANG=us_US.UTF8

      PATH=/c/msys64/bin:/c/msys64/mingw64/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/c/gnu/cross-gcc/out/bin:/usr/bin/site_perl:/usr/bin/core_perl:/c/windows/system32

      export
      PATH=/c/msys64/bin:/c/msys64/mingw64/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/c/gnu/cross-gcc/out/bin:/usr/bin/site_perl:/usr/bin/core_perl:/c/windows/system32

      cd /c/gnu/gcc-source/gdb-7.10-build/

      make distclean
      rm -r -d *

      ../gdb-7.10/configure --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32
      --target=arm-none-eabi --prefix=/c/gnu/out/gdb --with-system-readline
      make

      ...

      In file included from ../../gdb-7.10/gdb/ser-base.c:25:0:
      ../../gdb-7.10/gdb/gdb_select.h:33:31: error: unknown type name 'fd_set'
      extern int gdb_select (int n, fd_set readfds, fd_set writefds,
      ^
      ../../gdb-7.10/gdb/gdb_select.h:33:48: error: unknown type name 'fd_set'
      extern int gdb_select (int n, fd_set readfds, fd_set writefds,
      ^
      ../../gdb-7.10/gdb/gdb_select.h:34:10: error: unknown type name 'fd_set'
      fd_set exceptfds, struct timeval timeout);
      ^
      ../../gdb-7.10/gdb/ser-base.c: In function 'ser_base_wait_for':
      ../../gdb-7.10/gdb/ser-base.c:209:7: error: unknown type name 'fd_set'
      fd_set readfds, exceptfds;
      ^
      ../../gdb-7.10/gdb/ser-base.c:218:7: warning: implicit declaration of
      function 'FD_ZERO' [-Wimplicit-function-declaration]
      FD_ZERO (&readfds);
      ^
      ../../gdb-7.10/gdb/ser-base.c:220:7: warning: implicit declaration of
      function 'FD_SET' [-Wimplicit-function-declaration]
      FD_SET (scb->fd, &readfds);
      ^
      ../../gdb-7.10/gdb/ser-base.c:224:11: warning: implicit declaration of
      function 'gdb_select' [-Wimplicit-function-declaration]
      numfds = gdb_select (scb->fd + 1, &readfds, 0, &exceptfds, &tv);
      ^

      Makefile:1122: recipe for target 'ser-base.o' failed
      make[2]: * [ser-base.o] Error 1*

      • make[2]: Leaving directory '/c/gnu/gcc-source/gdb-7.10-build/gdb'*

      • Makefile:9096: recipe for target 'all-gdb' failed make[1]: * [all-gdb]
        Error 2

      make[1]: Leaving directory '/c/gnu/gcc-source/gdb-7.10-build'

      Makefile:852: recipe for target 'all' failed

      make: *** [all] Error 2

      How build gdb for windows target and arm-none-eabi?
      https://sourceforge.net/p/msys2/discussion/general/thread/582bfc38/?limit=25#bac5


      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/msys2/discussion/general/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       
  • Marcin

    Marcin - 2016-02-18

    Thank you very much for your help.
    I am a beginner and do not understand all the dependencies.

    I was able to compile gdb with the settings as shown below:

    PATH=/c/msys64/bin:/c/msys64/mingw64/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/c/gnu/cross-gcc/out/bin:/usr/bin/site_perl:/usr/bin/core_perl:/c/windows/system32
    export PATH=/c/msys64/bin:/c/msys64/mingw64/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/c/gnu/cross-gcc/out/bin:/usr/bin/site_perl:/usr/bin/core_perl:/c/windows/system32

    cd /c/gnu/gcc-source/gdb-7.10-build/

    TARGET=arm-none-eabi
    export TARGET=arm-none-eabi
    PREFIX=/c/gnu/cross-gcc/out
    export PREFIX=/c/gnu/cross-gcc/out

    ./configure --build=x86_64-pc-mingw32 --target=arm-none-eabi --prefix=/c/gnu/out --with-expat
    make
    make install

    $file arm-none-eabi-gdb.exe
    arm-none-eabi-gdb.exe; PE32+ executable for MS Windows (console) Mono/.Net assem
    bly

    You need a library libintl-8.dll, libpython2.7.dll, libwinpthread-1.dll in gdb directory.

    Do I need to compile gdbserver for arm-none-eabi?
    Attempting to configure gdbserver failed.

    PATH=/c/msys64/bin:/c/msys64/mingw64/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/c/gnu/cross-gcc/out/bin:/usr/bin/site_perl:/usr/bin/core_perl:/c/windows/system32
    export PATH=/c/msys64/bin:/c/msys64/mingw64/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/c/gnu/cross-gcc/out/bin:/usr/bin/site_perl:/usr/bin/core_perl:/c/windows/system32

    TARGET=arm-none-eabi
    export TARGET=arm-none-eabi
    PREFIX=/c/gnu/cross-gcc/out
    export PREFIX=/c/gnu/cross-gcc/out

    cd /c/gnu/gcc-source/gdb-7.10-build/gdb/gdbserver/
    $ CC=$PREFIX/bin/$TARGET-gcc LDFLAGS=-static ./configure --build=x86_64-pc-mingw32 --host=$TARGET
    ...
    Configure Error: target not supported by gdbserver.

    Greetings.

     

    Last edit: Marcin 2016-02-18
    • Matthieu Vachon

      Matthieu Vachon - 2016-02-18

      Hi,

      Glad it helps, I'm not expert either but thought this could help you.

      Just some quick notes, first no need to TARGET=arm-none-eabi if you do
      export TARGET=arm-none-eabi, the second one is good enough. Second, in
      the GDB compilation, you did not use the environment variables defined
      before, so there were in fact not needed.

      For gdbserver, I never played with it. From my understanding (anyone,
      correct if I'm wrong), the server does not handle any information related
      to the actual architecture, this seems to be the job of the actual gdb.
      So, I think it does not need to know for which target it must compiled. It
      simply need to be able to execute on the system you intend to run it into.
      Not sure I'm clear but I do not understand where exactly it should run
      (host or guest) so hard to help you here.

      Matt

      On Thu, Feb 18, 2016 at 4:45 AM Marcin matong@users.sf.net wrote:

      Thank you very much for your help.
      I am a beginner and do not understand all the dependencies.

      I was able to compile gdb with the settings as shown below:

      PATH=/c/msys64/bin:/c/msys64/mingw64/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/c/gnu/cross-gcc/out/bin:/usr/bin/site_perl:/usr/bin/core_perl:/c/windows/system32
      export
      PATH=/c/msys64/bin:/c/msys64/mingw64/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/c/gnu/cross-gcc/out/bin:/usr/bin/site_perl:/usr/bin/core_perl:/c/windows/system32

      cd /c/gnu/gcc-source/gdb-7.10-build/

      TARGET=arm-none-eabi
      export TARGET=arm-none-eabi
      PREFIX=/c/gnu/cross-gcc/out
      export PREFIX=/c/gnu/cross-gcc/out

      ./configure --build=x86_64-pc-mingw32 --target=arm-none-eabi
      --prefix=/c/gnu/out --with-expat
      make
      make install

      $file arm-none-eabi-gdb.exe
      arm-none-eabi-gdb.exe; PE32+ executable for MS Windows (console) Mono/.Net
      assem
      bly

      You need a library libintl-8.dll, libpython2.7.dll, libwinpthread-1.dll in
      gdb directory.

      Do I need to compile gdbserver for arm-none-eabi? Attempting to configure
      gdbserver failed.

      PATH=/c/msys64/bin:/c/msys64/mingw64/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/c/gnu/cross-gcc/out/bin:/usr/bin/site_perl:/usr/bin/core_perl:/c/windows/system32
      export
      PATH=/c/msys64/bin:/c/msys64/mingw64/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/c/gnu/cross-gcc/out/bin:/usr/bin/site_perl:/usr/bin/core_perl:/c/windows/system32

      TARGET=arm-none-eabi
      export TARGET=arm-none-eabi
      PREFIX=/c/gnu/cross-gcc/out
      export PREFIX=/c/gnu/cross-gcc/out

      cd /c/gnu/gcc-source/gdb-7.10-build/gdb/gdbserver/
      $ CC=$PREFIX/bin/$TARGET-gcc LDFLAGS=-static ./configure
      --build=x86_64-pc-mingw32 --host=$TARGET
      CC=$PREFIX/bin/$TARGET-gcc LDFLAGS=-static make
      ...
      Configure Error: target not supported by gdbserver.

      Greetings.

      How build gdb for windows target and arm-none-eabi?
      https://sourceforge.net/p/msys2/discussion/general/thread/582bfc38/?limit=25#2f73


      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/msys2/discussion/general/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       
  • David Macek

    David Macek - 2016-02-20

    See docs on gdbserver. If I'm not mistaken, it's supposed to run on the target architecture (where the debugged program runs) and communicate with a gdb instance running on another computer (without any requirements on its architecture).