microblaze-unknown-linux-gnu : cross-gdb failed

Stephan Linz linz@li-pro.net
Sun Oct 7 12:25:00 GMT 2012


Hi David, Nagaraju and All


first of all, based on Davids patch to use customized source trees for
binutils/gcc/eglibs I've successfully rebuild the sources presented on
git.xilinx.com page (see description below on the end).

Now I run into a problem with cross-gdb I'll try to fix together with
the maintainer from Xilinx and Crosstool-NG.

The cross-gdb step breaks with the following message:
[INFO ]  Installing cross-gdb
[ERROR]    /store/devel/TOOLCHAINS/crosstool-ng/targets/src/gdb-custom/gdb/../opcodes/../opcodes/microblaze-opcm.h:34: error: 'sleep' redeclared as different kind of symbol
[ERROR]    make[3]: *** [microblaze-tdep.o] Error 1
[ERROR]    make[2]: *** [all-gdb] Error 2
[ERROR]    make[1]: *** [all] Error 2

The build.log says:
[ALL  ]    In file included
from /store/devel/TOOLCHAINS/crosstool-ng/targets/src/gdb-custom/gdb/microblaze-tdep.c:41:
[ERROR]    /store/devel/TOOLCHAINS/crosstool-ng/targets/src/gdb-custom/gdb/../opcodes/../opcodes/microblaze-opcm.h:34: error: 'sleep' redeclared as different kind of symbol
[ALL  ]    /usr/include/unistd.h:441: note: previous declaration of
'sleep' was here
[ALL  ]    /store/devel/TOOLCHAINS/crosstool-ng/targets/src/gdb-custom/gdb/microblaze-tdep.c:697: warning: no previous prototype for 'microblaze_software_single_step'
[ALL  ]    /store/devel/TOOLCHAINS/crosstool-ng/targets/src/gdb-custom/gdb/microblaze-tdep.c: In function 'microblaze_supply_gregset':
[ALL  ]    /store/devel/TOOLCHAINS/crosstool-ng/targets/src/gdb-custom/gdb/microblaze-tdep.c:841: warning: initialization discards qualifiers from pointer target type
[ERROR]    make[3]: *** [microblaze-tdep.o] Error 1
[ALL  ]    make[3]: Leaving directory
`/store/devel/TOOLCHAINS/crosstool-ng/targets/microblaze-unknown-linux-gnu/build/build-gdb-cross/gdb'


Just I've look into gdb's obcodes/microblaze-opcm.h and compared with
the files in binutils. They differ on line 34 -- gdb's code add the new
element 'sleep' in enum microblaze_instr and I've no idea why. Can one
of you (David or Nagaraju) explain this?

Did you or anybody else ever seen this error in your build process?


I'm surprised about the compiler message:
[ALL  ] /usr/include/unistd.h:441: note: previous declaration of 'sleep'
was here

Indeed it is a symbol conflict between the function sleep() from the
system API and the enum element in Microblaze opcode list. How are these
problems usually solved? How can gdb hide the enum element 'sleep'?
(this questions may be off topic for crosstool-ng, tell me an I'll stop
to ask)


EXPERIMENTAL REBUILD HOWTO:
---------------------------

What I've done to rebuild binutils/gcc/eglibc for Microblaze (w/o gdb):

1) Clone the Xilinx git repo (take a while), for example to
   /store/devel/microblaze-gnu:

   git clone git://git.xilinx.com/microblaze-gnu.git

2) Clone the latest Crosstool-ng repo, for example to
   /store/devel/crosstool-ng:

   hg clone http://crosstool-ng.org/hg/crosstool-ng

3) Apply Davids 'CUSTOM version' patch from patchwork:

   cd /store/devel/crosstool-ng
   wget http://patchwork.ozlabs.org/patch/189047/raw \
        -O patchwork-189047.patch
   patch -p1 <patchwork-189047.patch

4) Prepare Crosstool-NG for local usage:

   cd /store/devel/crosstool-ng
   ./bootstrap
   ./configure --enable-local
   make

5) Configure Crosstool-NG for BE/Microblaze GNU/Linux:

   cd /store/devel/microblaze-gnu/crosstool-ng/samples
   cp -R microblaze* /store/devel/crosstool-ng/samples

   cd /store/devel/crosstool-ng
   ./ct-ng microblaze-xilinx-linux-gnu

6) Change the configuration for custom version of source trees
   and disable cross-gdb:

   ./ct-ng menuconfig

   Paths and misc options  ---> correct some wrong path definitions
   to your environment: LOCAL_TARBALLS_DIR, PREFIX_DIR

   Paths and misc options  ---> set directory containing custom
   source components (CUSTOM_LOCATION_ROOT_DIR) to:

      /store/devel/microblaze-gnu/src

   Binary utilities  ---> set binutils version to BINUTILS_CUSTOM
   C compiler        ---> set gcc version to CC_CUSTOM
   C-library         ---> set eglibc version to LIBC_EGLIBC_CUSTOM
   Debug facilities  ---> gdb  ---> disable Cross-gdb and gdbserver

7) Start the rebuild:

   ./ct-ng build


NOTE: I've no yet tried to compile real application code with the
rebuilded tool chain. That's all EXPERIMENTAL!


@David and Nagaraju: Is there a time line to merge all the Microblaze
portings into binutils/gcc/eglibc mainline or present patch sets for
crosstool-ng in a short time?


-- 
Best regards,
Stephan Linz
______________________________________________________________________________
MB-Ref: http://www.li-pro.de/xilinx_mb:mbref:start
OpenDCC: http://www.li-pro.net/opendcc.phtml
PC/M: http://www.li-pro.net/pcm.phtml
Sourceforge: http://sourceforge.net/users/slz
Gitorious: https://gitorious.org/~slz


--
For unsubscribe information see http://sourceware.org/lists.html#faq



More information about the crossgcc mailing list