Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12678 Discussions

Cannot build smallC lib for Nios II with FPH2

minhlee
Beginner
758 Views

Hi everyone, currently I am developing mandelbrot plot using Nios II with custom hardware Floating point module FPH2 from Intel for my DE10-Nano broad. I try to build BSP library smallC for it as it is required. However, I cannot build it due to error related in Makefile:

```bash

/usr/bin/mkdir -p doc
gcc -g -g -O2 -o doc/makedoc.o -c /mnt/e/software/quartus-lite-23.1/fpga/nios2eds/bin/gnu/src/newlib-4.3.0/newlib/doc/makedoc.c
gcc -g -O2 -o doc/makedoc doc/makedoc.o
make "CC_FOR_BUILD=gcc" "CFLAGS=-g -Os -ffunction-sections -fdata-sections -mno-gpopt" "CCASFLAGS=-g -Os -ffunction-sections -fdata-sections -mno-gpopt" "CFLAGS_FOR_BUILD=-g -O2" "CFLAGS_FOR_TARGET=-g -Os -ffunction-sections -fdata-sections -mno-gpopt" "INSTALL=/usr/bin/install -c" "LDFLAGS=" "LIBCFLAGS=-g -Os -ffunction-sections -fdata-sections -mno-gpopt" "LIBCFLAGS_FOR_TARGET=-g -Os -ffunction-sections -fdata-sections -mno-gpopt" "MAKE=make" "MAKEINFO=makeinfo --split-size=5000000 " "PICFLAG=" "PICFLAG_FOR_TARGET=" "SHELL=/bin/bash" "EXPECT=expect" "RUNTEST=runtest" "RUNTESTFLAGS=" "exec_prefix=/mnt/d/software/verilog/NIOSII_HDMI/software/mandelbrot_plot_bsp/newlib" "infodir=/mnt/d/software/verilog/NIOSII_HDMI/software/mandelbrot_plot_bsp/newlib/share/info" "libdir=/mnt/d/software/verilog/NIOSII_HDMI/software/mandelbrot_plot_bsp/newlib/lib" "prefix=/mnt/d/software/verilog/NIOSII_HDMI/software/mandelbrot_plot_bsp/newlib" "tooldir=/mnt/d/software/verilog/NIOSII_HDMI/software/mandelbrot_plot_bsp/newlib/nios2-elf" "top_toollibdir=/mnt/d/software/verilog/NIOSII_HDMI/software/mandelbrot_plot_bsp/newlib/nios2-elf/lib" "AR=/mnt/d/software/verilog/NIOSII_HDMI/software/mandelbrot_plot_bsp/newlib-build-tmp/build-newlib-stage-wrapper nios2-elf-ar.exe" "AS=/mnt/d/software/verilog/NIOSII_HDMI/software/mandelbrot_plot_bsp/newlib-build-tmp/build-newlib-stage-wrapper nios2-elf-as.exe" "CC=/mnt/d/software/verilog/NIOSII_HDMI/software/mandelbrot_plot_bsp/newlib-build-tmp/build-newlib-stage-wrapper nios2-elf-gcc.exe -B/mnt/d/software/verilog/NIOSII_HDMI/software/mandelbrot_plot_bsp/newlib-build-tmp/smallc/nios2-elf/newlib/ -isystem /mnt/d/software/verilog/NIOSII_HDMI/software/mandelbrot_plot_bsp/newlib-build-tmp/smallc/nios2-elf/newlib/targ-include -isystem /mnt/e/software/quartus-lite-23.1/fpga/nios2eds/bin/gnu/src/newlib-4.3.0/newlib/libc/include -B/mnt/d/software/verilog/NIOSII_HDMI/software/mandelbrot_plot_bsp/newlib-build-tmp/smallc/nios2-elf/libgloss/nios2 -L/mnt/d/software/verilog/NIOSII_HDMI/software/mandelbrot_plot_bsp/newlib-build-tmp/smallc/nios2-elf/libgloss/libnosys -L/mnt/e/software/quartus-lite-23.1/fpga/nios2eds/bin/gnu/src/newlib-4.3.0/libgloss/nios2 " "LD=nios2-elf-ld.exe" "LIBCFLAGS=-g -Os -ffunction-sections -fdata-sections -mno-gpopt" "NM=nios2-elf-nm.exe" "PICFLAG=" "RANLIB=/mnt/d/software/verilog/NIOSII_HDMI/software/mandelbrot_plot_bsp/newlib-build-tmp/build-newlib-stage-wrapper nios2-elf-ranlib.exe" "DESTDIR=" DO=all multi-do # make
libc/argz/.deps/libc_a-argz_add.Po:1: *** target pattern contains no '%'. Stop.
make[4]: *** [Makefile:49062: all-multi] Error 2
make[3]: *** [Makefile:5078: all] Error 2
make[2]: *** [Makefile:8502: all-target-newlib] Error 2
nios2-newlib-gen: Unable to Compile smallc newlib

```

