OpenCores
no use no use 1/1 no use no use
openrisc | uClibc toolchain with libmath
by Kirsch on May 26, 2012
Kirsch
Posts: 8
Joined: Apr 3, 2012
Last seen: Aug 24, 2012
I need a 'uClibc toolchain' (or32-linux-*) with a complete math library.
The toolchain from the virtualbox-image does not have full math library.

And on the FTP server is only a current 'newlib toolchain' (or32-elf-*).


I've tried following the instructions from the sources to compile, but the process aborts with an error.
http://opencores.org/or1k/OpenRISC_GNU_tool_chain#Installation_from_source

Has someone a precompiled toolchain for me?




./bld-all.sh --force --prefix /opt/openrisc --or1ksim-dir /opt/or1ksim --uclibc-dir uClibc --linux-dir linux --no-newlib --no-or32-elf

...

/home/christian/Arbeitsfl�¤che/ORSoC/Archiv/toolchain_from_source/gnu-src/bd-linux/./gcc/xgcc -B/home/christian/Arbeitsfl�¤che/ORSoC/Archiv/toolchain_from_source/gnu-src/bd-linux/./gcc/ -B/opt/openrisc/or32-linux/bin/ -B/opt/openrisc/or32-linux/lib/ -isystem /opt/openrisc/or32-linux/include -isystem /opt/openrisc/or32-linux/sys-include -L/home/christian/Arbeitsfl�¤che/ORSoC/Archiv/toolchain_from_source/gnu-src/bd-linux/./ld -g -O2 -O2 -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -fomit-frame-pointer -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -I. -I. -I../.././gcc -I../../../unisrc/libgcc -I../../../unisrc/libgcc/. -I../../../unisrc/libgcc/../gcc -I../../../unisrc/libgcc/../include -o _ashldi3.o -MT _ashldi3.o -MD -MP -MF _ashldi3.dep -DL_ashldi3 -c ../../../unisrc/libgcc/../gcc/libgcc2.c \

In file included from ../../../unisrc/libgcc/../gcc/libgcc2.c:29:0:
../../../unisrc/libgcc/../gcc/tsystem.h:87:19: fatal error: stdio.h: Datei oder Verzeichnis nicht gefunden
compilation terminated.

...
RE: openrisc | uClibc toolchain with libmath
by jeremybennett on May 28, 2012
jeremybennett
Posts: 815
Joined: May 29, 2008
Last seen: Jun 13, 2019

Hi Kirsch

Which bit of the maths library do you think is missing? I was under the impression that the virtual images contained a standard compilation of uClibc, which includes standard maths library, libm.a.

Normally bld-all.sh works without problems if you have all the pre-requisites installed. Could you tell us more about your system. There are known problems with running bld-all.sh on Cygwin or MinGW environments, due to the different way file hierachies and symbolic links work. This would account for tsystem.h not being found, even though it is there in the source.

HTH

Jeremy

--
Tel: +44 (1590) 610184
Cell: +44 (7970) 676050
SkypeID: jeremybennett
Email: jeremy.bennett@embecosm.com
Web: www.embecosm.com

RE: openrisc | uClibc toolchain with libmath
by Kirsch on May 28, 2012
Kirsch
Posts: 8
Joined: Apr 3, 2012
Last seen: Aug 24, 2012
hi,

I miss trigonometric functions like atan2.
As I said the library is not complete.

In the newer newlib builds the functions exists.

I use Ubuntu 12:04

Kirsch
RE: openrisc | uClibc toolchain with libmath
by Kirsch on May 28, 2012
Kirsch
Posts: 8
Joined: Apr 3, 2012
Last seen: Aug 24, 2012
I tried it again.

In a VM, with a brand new Debian (6.0 32bit).
And I get another error:


./bld-all.sh --force --prefix /opt/openrisc --or1ksim-dir /opt/or1ksim --uclibc-dir uClibc --linux-dir Linux

...

