Yocto SDK Kernel Source make scripts fails - linux-kernel

I am trying to compile my kernel module using the Yocto SDK I generated via bitbake.
The SDK builds without issue, but when I try to run make scripts ARCH=arm64 in the kernel source directory of my target's sysroot, I get an issue regarding a missing header file:
...
HOSTCC scripts/conmakehash
HOSTCC scripts/sortextable
HOSTCC scripts/asn1_compiler
HOSTCC scripts/extract-cert
scripts/extract-cert.c:21:10: fatal error: openssl/bio.h: No such file or directory
21 | #include <openssl/bio.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [scripts/Makefile.host:107: scripts/extract-cert] Error 1
make: *** [Makefile:1096: scripts] Error 2
I have TOOLCHAIN_TARGET_TASK_append = " kernel-devsrc openssl-dev alsa-dev" in my image .bb file, which I believe should provide the missing openssl/bio.h file, but this does not seem to be the case.
The only way I have been able to solve this issue is to install libssl-dev on my SDK machine, but this feels like a workaround, and not the proper solution. My expectation is that when you source the environment from the SDK, it should provide the necessary headers for the kernel.

Since scripts/extract-cert.c is compiled for the host environment, I'd rather try appending TOOLCHAIN_HOST_TASK variable with " openssl-dev ".
See this question: TOOLCHAIN_HOST_TASK Vs TOOLCHAIN_TARGET_TASK

Related

Cannot build package due to missing GCC headers in Buildroot (stdio.h)

Recently, I updated the Buildroot directory from 2019.11 to 2022.2 in order to build for a new board (RPi4B Rev1.5) and access the updated Linux kernel and headers. Unfortunately, I have been unable to build due to missing headers for the SWUpdate package.
An extract of the error is below. The full log can be found at this link (as it is long).
CC tools/swupdate-client.o
ipc/network_ipc-if.c:8:10: fatal error: stdio.h: No such file or directory
8 | #include <stdio.h>
| ^~~~~~~~~
ipc/network_ipc.c:9:10: fatal error: stdio.h: No such file or directory
9 | #include <stdio.h>
| ^~~~~~~~~
compilation terminated.
In file included from /home/haelyons/project_folder/buildroot/output/host/lib/gcc/arm-
buildroot-linux-gnueabihf/10.3.0/include-fixed/syslimits.h:7,
from /home/haelyons/project_folder/buildroot/output/host/lib/gcc/arm-buildroot-
linux-gnueabihf/10.3.0/include-fixed/limits.h:34,
from parser/parse_external.c:10:
/home/haelyons/project_folder/buildroot/output/host/lib/gcc/arm-buildroot-linux-
gnueabihf/10.3.0/include-fixed/limits.h:195:15: fatal error: limits.h: No such file or
directory
Essentially, as this is a package included with Buildroot, I am not sure if the issue is with my installation of GCC, or with the package itself referencing the incorrect folder. If possible, I would greatly appreciate some pointers in the right direction such as more tests that I could perform to diagnose this. Thanks, H.
After more research, it turns out this was an issue with the configuration path assigned within the Buildroot config. It was referring to the RPi3 configuration, which required a different kernel and GCC version. The fix involved the following:
make nconfig
# Navigate to: Target Packages > System Tools > SWUpdate Config Path
# Update the patch to the new board's config - BR2_EXTERNAL=<path>
make -C savedefconfig BR2_DEFCONFIG=../<config path>

Android x86 Kernel Compilation stops abruptly