My environment is Win 11, WSL2, Quartus Lite 23.1, What should I do to fix this error?

 

0 Kudos
7 Replies
aikeu
Employee
673 Views
0 Kudos
minhlee
Beginner
660 Views

Hi @aikeu,

I don't think there is much difference between WSL1 and WSL2. I have built the Hello World example program for Nios II, and it worked. However, when I tried to built the example program for floating point program, it gave me error. I think there is problem with the Nios II build tool for generating the correct Makefile for building the library with custom nios floating point hardware instruction.

 

0 Kudos
aikeu
Employee
642 Views

Hi minhlee,


Probably can check out this forum post as it relates to the smallc compilation error:

https://community.intel.com/t5/Intel-Quartus-Prime-Software/Nios-II-Eclipse-stuck-while-compiling-newlib-for-a-smallc-C/m-p/636552


Thanks.

Regards,

Aik Eu


0 Kudos
aikeu
Employee
564 Views

Hi minhlee,


I will close the thread if no further question.


Thanks.

Regards,

Aik Eu


0 Kudos
aikeu
Employee
547 Views

Hi minhlee,


As we do not receive any response from you on the previous question/reply/answer that we have provided. Please login to ‘https://supporttickets.intel.com/s/?language=en_US’, view details of the desire request, and post a feed/response within the next 15 days to allow me to continue to support you. After 15 days, this thread will be transitioned to community support. The community users will be able to help you on your follow-up questions.



Thanks.

Regards,

Aik Eu


0 Kudos
EGrub
Beginner
425 Views

Hi Minhlee, hi Aik Eu!

I have exactly the same issue. The smallc newlib compiles fine with Quartus 22.1 but not with Quartus 23.1

 

Configure smallc newlib -> COMPLETE.
Compiling newlib for a smallc C library...
nios2-newlib-gen: Unable to Compile smallc newlib

Makefile:803: recipe for target 'newlib' failed
make[1]: *** [newlib] Error 1

 

I have Windows 10, WSL1 and Quartus 23.1 Standard (same behavior with 23.1.1) installed.

 

It seems that my code does not use the newlib at all, because if the "newlib" folder is there (empty), make does not even try to compile the newlib and compile runs through without issues! This is a very strange behavior.

I tried to disable in BSP Editor the following points: enable_reduced_device_drivers, enable_small_c_library, enable_lightweight_device_driver_api but it still compiles the newlib!

 

BR
Erich

0 Kudos
EGrub
Beginner
399 Views

I did some further tests:
There seems to be a linker bug -> because if I just generate the newlib folder (empty) compilation runs through but at the first point it uses the newlib the processor reboots. This should not happen linker should throw an error that the newlib binaries are not available!!

If I copy the newlib binaries from a 22.1 compile everything works fine!

 

I then generated the hello world project (the normal one, not the small one) and it does not compile as well, it stops with the exact same error.

So my conclusion is that there is a bug in compilation of the newlib (I use the floating point hardware 2 as well) and a bug in linker because it should throw an error if the binary is not available!

@intel/Altera employees
How to continue with that? This is a major blocker for my project!

BR

Erich

0 Kudos
Reply