OpenCores
no use no use 1/2 Next Last
Compilation problems
by firefalcon on Feb 25, 2011
firefalcon
Posts: 99
Joined: Jan 10, 2011
Last seen: Mar 26, 2024
I switched to the most recent GNU toolchain, building it from source on Fedora 13. Now I am unable to build the simple uart test program bundled with minsoc. I get an error about undefined reference to XXX in function YYY. Function XXX is in reset.S while function YYY is in except.S and visa-versa. It looks to me that the problem is in the linker command, specifically the -T switch doesn't seem to work as it did before.
RE: Compilation problems
by jeremybennett on Feb 28, 2011
jeremybennett
Posts: 815
Joined: May 29, 2008
Last seen: Jun 13, 2019

Hi firefalcon,

How are you compiling your program. It looks like it isn't picking up the C run-time initialization. For simple use or32-elf-gcc -mor32-newlib ... would be appropriate with Or1ksim. There is also -mor32-newlib-uart if you have a UART device in Or1ksim. I know others have worked/are working on board specific ports of newlib.

HTH

Jeremy

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

RE: Compilation problems
by firefalcon on Feb 28, 2011
firefalcon
Posts: 99
Joined: Jan 10, 2011
Last seen: Mar 26, 2024
The problem was fixed by removing the underscore prefixes from referenced functions in reset.S and except.S. Thanks to Raul, minsoc maintainer, who gave me the heads-up on the issue when using newer versions of the toolchain.
RE: Compilation problems
by shamikgng on Apr 12, 2011
shamikgng
Posts: 15
Joined: Dec 25, 2010
Last seen: Apr 15, 2020
I have a couple of problems in a bare-metal compilation with the new tool chain.