I downloaded PrimeOS' kernel from https://github.com/primebook/android_kernel_common. I just need to replace a single .c file in /drivers/platform/x86. Here's what I tried doing:-
Replaced .c
make clean && make mrproper
Copied arch//configs/android-x86_deconfig to linux source root folder as .config
fakeroot make kernel -j4
The command runs but stops abruptly and the terminal shows the $ localhost as if the task is finished. Can you tell me where I went wrong.
Update
Here's the place where the issue comes:-
HOSTCC scripts/basic/fixdep
HOSTCC scripts/kconfig/conf.o
YACC scripts/kconfig/zconf.tab.c
LEX scripts/kconfig/zconf.lex.c
..............................................................
CC kernel/time/timeconv.o
In file included from ./arch/x86/include/asm/string.h:3,
from ./include/linux/string.h:20,
from ./arch/x86/include/asm/page_32.h:35,
from ./arch/x86/include/asm/page.h:14,
from ./arch/x86/include/asm/thread_info.h:12,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/mmzone.h:8,
from ./include/linux/gfp.h:6,
from ./include/linux/mm.h:10,
from ./include/linux/ring_buffer.h:5,
from kernel/trace/trace.c:15:
In function ‘ftrace_dump’,
inlined from ‘ftrace_dump’ at kernel/trace/trace.c:8269:6:
./arch/x86/include/asm/string_32.h:325:29: warning: ‘__builtin_memset’ offset [8297, 8336] from the object at ‘iter’ is out of the bounds of referenced subobject ‘seq’ with type ‘struct trace_seq’ at offset 4176 [-Warray-bounds]
325 | #define memset(s, c, count) __builtin_memset(s, c, count)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/trace/trace.c:8347:3: note: in expansion of macro ‘memset’
8347 | memset(&iter.seq, 0,
| ^~~~~~
CC kernel/time/timecounter.o
..............................................................
AR kernel/built-in.a
$
Full Log: https://pastebin.com/8T3G3Uyc
So, it just comes back to $ as if the process completed at kernel/built-in.a. This is the file where every time it stops. Even if I compile the kernel without any changes, it still stops at kernel/built-in.a
BTW, I am just using the source I downloaded from primebook and installed the necessary packages for recompiling the kernel. Should I be doing something else too.
UPDATE 1
I tried running make -j4 bzImage modules but this again stops at
AR drivers/video/built-in.a
AR drivers/built-in.a
Even this doesn't compile a bzImage
UPDATE 2
I tried running make kernel on a Linux source (5.4.0) and even that stops at built-in.a
UPDATE 3
I tried running make bzImage modules without -j4 and I get a new error now
sound/soc/codecs/es8316.c:766:1: note: in expansion of macro ‘module_i2c_driver’
766 | module_i2c_driver(es8316_i2c_driver);
| ^~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[3]: *** [scripts/Makefile.build:304: sound/soc/codecs/es8316.o] Error 1
make[2]: *** [scripts/Makefile.build:544: sound/soc/codecs] Error 2
make[1]: *** [scripts/Makefile.build:544: sound/soc] Error 2
make: *** [Makefile:1050: sound] Error 2
Full log: https://pastebin.com/JJeh4QTk
UPDATE 4
make bzImageworks and outputs the bzImage as expected.
Fix for kernel compilation stopping at make a built-in.a file
Use make bzImage or make bzImage modules instead of make kernel
Update - In my case the error was with the ES8316.c which was causing the compilation to stop. Go to your config file and delete the lines pertaining to ES8316 and the build went through successfully.
Fix for other Errors in the question
For the codec issue and for any other conflicting module, go to your config file and search for it, for eg:- i had issue with the module for ES8316. To fix it, remove the line corresponding to ES8316 in your config file or add a # infront of it. You may also try to debug the problem if you really need that driver.
Other things that you could try
I had gcc-9 installed and installing gcc-8 did help at times.

Using mingw-w64 and ./configure --host=i686-w64-mingw32.static, make fails and Makefile CC variable looks wrong

I am new to compiling.
I am trying to compile iperf3 for Windows 10 because there is no official Windows distribution of iperf3 and for the learning experience. I am trying to do so on the new Windows Subsystem for Linux feature via Bash on Ubuntu on Windows, also for the learning experience.
I installed mingw-w64, which should give me the proper compiler and environment necessary for cross-compiling:
sudo apt-get install mingw-w64
This put two directories into my /usr directory:
i686-w64-mingw32
x86_64-w64-mingw32
It also put a bunch of things that look like compilers into /usr/bin.
I unzipped the .tar.gz file from iperf3 and navigated into it. Then, I run ./configure --host=i686-w64-mingw32.static and it completes without errors.
I note that the output of the command has a worrisome line: checking for i686-w64-mingw32.static-gcc... no
I note that the Makefile's CC variable is set to gcc, which doesn't sound like the proper compiler.
Then, I run make. It fails with errors:
collect2: error: ld returned 1 exit status
make[2]: *** [iperf3] Error 1
make[2]: Leaving directory `/home/snip/iperf3/iperf-3.1.4/src'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/snip/iperf3/iperf-3.1.4/src'
make: *** [all-recursive] Error 1
I also see the line: libtool: warning: undefined symbols not allowed in i686-w64-mingw32.static shared libraries; building static only
I think that the ./configure is not working correctly since it appears to have not found the right compiler for my --host argument and put it in the Makefile.
What am I doing wrong?
EDIT:
I changed the command to ./configure --host=i686-w64-mingw32 per comments and it completes without error. But no makefile is created so make yields make: *** No targets specified and no makefile found. Stop.
What am I doing wrong, now?
EDIT 2:
Looks like the ./configure actually is failing. Last line of its output is nanosleep() required for timing operations., which seems to mean that its missing a library for nanosleep.
How do I get nanosleep?
mingw doesn't support nanosleep. So programs using it cannot be compiled using mingw-w64.

Cutecom installation fails on OSX Mavericks

I'm trying to install cutecom on OSX Mavericks but I'm getting some erros.
Here are the steps that I followed.
install qt through brew
brew install qt
update path on .bashprofile
export PATH=/usr/local/Cellar/qt/4.8.6/bin:$PATH
extract files of cutecom
compile source code of cutecom
$ mkdir build
$ cd build
$ cmake ..
$ make
And the output of make is:
[ 20%] Generating ui_cutecommdlg.h
/Users/kc/Downloads/cutecom-0.22.0/cutecommdlg.ui: Warning: The form file has external pixmaps or qPixmapFromMimeSource() set as a pixmap function. This requires Qt 3 support, which is disabled. The resulting code will not compile.
[ 40%] Generating moc_qcppdialogimpl.cxx Scanning dependencies of target cutecom
[ 60%] Building CXX object CMakeFiles/cutecom.dir/main.cpp.o
In file included from /Users/kc/Downloads/cutecom-0.22.0/main.cpp:21:
In file included from /Users/kc/Downloads/cutecom-0.22.0/qcppdialogimpl.h:22:
/Users/kc/Downloads/cutecom-0.22.0/build/ui_cutecommdlg.h:12:10: fatal error:
'Qt3Support/Q3MimeSourceFactory' file not found
#include <Qt3Support/Q3MimeSourceFactory>
^
1 error generated.
make[2]: *** [CMakeFiles/cutecom.dir/main.cpp.o] Error 1
make[1]: *** [CMakeFiles/cutecom.dir/all] Error 2
make: *** [all] Error 2
Any suggestions ?
Thank you very much for your time.
Kostas.
The Qt package you have is missing Qt3Support (on purpose). This component is necessarily for some Qt4 software that still uses deprecated features dating back to Qt3.
Based on the documentation I've been able to find online, you should be able to reinstall Qt4 with the extras you need using a command like this:
brew install --with-qt3support qt

QCA Library for windows

I am compiling the QCA Library for windows and using the steps from INSTALL File for for configure I am using the following command in windows console:
configure.exe --qtdir=C:\QtSDK\Desktop\Qt\4.7.3\mingw
The response is:
Configuring Qt Cryptographic Architecture (QCA) ...
Reason: There was an error compiling 'conf'. See conf.log for details.
I am trying to compile using Qt in windows directly and shows the following error:
-I"c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\ActiveQt" -I"release" -I"." -I"c:\QtSDK\Desktop\Qt\4.7.3\mingw\mkspecs\win32-g++" -o release\mlock.o ..\..\Encryption-QCA\src\botantools\botan\ml_win32\mlock.cpp
In file included from c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.4.0/../../../../include/objbase.h:73,
from c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.4.0/../../../../include/ole2.h:9,
from c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.4.0/../../../../include/windows.h:114,
from ..\..\Encryption-QCA\src\botantools\botan\ml_win32\mlock.cpp:37:
c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.4.0/../../../../include/objidl.h:95: error: expected unqualified-id before string constant
mingw32-make[2]: Leaving directory `C:/Users/AlejoLina/Documents/Alejandro/Compacta/SE-HA_Tool/Encryption-QCA-build-desktop/src'
mingw32-make[1]: Leaving directory `C:/Users/AlejoLina/Documents/Alejandro/Compacta/SE-HA_Tool/Encryption-QCA-build-desktop/src'
mingw32-make[2]: *** [release/mlock.o] Error 1
mingw32-make[1]: *** [release] Error 2
mingw32-make: *** [sub-src-make_default] Error 2
The process "C:\QtSDK\mingw\bin\mingw32-make.exe" exited with code 2.
Error while building project qca (target: Desktop)
When executing build step 'Make'
Thanks in advance for the help
I can't say for sure that this is your problem but you may want to try using the make that is available with MSYS. I've always had better success with it. From MinGW's own FAQ..
The "native" (i.e.: MSVCRT dependent)
port of make is lacking in some
functionality and has modified
functionality due to the lack of POSIX
on Win32.
The problem in the configure was that the executable doesnt find the windows make (mingw-make).
The solution is to put the right path to the envinronment variables (qt and mingw bin path).

Resources