gcc -c -DHAVE_CONFIG_H -DPROFILE=1 -DWITH_PROFILE=-1 -DDEFAULT_INLINE=0 -I/opt/or1ksim/include -I. -I../.././common -I../../.././gdb-7.2/sim/or32/../common -I../../include -I../../.././gdb-7.2/sim/or32/../../include -I../../bfd -I../../../bfd -I../../opcodes -I../../.././gdb-7.2/sim/or32/../../opcodes -g -O2 version.c
gcc -c ../../.././gdb-7.2/sim/or32/../common/callback.c -DHAVE_CONFIG_H -DPROFILE=1 -DWITH_PROFILE=-1 -DDEFAULT_INLINE=m/include -I. -I../../.././gdb-7.2/sim/or32 -I../common -I../../.././gdb-7.2/sim/or32/../common -I../../include -I../../.././gdb-7 -I../../bfd -I../../.././gdb-7.2/sim/or32/../../bfd -I../../opcodes -I../../.././gdb-7.2/sim/or32/../../opcodes -g -O2
gcc -c ../../.././gdb-7.2/sim/or32/../common/syscall.c -DHAVE_CONFIG_H -DPROFILE=1 -DWITH_PROFILE=-1 -DDEFAULT_INLINE=0/include -I. -I../../.././gdb-7.2/sim/or32 -I../common -I../../.././gdb-7.2/sim/or32/../common -I../../include -I../../.././gdb-7.-I../../bfd -I../../.././gdb-7.2/sim/or32/../../bfd -I../../opcodes -I../../.././gdb-7.2/sim/or32/../../opcodes -g -O2
gcc -c -DHAVE_CONFIG_H -DPROFILE=1 -DWITH_PROFILE=-1 -DDEFAULT_INLINE=0 -I/opt/or1ksim/include -I. -I../.././common -I../../.././gdb-7.2/sim/or32/../common -I../../include -I../../.././gdb-7.2/sim/or32/../../include -I../../bfd -I../../../bfd -I../../opcodes -I../../.././gdb-7.2/sim/or32/../../opcodes -g -O2 targ-map.c
gcc -c -DHAVE_CONFIG_H -DPROFILE=1 -DWITH_PROFILE=-1 -DDEFAULT_INLINE=0 -I/opt/or1ksim/include -I. -I../.././common -I../../.././gdb-7.2/sim/or32/../common -I../../include -I../../.././gdb-7.2/sim/or32/../../include -I../../bfd -I../../../bfd -I../../opcodes -I../../.././gdb-7.2/sim/or32/../../opcodes -g -O2 ../../.././gdb-7.2/sim/or32/wrapper.c
../../.././gdb-7.2/sim/or32/wrapper.c:47:21: error: or1ksim.h: Datei oder Verzeichnis nicht gefunden
../../.././gdb-7.2/sim/or32/wrapper.c: In function âsim_resumeâ:
../../.././gdb-7.2/sim/or32/wrapper.c:650: error: âOR1KSIM_RC_HALTEDâ undeclared (first use in this function)
../../.././gdb-7.2/sim/or32/wrapper.c:650: error: (Each undeclared identifier is reported only once
../../.././gdb-7.2/sim/or32/wrapper.c:650: error: for each function it appears in.)
../../.././gdb-7.2/sim/or32/wrapper.c:665: error: âOR1KSIM_RC_BRKPTâ undeclared (first use in this function)
../../.././gdb-7.2/sim/or32/wrapper.c:686: error: âOR1KSIM_RC_OKâ undeclared (first use in this function)
make[2]: *** [wrapper.o] Fehler 1
make[2]: *** Warte auf noch nicht beendete Prozesse...
make[2]: Leaving directory `/root/toolchain/gnu-src/bd-elf-gdb/sim/or32'
make[1]: *** [all] Fehler 1
make[1]: Leaving directory `/root/toolchain/gnu-src/bd-elf-gdb/sim'
make: *** [all-sim] Fehler 2
make (all-build all-sim all-gdb) failed.
RE: openrisc | uClibc toolchain with libmath
by jeremybennett on May 28, 2012
jeremybennett
Posts: 815
Joined: May 29, 2008
Last seen: Jun 13, 2019
hi,

