I am trying to compile linux kernel v5.9.12 using my buildroot toolchain (2020.08.2) and I keep getting an error related to libfdt. I can't figure out how to fix this and I've been banging my head against the wall for several hours now.
username#local:~/linux-stable$ make ARCH=arm CROSS_COMPILE=arm-linux- -j64
CALL scripts/atomic/check-atomics.sh
CALL scripts/checksyscalls.sh
CHK include/generated/compile.h
Kernel: arch/arm/boot/Image is ready
AS arch/arm/boot/compressed/piggy.o
CC arch/arm/boot/compressed/fdt_ro.o
In file included from arch/arm/boot/compressed/../../../../lib/fdt_ro.c:2,
from arch/arm/boot/compressed/fdt_ro.c:2:
arch/arm/boot/compressed/../../../../lib/../scripts/dtc/libfdt/fdt_ro.c: In function ‘fdt_generate_phandle’:
arch/arm/boot/compressed/../../../../lib/../scripts/dtc/libfdt/fdt_ro.c:149:13: error: ‘FDT_MAX_PHANDLE’ undeclared (first use in this function)
149 | if (max == FDT_MAX_PHANDLE)
| ^~~~~~~~~~~~~~~
arch/arm/boot/compressed/../../../../lib/../scripts/dtc/libfdt/fdt_ro.c:149:13: note: each undeclared identifier is reported only once for each function it appears in
arch/arm/boot/compressed/../../../../lib/../scripts/dtc/libfdt/fdt_ro.c: In function ‘fdt_get_mem_rsv’:
arch/arm/boot/compressed/../../../../lib/../scripts/dtc/libfdt/fdt_ro.c:182:13: error: implicit declaration of function ‘fdt64_ld’ [-Werror=implicit-function-declaration]
182 | *address = fdt64_ld(&re->address);
| ^~~~~~~~
arch/arm/boot/compressed/../../../../lib/../scripts/dtc/libfdt/fdt_ro.c: In function ‘fdt_get_property_by_offset_’:
arch/arm/boot/compressed/../../../../lib/../scripts/dtc/libfdt/fdt_ro.c:371:11: error: implicit declaration of function ‘fdt32_ld’ [-Werror=implicit-function-declaration]
371 | *lenp = fdt32_ld(&prop->len);
| ^~~~~~~~
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:283: arch/arm/boot/compressed/fdt_ro.o] Error 1
make[1]: *** [arch/arm/boot/Makefile:64: arch/arm/boot/compressed/vmlinux] Error 2
make: *** [arch/arm/Makefile:330: zImage] Error 2
make: *** Waiting for unfinished jobs....
I have added output/host/usr/bin to my PATH env variable so make can find the toolchain. Any ideas?
It turns out that in arch/arm/boot/compressed there were a bunch of old libfdt related header files still hanging around, so by deleting these I was able to build the kernel. I found the files using git status.
Related
I am new to Buildroot (using 2021.02.5 version on Ubuntu on a Virtual Machine) and trying to compile an OS for my ZedBorad (ARM processor) during my internship.
I followed the tutorial that was given to me to do so but I still can't get make to work without printing any error.... :(
I configured what I want that way :
Kernel > Linux Kernel disabled
Bootloader > U-Boot disabled
Toolchain > C library = glibc
Target Packages > python3, xml module, python-lxml and python-numpy all selected
Networking Applications > dhcpcd and dropbear selected
Right now, what is returned to me are errors due to undefined reference to ... :
More precisely, the end of my logs after running make is as follows :
/home/ouriacc/workspace/Buildroot/build-zb/host/lib/gcc/arm-buildroot-linux-gnueabihf/9.4.0/../../../../arm-buildroot-linux-gnueabihf/bin/ld: /home/ouriacc/workspace/Buildroot/build-zb/build/glibc-2.32-50-g737efa27fca5c97f566a2005687fda7d6659cd2e/build/elf/librtld.os: in function `fdopendir':
(.text+0x1a89c): undefined reference to `__GI___fxstat64'
/home/ouriacc/workspace/Buildroot/build-zb/host/lib/gcc/arm-buildroot-linux-gnueabihf/9.4.0/../../../../arm-buildroot-linux-gnueabihf/bin/ld: (.text+0x1a8c0): undefined reference to `__GI___fcntl64_nocancel'
/home/ouriacc/workspace/Buildroot/build-zb/host/lib/gcc/arm-buildroot-linux-gnueabihf/9.4.0/../../../../arm-buildroot-linux-gnueabihf/bin/ld: /home/ouriacc/workspace/Buildroot/build-zb/build/glibc-2.32-50-g737efa27fca5c97f566a2005687fda7d6659cd2e/build/elf/ld.so.new: hidden symbol `__getpid' isn't defined
/home/ouriacc/workspace/Buildroot/build-zb/host/lib/gcc/arm-buildroot-linux-gnueabihf/9.4.0/../../../../arm-buildroot-linux-gnueabihf/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make[4]: *** [Makefile:566 : /home/ouriacc/workspace/Buildroot/build-zb/build/glibc-2.32-50-g737efa27fca5c97f566a2005687fda7d6659cd2e/build/elf/ld.so] Erreur 1
make[3]: *** [Makefile:470 : elf/subdir_lib] Erreur 2
make[2]: *** [Makefile:9 : all] Erreur 2
make[1]: *** [package/pkg-generic.mk:250 : /home/ouriacc/workspace/Buildroot/build-zb/build/glibc-2.32-50-g737efa27fca5c97f566a2005687fda7d6659cd2e/.stamp_built] Erreur 2
make: *** [Makefile:23 : _all] Erreur 2
I read several threads on forums about this error but I still can't figure out exactly what I should do in my case. For what I understand, there is a problem with my ld.so library and I should add something to remove or fix this error in a Makefile but I don't know what to write, where to write it and even which Makefile I should edit (as there are at least 2)...
Does anybody has an answer or another solution to help me please ?
It seems that you use an external toolchain. Try to set LD_LIBRARY_PATH environment variable for your toolchain. For example:
export LD_LIBRARY_PATH="/opt/x86-64-core-i7--glibc--stable-2020.08-1/x86_64-buildroot-linux-gnu/lib64:$LD_LIBRARY_PATH"
in your case possible the following will be suitable:
export LD_LIBRARY_PATH="/home/ouriacc/workspace/Buildroot/build-zb/host/lib/gcc/arm-buildroot-linux-gnueabihf/9.4.0/../../../../arm-buildroot-linux-gnueabihf/lib64:$LD_LIBRARY_PATH"
You may do that in docker, if you use one or in the your shell environment.
I want to compile linux kernel subdirectory just like this:
make M=drivers/staging/comedi/
Unfortunately when I do this I get this error:
ERROR: Kernel configuration is invalid.
include/generated/autoconf.h or include/config/auto.conf are missing.
Run 'make oldconfig && make prepare' on kernel src to fix it.
Makefile:648: include/config/auto.conf: Nie ma takiego pliku ani katalogu
make: *** [Makefile:719: include/config/auto.conf] Błąd 1
It may be fixed by this command:
make oldconfig
After executing it, I have to press enter for 2 minutes to select the default options everywhere, and then I get this error anyway:
AR drivers/staging/comedi//built-in.a
WARNING: Symbol version dump "Module.symvers" is missing.
Modules may not have dependencies or modversions.
MODPOST drivers/staging/comedi//Module.symvers
/bin/sh: scripts/mod/modpost: Nie ma takiego pliku ani katalogu
make[1]: *** [scripts/Makefile.modpost:111: drivers/staging/comedi//Module.symvers] Błąd 127
make: *** [Makefile:1701: modules] Błąd 2
I have seen many times in the videos people just building a subdirectory with one make M=somedir command. Why doesn't it work for me?
I am trying to compile DCMTK from the source through MinGW32-w64 and Cmake.
I am getting these errors after mingw32-make command:
In file included from C:/dcmtk/oflog/include/dcmtk/oflog/internal/internal.h:59,
from C:\Users\Rodrigo\Downloads\tmp_dcmtk\dcmtk\oflog\libsrc\oflog.cc:35:
C:/dcmtk/oflog/include/dcmtk/oflog/thread/impl/tls.h: In function 'dcmtk::log4cplus::thread::impl::tls_key_type dcmtk::log4cplus::thread::impl::tls_init(PFLS_CALLBACK_FUNCTION)':
C:/dcmtk/oflog/include/dcmtk/oflog/thread/impl/tls.h:127:12: error: 'FlsAlloc' was not declared in this scope
return FlsAlloc(cleanupfunc);
^~~~~~~~
C:/dcmtk/oflog/include/dcmtk/oflog/thread/impl/tls.h:127:12: note: suggested alternative: 'TlsAlloc'
return FlsAlloc(cleanupfunc);
^~~~~~~~
TlsAlloc
C:/dcmtk/oflog/include/dcmtk/oflog/thread/impl/tls.h: In function 'void* dcmtk::log4cplus::thread::impl::tls_get_value(dcmtk::log4cplus::thread::impl::tls_key_type)':
C:/dcmtk/oflog/include/dcmtk/oflog/thread/impl/tls.h:137:12: error: 'FlsGetValue' was not declared in this scope
return FlsGetValue(k);
^~~~~~~~~~~
C:/dcmtk/oflog/include/dcmtk/oflog/thread/impl/tls.h:137:12: note: suggested alternative: 'TlsGetValue'
return FlsGetValue(k);
^~~~~~~~~~~
TlsGetValue
C:/dcmtk/oflog/include/dcmtk/oflog/thread/impl/tls.h: In function 'void dcmtk::log4cplus::thread::impl::tls_set_value(dcmtk::log4cplus::thread::impl::tls_key_type, dcmtk::log4cplus::thread::impl::tls_value_type)':
C:/dcmtk/oflog/include/dcmtk/oflog/thread/impl/tls.h:148:5: error: 'FlsSetValue' was not declared in this scope
FlsSetValue(k, value);
^~~~~~~~~~~
C:/dcmtk/oflog/include/dcmtk/oflog/thread/impl/tls.h:148:5: note: suggested alternative: 'TlsSetValue'
FlsSetValue(k, value);
^~~~~~~~~~~
TlsSetValue
C:/dcmtk/oflog/include/dcmtk/oflog/thread/impl/tls.h: In function 'void dcmtk::log4cplus::thread::impl::tls_cleanup(dcmtk::log4cplus::thread::impl::tls_key_type)':
C:/dcmtk/oflog/include/dcmtk/oflog/thread/impl/tls.h:159:5: error: 'FlsFree' was not declared in this scope
FlsFree(k);
^~~~~~~
C:/dcmtk/oflog/include/dcmtk/oflog/thread/impl/tls.h:159:5: note: suggested alternative: 'TlsFree'
FlsFree(k);
^~~~~~~
TlsFree
mingw32-make[2]: *** [oflog\libsrc\CMakeFiles\oflog.dir\build.make:80: oflog/libsrc/CMakeFiles/oflog.dir/oflog.cc.obj] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:2533: oflog/libsrc/CMakeFiles/oflog.dir/all] Error 2
mingw32-make: *** [Makefile:157: all] Error 2
I found this link with a similar error, however, no solutions were provided.
Does anyone know how to solve this?
System:
Windows 10 x64
MinGW-W64 GCC-8.1.0
Gcc (i686-posix-dwarf-rev0, Built by MinGW-W64 project) 8.1.0
The MinGW headers do not make all of the Win32 API functions visible by default. Add a line like add_compile_definitions (_WIN32_WINNT=0x600) to CMakeLists.txt file to make the Vista and later API visible. That should fix your compilation.
I would like to cross-compile lmbench for ARM64, on a x86 machine. I have built my own cross-compiler according to the guide here: http://preshing.com/20141119/how-to-build-a-gcc-cross-compiler/
When I tried cross-compiling lmbench3 with this cross-compiler I first had to:
remove all the lines where bk.ver was used in the src/Makefile
replace bk.ver by 3 at line 200 of the Makefile, so that I have:
sed -e "s/<version>/3/g" < ../scripts/lmbench > $O/lmbench
Set CC=aarch64-linux-gcc, OS=aarch64-linux-gnu, CFLAGS="$CFLAGS -static"
Put all the glibc-2.20/sunrpc/rpc header files into /opt/cross/aarch64-linux/include/rpc folder
Then when I type the make command I get the following error:
gmake[1]: Entering directory `/home/florian/lmbench3/src'
aarch64-linux-gcc -O -DRUSAGE -DHAVE_uint=1 -DHAVE_int64_t=1 -DHAVE_DRAND48 -DHAVE_SCHED_SETAFFINITY=1 -o ../bin/aarch64-linux-gnu/bw_tcp bw_tcp.c ../bin/aarch64-linux-gnu/lmbench.a -lm
../bin/aarch64-linux-gnu/lmbench.a(lib_tcp.o): In function `tcp_done':
lib_tcp.c:(.text+0x18): undefined reference to `pmap_unset'
../bin/aarch64-linux-gnu/lmbench.a(lib_tcp.o): In function `tcp_connect':
lib_tcp.c:(.text+0x338): undefined reference to `pmap_getport'
../bin/aarch64-linux-gnu/lmbench.a(lib_tcp.o): In function `tcp_server':
lib_tcp.c:(.text+0x568): undefined reference to `pmap_unset'
lib_tcp.c:(.text+0x584): undefined reference to `pmap_set'
collect2: error: ld returned 1 exit status
gmake[1]: *** [../bin/aarch64-linux-gnu/bw_tcp] Error 1
gmake[1]: Leaving directory `/home/florian/lmbench3/src'
make: *** [lmbench] Error 2
I know that pmap_set, pmap_unset and pmap_getport are called in lib_tcp.c, but I don't find anywhere their definitions. When I compile lmbench3 for x86 I don't get this error, and I checked everywhere on the host machine for the definition of these functions, but still don't find them anywhere.
Does anyone know what to do with this error? I guess I still need to use RPC, so I'd prefer not commenting any line.
From the error info, ld didn't find the lib, try following
make results LDFLAGS=-ltirpc
Recently when I try to compile a large Fortran code, I met an error, which is in terms of hypre:
/ccs/home/phimar/opt/hypre//lib/libHYPRE.a(par_cr.o): In function `hypre_BoomerAMGCoarsenCR1':
par_cr.c:(.text+0x20e): undefined reference to `_simd_drand48_pd64x2'
/ccs/home/xialing/opt/hypre//lib/libHYPRE.a(par_cr.o): In function `cr':
par_cr.c:(.text+0xd4e): undefined reference to `_simd_drand48_pd64x2'
/usr/bin/ld: link errors found, deleting executable `/tmp/work/phimar/NGA_2way/bin/arts'
make[1]: *** [arts] Error 1
make[1]: Leaving directory `/autofs/na3_home1/phimar/NGA/src'
make: *** [default] Error 2
which seems to me that it has something to do with the compiler or the hypre src itself. So I tried to start from a clean version, unzip the hypre 2.6.0b zip file and then load the Intel compiler (with the newest version 13.1.3.192 on Titan). But I ended up with the same error.
Do offer your wisdom if this rings a bell. Really appreciate your help!