1) -mor32-newlib is not working.
2) The _ prefix errors. I recall this problem and its explanation in a different thread but cannot find it in the forum :(

I built only the newlib version and not the Linux kernel version.

Please tell me how to get rid of these.

Below are the errors I am getting :-


> or32-elf-gcc -mor32-newlib longdiv.c
cc1: error: unrecognised command line option "-mor32-newlib"


> or32-elf-gcc longdiv.c
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/crt0.o: In function `_start':
(.text+0x0): undefined reference to `_board_mem_base'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/crt0.o: In function `_start':
(.text+0x4): undefined reference to `_board_mem_base'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/crt0.o: In function `_start':
(.text+0xc): undefined reference to `_board_mem_size'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/crt0.o: In function `_start':
(.text+0x10): undefined reference to `_board_mem_size'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/crt0.o: In function `_start':
(.text+0x68): undefined reference to `_board_uart_base'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/crt0.o: In function `_start':
(.text+0x6c): undefined reference to `_board_uart_base'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/crt0.o: In function `_start':
(.text+0x80): undefined reference to `__uart_init'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/libc.a(lib_a-exit.o): In function `exit':
/home/shamikg/openrisc/second_build_dir/bd-elf/or32-elf/newlib/libc/stdlib/../../../../../unisrc/newlib/libc/stdlib/exit.c:65: undefined reference to `_exit'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/libc.a(lib_a-sbrkr.o): In function `_sbrk_r':
/home/shamikg/openrisc/second_build_dir/bd-elf/or32-elf/newlib/libc/reent/../../../../../unisrc/newlib/libc/reent/sbrkr.c:60: undefined reference to `_sbrk'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/libc.a(lib_a-writer.o): In function `_write_r':
/home/shamikg/openrisc/second_build_dir/bd-elf/or32-elf/newlib/libc/reent/../../../../../unisrc/newlib/libc/reent/writer.c:58: undefined reference to `_write'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/libc.a(lib_a-closer.o): In function `_close_r':
/home/shamikg/openrisc/second_build_dir/bd-elf/or32-elf/newlib/libc/reent/../../../../../unisrc/newlib/libc/reent/closer.c:53: undefined reference to `_close'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/libc.a(lib_a-fstatr.o): In function `_fstat_r':
/home/shamikg/openrisc/second_build_dir/bd-elf/or32-elf/newlib/libc/reent/../../../../../unisrc/newlib/libc/reent/fstatr.c:62: undefined reference to `_fstat'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/libc.a(lib_a-isattyr.o): In function `_isatty_r':
/home/shamikg/openrisc/second_build_dir/bd-elf/or32-elf/newlib/libc/reent/../../../../../unisrc/newlib/libc/reent/isattyr.c:58: undefined reference to `_isatty'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/libc.a(lib_a-lseekr.o): In function `_lseek_r':
/home/shamikg/openrisc/second_build_dir/bd-elf/or32-elf/newlib/libc/reent/../../../../../unisrc/newlib/libc/reent/lseekr.c:58: undefined reference to `_lseek'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/libc.a(lib_a-readr.o): In function `_read_r':
/home/shamikg/openrisc/second_build_dir/bd-elf/or32-elf/newlib/libc/reent/../../../../../unisrc/newlib/libc/reent/readr.c:58: undefined reference to `_read'
collect2: ld returned 1 exit status
RE: Compilation problems
by shamikgng on Apr 12, 2011
shamikgng
Posts: 15
Joined: Dec 25, 2010
Last seen: Apr 15, 2020
I have a couple of problems in a bare-metal compilation with the new tool chain.

1) -mor32-newlib is not working.
2) The _ prefix errors. I recall this problem and its explanation in a different thread but cannot find it in the forum :(

I built only the newlib version and not the Linux kernel version.

Please tell me how to get rid of these.

Below are the errors I am getting :-


> or32-elf-gcc -mor32-newlib longdiv.c
cc1: error: unrecognised command line option "-mor32-newlib"


> or32-elf-gcc longdiv.c
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/crt0.o: In function `_start':
(.text+0x0): undefined reference to `_board_mem_base'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/crt0.o: In function `_start':
(.text+0x4): undefined reference to `_board_mem_base'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/crt0.o: In function `_start':
(.text+0xc): undefined reference to `_board_mem_size'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/crt0.o: In function `_start':
(.text+0x10): undefined reference to `_board_mem_size'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/crt0.o: In function `_start':
(.text+0x68): undefined reference to `_board_uart_base'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/crt0.o: In function `_start':
(.text+0x6c): undefined reference to `_board_uart_base'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/crt0.o: In function `_start':
(.text+0x80): undefined reference to `__uart_init'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/libc.a(lib_a-exit.o): In function `exit':
/home/shamikg/openrisc/second_build_dir/bd-elf/or32-elf/newlib/libc/stdlib/../../../../../unisrc/newlib/libc/stdlib/exit.c:65: undefined reference to `_exit'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/libc.a(lib_a-sbrkr.o): In function `_sbrk_r':
/home/shamikg/openrisc/second_build_dir/bd-elf/or32-elf/newlib/libc/reent/../../../../../unisrc/newlib/libc/reent/sbrkr.c:60: undefined reference to `_sbrk'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/libc.a(lib_a-writer.o): In function `_write_r':
/home/shamikg/openrisc/second_build_dir/bd-elf/or32-elf/newlib/libc/reent/../../../../../unisrc/newlib/libc/reent/writer.c:58: undefined reference to `_write'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/libc.a(lib_a-closer.o): In function `_close_r':
/home/shamikg/openrisc/second_build_dir/bd-elf/or32-elf/newlib/libc/reent/../../../../../unisrc/newlib/libc/reent/closer.c:53: undefined reference to `_close'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/libc.a(lib_a-fstatr.o): In function `_fstat_r':
/home/shamikg/openrisc/second_build_dir/bd-elf/or32-elf/newlib/libc/reent/../../../../../unisrc/newlib/libc/reent/fstatr.c:62: undefined reference to `_fstat'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/libc.a(lib_a-isattyr.o): In function `_isatty_r':
/home/shamikg/openrisc/second_build_dir/bd-elf/or32-elf/newlib/libc/reent/../../../../../unisrc/newlib/libc/reent/isattyr.c:58: undefined reference to `_isatty'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/libc.a(lib_a-lseekr.o): In function `_lseek_r':
/home/shamikg/openrisc/second_build_dir/bd-elf/or32-elf/newlib/libc/reent/../../../../../unisrc/newlib/libc/reent/lseekr.c:58: undefined reference to `_lseek'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/libc.a(lib_a-readr.o): In function `_read_r':
/home/shamikg/openrisc/second_build_dir/bd-elf/or32-elf/newlib/libc/reent/../../../../../unisrc/newlib/libc/reent/readr.c:58: undefined reference to `_read'
collect2: ld returned 1 exit status
RE: Compilation problems
by shamikgng on Apr 12, 2011
shamikgng
Posts: 15
Joined: Dec 25, 2010
Last seen: Apr 15, 2020
I have a couple of problems in a bare-metal compilation with the new tool chain.

1) -mor32-newlib is not working.
2) The _ prefix errors. I recall this problem and its explanation in a different thread but cannot find it in the forum :(

I built only the newlib version and not the Linux kernel version.

Please tell me how to get rid of these.

Below are the errors I am getting :-


> or32-elf-gcc -mor32-newlib longdiv.c
cc1: error: unrecognised command line option "-mor32-newlib"


> or32-elf-gcc longdiv.c
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/crt0.o: In function `_start':
(.text+0x0): undefined reference to `_board_mem_base'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/crt0.o: In function `_start':
(.text+0x4): undefined reference to `_board_mem_base'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/crt0.o: In function `_start':
(.text+0xc): undefined reference to `_board_mem_size'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/crt0.o: In function `_start':
(.text+0x10): undefined reference to `_board_mem_size'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/crt0.o: In function `_start':
(.text+0x68): undefined reference to `_board_uart_base'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/crt0.o: In function `_start':
(.text+0x6c): undefined reference to `_board_uart_base'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/crt0.o: In function `_start':
(.text+0x80): undefined reference to `__uart_init'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/libc.a(lib_a-exit.o): In function `exit':
/home/shamikg/openrisc/second_build_dir/bd-elf/or32-elf/newlib/libc/stdlib/../../../../../unisrc/newlib/libc/stdlib/exit.c:65: undefined reference to `_exit'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/libc.a(lib_a-sbrkr.o): In function `_sbrk_r':
/home/shamikg/openrisc/second_build_dir/bd-elf/or32-elf/newlib/libc/reent/../../../../../unisrc/newlib/libc/reent/sbrkr.c:60: undefined reference to `_sbrk'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/libc.a(lib_a-writer.o): In function `_write_r':
/home/shamikg/openrisc/second_build_dir/bd-elf/or32-elf/newlib/libc/reent/../../../../../unisrc/newlib/libc/reent/writer.c:58: undefined reference to `_write'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/libc.a(lib_a-closer.o): In function `_close_r':
/home/shamikg/openrisc/second_build_dir/bd-elf/or32-elf/newlib/libc/reent/../../../../../unisrc/newlib/libc/reent/closer.c:53: undefined reference to `_close'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/libc.a(lib_a-fstatr.o): In function `_fstat_r':
/home/shamikg/openrisc/second_build_dir/bd-elf/or32-elf/newlib/libc/reent/../../../../../unisrc/newlib/libc/reent/fstatr.c:62: undefined reference to `_fstat'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/libc.a(lib_a-isattyr.o): In function `_isatty_r':
/home/shamikg/openrisc/second_build_dir/bd-elf/or32-elf/newlib/libc/reent/../../../../../unisrc/newlib/libc/reent/isattyr.c:58: undefined reference to `_isatty'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/libc.a(lib_a-lseekr.o): In function `_lseek_r':
/home/shamikg/openrisc/second_build_dir/bd-elf/or32-elf/newlib/libc/reent/../../../../../unisrc/newlib/libc/reent/lseekr.c:58: undefined reference to `_lseek'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/libc.a(lib_a-readr.o): In function `_read_r':
/home/shamikg/openrisc/second_build_dir/bd-elf/or32-elf/newlib/libc/reent/../../../../../unisrc/newlib/libc/reent/readr.c:58: undefined reference to `_read'
collect2: ld returned 1 exit status
RE: Compilation problems
by shamikgng on Apr 12, 2011
shamikgng
Posts: 15
Joined: Dec 25, 2010
Last seen: Apr 15, 2020
I have a couple of problems in a bare-metal compilation with the new tool chain.

1) -mor32-newlib is not working.
2) The _ prefix errors. I recall this problem and its explanation in a different thread but cannot find it in the forum :(

I built only the newlib version and not the Linux kernel version.

Please tell me how to get rid of these.

Below are the errors I am getting :-


> or32-elf-gcc -mor32-newlib longdiv.c
cc1: error: unrecognised command line option "-mor32-newlib"


> or32-elf-gcc longdiv.c
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/crt0.o: In function `_start':
(.text+0x0): undefined reference to `_board_mem_base'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/crt0.o: In function `_start':
(.text+0x4): undefined reference to `_board_mem_base'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/crt0.o: In function `_start':
(.text+0xc): undefined reference to `_board_mem_size'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/crt0.o: In function `_start':
(.text+0x10): undefined reference to `_board_mem_size'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/crt0.o: In function `_start':
(.text+0x68): undefined reference to `_board_uart_base'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/crt0.o: In function `_start':
(.text+0x6c): undefined reference to `_board_uart_base'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/crt0.o: In function `_start':
(.text+0x80): undefined reference to `__uart_init'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/libc.a(lib_a-exit.o): In function `exit':
/home/shamikg/openrisc/second_build_dir/bd-elf/or32-elf/newlib/libc/stdlib/../../../../../unisrc/newlib/libc/stdlib/exit.c:65: undefined reference to `_exit'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/libc.a(lib_a-sbrkr.o): In function `_sbrk_r':
/home/shamikg/openrisc/second_build_dir/bd-elf/or32-elf/newlib/libc/reent/../../../../../unisrc/newlib/libc/reent/sbrkr.c:60: undefined reference to `_sbrk'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/libc.a(lib_a-writer.o): In function `_write_r':
/home/shamikg/openrisc/second_build_dir/bd-elf/or32-elf/newlib/libc/reent/../../../../../unisrc/newlib/libc/reent/writer.c:58: undefined reference to `_write'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/libc.a(lib_a-closer.o): In function `_close_r':
/home/shamikg/openrisc/second_build_dir/bd-elf/or32-elf/newlib/libc/reent/../../../../../unisrc/newlib/libc/reent/closer.c:53: undefined reference to `_close'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/libc.a(lib_a-fstatr.o): In function `_fstat_r':
/home/shamikg/openrisc/second_build_dir/bd-elf/or32-elf/newlib/libc/reent/../../../../../unisrc/newlib/libc/reent/fstatr.c:62: undefined reference to `_fstat'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/libc.a(lib_a-isattyr.o): In function `_isatty_r':
/home/shamikg/openrisc/second_build_dir/bd-elf/or32-elf/newlib/libc/reent/../../../../../unisrc/newlib/libc/reent/isattyr.c:58: undefined reference to `_isatty'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/libc.a(lib_a-lseekr.o): In function `_lseek_r':
/home/shamikg/openrisc/second_build_dir/bd-elf/or32-elf/newlib/libc/reent/../../../../../unisrc/newlib/libc/reent/lseekr.c:58: undefined reference to `_lseek'
/home/shamikg/openrisc/build_dir/install_dir/openrisc/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/../../../../or32-elf/lib/libc.a(lib_a-readr.o): In function `_read_r':
/home/shamikg/openrisc/second_build_dir/bd-elf/or32-elf/newlib/libc/reent/../../../../../unisrc/newlib/libc/reent/readr.c:58: undefined reference to `_read'
collect2: ld returned 1 exit status
RE: Compilation problems
by shamikgng on Apr 12, 2011
shamikgng
Posts: 15
Joined: Dec 25, 2010
Last seen: Apr 15, 2020
Sorry for repeated posts, browser problem wasn't letting me see the submission. Can't find a way to delete though !
RE: Compilation problems
by shamikgng on Apr 12, 2011
shamikgng
Posts: 15
Joined: Dec 25, 2010
Last seen: Apr 15, 2020
Some more info @previous post. I am using " or1ksim-0.5.0rc2 " and the tool chain is built from source as per the instructions in http://opencores.org/openrisc,gnu_toolchain#download . Also in the previous toolchain a bare-metal execution involved a command of type " or32-elf-sim --memory=64M ". Is that necessary in this case too ?
RE: Compilation problems
by shamikgng on Apr 12, 2011
shamikgng
Posts: 15
Joined: Dec 25, 2010
Last seen: Apr 15, 2020
It compiled with the -mnewlib flag.
RE: Compilation problems
by jeremybennett on Apr 13, 2011
jeremybennett
Posts: 815
Joined: May 29, 2008
Last seen: Jun 13, 2019

Hi shamikgmg

You have discovered that -mor32-newlib has been replaced -mnewlib. There is also a new option -mboard=, which can be used to link in a newlib BSP for a specific board. The default uses a BSP suitable for Or1ksim.

Longer term, the requirement to specify -mnewlib will go. It will be implicit if you use the or32-elf tool chain. It is a relic from the time when this also was a tool chain for Linux applications, but this is now a separate or32-linux tool chain.

HTH

Jeremy

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

RE: Compilation problems
by shamikgng on Apr 13, 2011
shamikgng
Posts: 15
Joined: Dec 25, 2010
Last seen: Apr 15, 2020
Thank you Jeremy.
RE: Compilation problems
by czzheng on Aug 13, 2011
czzheng
Posts: 13
Joined: Jul 28, 2011
Last seen: Aug 17, 2025
hi,
i have the same problems with firefalcon.
after compiling gcc successfully, i wrote a simple hello.c like this
//hello.c
#include "stdio.h"
int main()
{
printf("hello\n");
return 0;
}

using gcc of the OS like this: gcc hello.c -o hello
compilation ok, and hello excute, output hello

using or32-elf-gcc hello.c -o hello
it gives many errors like firefalcon has met.
and the strange thing is that, the error information not only indicate the error from my toolchain install directory, e.g. /tools/openrisc/or32/lib/gcc/or32-elf/lib, but also from the directory where newlib source file located in:/home/czzheng/work/newlib_1.18.0_or32_1.0rc2/newlib/libc/stdlib

after adding -mnewlib parameter like your post said, then, the error message shorten to 2 lines:
or32-elf-gcc -mnewlib hello.c -o hello
/tools/openrisc/or32/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/ctrbegin.o: in function '__do_global_dtors_aux': crtstuff.c: undefined reference to '__deregister_frame_info'
and in funcition 'fram_dummy' there is similar error info.

i want to know where i can find the parameters like -mnewlib, i mean or32-elf-gcc specific, because if i type:
or32-elf-gcc --help, i can only see information about standard gcc, not about gcc of or32.

hope to hear any comment
thanks !

RE: Compilation problems
by jeremybennett on Aug 14, 2011
jeremybennett
Posts: 815
Joined: May 29, 2008
Last seen: Jun 13, 2019

hi,

i have the same problems with firefalcon.

after compiling gcc successfully, i wrote a simple hello.c like this

//hello.c
#include "stdio.h"
int main()
{
  printf("hello\n");
  return 0;
}

using gcc of the OS like this: gcc hello.c -o hello compilation ok, and hello excute, output hello

Hi czzheng,

OK - this proves you have a good test program.

using or32-elf-gcc hello.c -o hello it gives many errors like firefalcon has met. and the strange thing is that, the error information not only indicate the error from my toolchain install directory, e.g. /tools/openrisc/or32/lib/gcc/or32-elf/lib, but also from the directory where newlib source file located in:/home/czzheng/work/newlib_1.18.0_or32_1.0rc2/newlib/libc/stdlib

after adding -mnewlib parameter like your post said, then, the error message shorten to 2 lines: or32-elf-gcc -mnewlib hello.c -o hello /tools/openrisc/or32/lib/gcc/or32-elf/4.5.1-or32-1.0rc4/ctrbegin.o: in function '__do_global_dtors_aux': crtstuff.c: undefined reference to '__deregister_frame_info' and in funcition 'fram_dummy' there is similar error info.

So, the version of the compiler you are using requires -mnewlib. The two errors you are getting look like the basic libgcc is not being linked in. Could I ask you to try two things.

  1. Build the tool chain from the latest source in SVN. In this version, you should not need to specify -mnewlib. The compiler knows to use newlib as the C library with the or32-elf- toolchain.

  2. If you still get errors, please rerun your or32-elf-gcc command, adding -v to the command line and post both the complete command line and the output here.

i want to know where i can find the parameters like -mnewlib, i mean or32-elf-gcc specific, because if i type: or32-elf-gcc --help, i can only see information about standard gcc, not about gcc of or32.

This is a bug. --help should work, and these should also be added to the documentation (a separate bug). Would you file these in bugzilla, so we can get them fixed.

Thanks,

Jeremy

RE: Compilation problems
by czzheng on Aug 15, 2011
czzheng
Posts: 13
Joined: Jul 28, 2011
Last seen: Aug 17, 2025
hi,Jeremy
i am now trying to build new toolchain using the latest code from svn.
binutils 2.20.1 passed(last time i use binutils 2.18), but when compiling gcc 4.5.1, errors like this come:
../gcc4.5.1/libssp/ssp.c O_RDONLY undeclared
and there are more undeclared errors,e.g, size, sszie_t.

the compiling cmd are the same between these 2 try.
so, the latest version are not stable now?

as you said, i am trying to file a bug in bugzilla, but i can not login use the opencores web account, so what the account and password are?

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