I miss trigonometric functions like atan2.
As I said the library is not complete.

In the newer newlib builds the functions exists.

I use Ubuntu 12:04

Kirsch

Hi Kirsch,

I see that by default uClibc restrics the maths library (to save space - it is an embedded library), so you are correct you'll need to build your own with the full maths library option enabled.

I don't understand why the build script failed. I can only think that it is a problem with the version of compiler you are using. I haven't upgraded to Precise Pangolin yet, so I can't check it. Obvious first question - is the missing header actually there in the GCC source? What does the output of "gcc --version" say?

Jeremy

RE: openrisc | uClibc toolchain with libmath
by Kirsch on May 28, 2012
Kirsch
Posts: 8
Joined: Apr 3, 2012
Last seen: Aug 24, 2012
What does the output of "gcc --version" say?


#gcc --version
gcc (Debian 4.4.5-8) 4.4.5
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Kirsch
RE: openrisc | uClibc toolchain with libmath
by jeremybennett on May 28, 2012
jeremybennett
Posts: 815
Joined: May 29, 2008
Last seen: Jun 13, 2019

Hi Kirsch,

GCC 4.4.5 should be fine. Looking at your second run, it seems to me that you don't have Or1ksim installed, because it is not finding the Or1ksim header. Or1ksim must be built and installed before you build the tool chain, because it supplies the simulator used by GDB. Did you first install Or1ksim in /opr/or1ksim. In other words did you build Or1ksim, with --prefix=/opt/or1ksim?

HTH,

Jeremy

RE: openrisc | uClibc toolchain with libmath
by Kirsch on May 28, 2012
Kirsch
Posts: 8
Joined: Apr 3, 2012
Last seen: Aug 24, 2012
Ok, thank you Jeremy

This point should be emphasized more clearly in the manual. ;-)

Now, the process ran successfully


Kirsch
RE: openrisc | uClibc toolchain with libmath
by Kirsch on May 28, 2012
Kirsch
Posts: 8
Joined: Apr 3, 2012
Last seen: Aug 24, 2012
damm

strange gcc

Trigonometric functions were all the time in the library

It was a Layer 8 issue.


Not working
gcc-linux-gcc -lm -o myprog part1.o part2.o

working
gcc-linux-gcc -o myprog part1.o part2.o -lm


But "-pthread" is ok if I write it at the beginning



Kirsch
RE: openrisc | uClibc toolchain with libmath
by jeremybennett on May 29, 2012
jeremybennett
Posts: 815
Joined: May 29, 2008
Last seen: Jun 13, 2019
damm

strange gcc

Trigonometric functions were all the time in the library

It was a Layer 8 issue.


Not working
gcc-linux-gcc -lm -o myprog part1.o part2.o

working
gcc-linux-gcc -o myprog part1.o part2.o -lm


But "-pthread" is ok if I write it at the beginning



Kirsch

Hi Kirsch

I've updated the Wiki to make the prequisites even more prominent!

This is correct behaviour of the command line. Specifying a static library using -l explicitly places the library at that place in the look up path when linking. If you have circular dependencies you may need to specify the same library multiple times. There are ways of specifying libraries to be searched multiple times until all symbols are resolved. The ld manual is a substantial tome covering all the details of what you can achieve.

-pthread is not a library specification. It is an option in its own right and expands into other things, which include linking in the pthread library. So it behaves in a different way.

There is more work needed on the OpenRISC linker. In particular its handling of weak references is simplistic and can cause inefficiencies (forcing unused parts of libraries to be loaded).

HTH

Jeremy

no use no use 1/1 no use no use
© copyright 1999-2026 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.