Forum Discussion
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
@EGrub wrote: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.
Newlib only gets built if the newlib folder is NOT there.
This is some form of Makefile dependency.
Now when you link your application, it has multiple linker include paths, the first is the local newlib folder. If it happens to be empty, it will use the next include path, which if I recall correctly is this one: C:\intelFPGA_lite\23.1std\nios2eds\bin\gnu\H-x86_64-mingw32\nios2-elf\lib
You will see the newlib files being there, if you are curious, you could move this folder away and see if your application still links.
I have just created this test (by renaming lib to _lib at C:\intelFPGA_lite\23.1std\nios2eds\bin\gnu\H-x86_64-mingw32\nios2-elf) and I get the following errors:
c:/intelfpga_lite/23.1std/nios2eds/bin/gnu/h-x86_64-mingw32/bin/../lib/gcc/nios2-elf/12.3.1/../../../../../H-x86_64-mingw32/nios2-elf/bin/ld.exe: cannot find -lstdc++: No such file or directory
c:/intelfpga_lite/23.1std/nios2eds/bin/gnu/h-x86_64-mingw32/bin/../lib/gcc/nios2-elf/12.3.1/../../../../../H-x86_64-mingw32/nios2-elf/bin/ld.exe: cannot find -lm: No such file or directory
c:/intelfpga_lite/23.1std/nios2eds/bin/gnu/h-x86_64-mingw32/bin/../lib/gcc/nios2-elf/12.3.1/../../../../../H-x86_64-mingw32/nios2-elf/bin/ld.exe: cannot find -lsmallc: No such file or directory
c:/intelfpga_lite/23.1std/nios2eds/bin/gnu/h-x86_64-mingw32/bin/../lib/gcc/nios2-elf/12.3.1/../../../../../H-x86_64-mingw32/nios2-elf/bin/ld.exe: cannot find -lm: No such file or directory
collect2.exe: error: ld returned 1 exit status
Normally my self compiled newlib folder would contain:
crt0.o
libc.a
libg.a
libm.a
libnosys.a
libsmallc.a
libsmallg.a
libstack.a
As you can see libm.a and libcmallc.a would have been taken from the local newlib folder, (if they would have been there)
So, yes it will work, but you won't get the hand tailored version of newlib which you have set up in your settings.bsp file
Regarding the issue, that newlib can not be built:
I have the very same issue, hence I landed here at this topic.
It is a shame, that this has not been taken serious enough to have a fix for this.