Linux kernel 'make rpm-pkg' throws error - linux

I am trying to create a custom kernel rpm. So I made use of "make rpm-pkg".
Everything was going fine until it hit this error.
..
..
INSTALL sound/usb/line6/snd-usb-toneport.ko
INSTALL sound/usb/line6/snd-usb-variax.ko
INSTALL sound/usb/misc/snd-ua101.ko
INSTALL sound/usb/snd-usb-audio.ko
INSTALL sound/usb/snd-usbmidi-lib.ko
scripts/Makefile.fwinst:43: *** mixed implicit and static pattern rules. Stop.
make[2]: *** [_modinst_post] Error 2
error: Bad exit status from /var/tmp/rpm-tmp.jJi4sq (%install)
RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.p88MqU (%install)
make[1]: *** [rpm-pkg] Error 1
make: *** [rpm-pkg] Error 2
I understand there is something wrong with Makefile declarations, but also wondering if anyone has hit this issue.

If you are using make version 3.81 or 3.82 then this is likely the known make "bug" discussed here.
Specifically a change to what make believes is a meaningful set of targets to specify in a single list changed in an incompatible way and the kernel had been using a set of targets that became invalid.
The fix, after some back and forth between the GNU Make maintainer and some concerned other developers, was to convert the fatal error into a warning (at least temporarily).

I was able to fix this. Apparently its an issue with the UTS_MACHINE not being right for arm64. It should be aarch64 so that the packaging scripts use it right. there's also small tweak in the script that generates the rpm spec file.
So 'make' is not an issue in this case.

Related

arm-openbmc-linux-gnueabi-gcc: Command not found

I got a BMC project which need to use AST2600. I just start to handle u-boot.
When I enter blow instruction. I got a error when make.
export ARCH=arm
export CROSS_COMPILE=arm-openbmc-linux-gnueabi-
make ast2600_openbmc_defconfig
make
Result:
make: arm-openbmc-linux-gnueabi-gcc: Command not found
/bin/sh: 1: arm-openbmc-linux-gnueabi-gcc: not found
dirname: missing operand
Try 'dirname --help' for more information.
scripts/kconfig/conf --syncconfig Kconfig
CHK include/config.h
CFG u-boot.cfg
/bin/sh: 1: arm-openbmc-linux-gnueabi-gcc: not found
make[1]: *** [scripts/Makefile.autoconf:77: u-boot.cfg] Error 1
make: *** No rule to make target 'include/config/auto.conf', needed by 'include/config/uboot.release'. Stop.
The project from https://github.com/AspeedTech-BMC/u-boot
It seems like I miss a toolchain for arm-openbmc-linux-gnueabi-gcc. Does anyone have idea?
From an openbmc perspectives, I almost never build the uboots independently of from the bitbake/yocto project, (and when I do, I build projects in x86) Manually building should work, but openbmc (using bitbake/yocto) already has an automated process for building this project with the gcc tool chain that works for the AST2600 here and here
If you are planning on using openbmc I would recomened starting with these instructions.
In step 3 make sure to specify an platform with ast2600 (such as the
evb-ast2600)
Then in step 4 make you can just built uboot rather then a whole image. Something like bitbake u-boot-aspeed-sdk_2019.04, or you can build the whole image, and it take longer but you will have a copy of uboot.
If you have any more question feel free to reach out us in the open bmc email list https://lists.ozlabs.org/listinfo/openbmc, or to our discord https://discord.gg/69Km47zH98.

Problems building driver on Linux kernel 5.8.x

I'm working with a Linux driver that is building on v5.7.x kernels but not on the latest v5.8.x releases.
To summarise, most of the driver is pre-built and the kernel interface is built on the target. This involves a make -f Kbuild command.
Having checked all of the relevant kernel interface files for any changes that would affect us, normally the driver would just build as usual on a new kernel. However, this time we get the following error:
make[2]: *** [scripts/Makefile.modpost:111: /path/to/source/Module.symvers] Error 1
make[1]: *** [Makefile:1669: modules] Error 2
make[1]: Leaving directory '/usr/src/kernels/5.8.0-1.el8.elrepo.x86_64'
make: *** [Kbuild:26: default] Error 2
This is from CentOS 8.1, but the same error has been seen on Ubuntu 20.04.
I am no expert on this so interpreting these errors is a bit difficult. I have tried building with the KBUILD_VERBOSE flag and it doesn't really provide any useful information, other than the build succeeding until this point.
On previous kernels the Module.symvers file would be created but empty. On 5.8 this file is not created at all presumably due to this error. As a result, the .ko file is not created.
Finally, if we drop in the source files rather than the pre-built .o files the build does succeed. These .o files are built with a very old version of GCC (4.4.7) but we have also tried building with a much newer version (8.3.1), the same version as the target machine.
I would appreciate suggestions for things to check. Let me know if any other details would help.
Edit:
I ran make on Makefile.modpost manually and got the following output:
sudo make -f ./scripts/Makefile.modpost
WARNING: Symbol version dump "vmlinux.symvers" is missing.
Modules may not have dependencies or modversions.
make -f /scripts/Makefile.modfinal
make[1]: Entering directory '/usr/src/linux-headers-5.8.0-050800-generic'
make[1]: /scripts/Makefile.modfinal: No such file or directory
make[1]: *** No rule to make target '/scripts/Makefile.modfinal'. Stop.
make[1]: Leaving directory '/usr/src/linux-headers-5.8.0-050800-generic'
make: *** [scripts/Makefile.modpost:117: __modpost] Error 2
I am answering my own question in case it helps anyone else with this problem. Although it has never been an issue in the past, we've always had a warning that the corresponding .o.cmd file was not present for our .o_shipped files. This appears to be important in kernel 5.8 onwards and my fix was to add a touch command to the Kbuild file (i.e. "touch .driver.o.cmd"). This does not remove the warning but it allows the driver to build as normal.

open2: exec of lzma -c0 failed a internal-package Error 2 while building in Theos

I keep getting make: * [internal-package] Error 2 when trying to build a tweak I'm working on. Ive never had this issue before, and its not specifying whats wrong. Here is what it says:
yinyongzhen#eagle:Desktop/tingtweak ‹master*›$ make package
Making all for tweak tingtweak…
make[2]: Nothing to be done for internal-library-compile'.
Making stage for tweak tingtweak…
dm.pl: building packagecom.yz.tingtweak:iphoneos-arm' in `./packages/com.yz.tingtweak_0.0.1-1+debug_iphoneos-arm.deb'
open2: exec of lzma -c0 failed at /Users/yinyongzhen/theos/bin/dm.pl line 113.
make: *** [internal-package] Error 2
Try running the lzma command in terminal, if it's missing, you need to:
brew install xz
For those facing the same issue, make sure dpkg is installed on your machine. It is require for Theos. Installing it will get rid of the error with lzma (it seems to be part of).
brew install dpkg

How do I find the actual GCC error in compiler output?

I'm trying to compile some old software from source on debian-based linux.
The build failed:
make[2]: Leaving directory '/home/owner/kallistios/utils/dc-chain/build-gcc-sh-elf-4.7.3'
Makefile:871: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/home/owner/kallistios/utils/dc-chain/build-gcc-sh-elf-4.7.3'
Makefile:201: recipe for target 'build-sh4-gcc-pass2' failed
make: *** [build-sh4-gcc-pass2] Error 1
owner#ubuntu:~/kallistios/utils/dc-chain$
But it doesn't say what the actual error is or how I can find it in the output.
If I don't know what the problem is obviously I can't fix it.
This is the full output:
http://pasted.co/cff68fa2
The first thing to do if you're having problems deciphering error output is to NOT run the build in parallel (don't use the -j flag). Also you should NOT use the keep-going (-k) flag. If you don't use -j or -k then make will run one recipe at a time and fail as soon as a recipe fails. So, whenever you get an error the last command that was printed is the one that failed.
Also if you want to use -j and you're using a new-enough version of GNU make (4.0 or above) you can add the -Otarget option which will collect all the output from a given target and print it atomically at the end of the recipe, rather than interweaving output from different recipes together.
In your situation it appears as though one of the configure operations failed. It's not easy to tell exactly why because of the parallel build output. This may or may not be related:
kos is an unknown thread package
...
Makefile:3810: recipe for target 'configure-gcc' failed
make[2]: *** [configure-gcc] Error 1
You are trying to compile the Sega Dreamcast toolchain which I know very well, using the dc-chain utility inside KallistiOS (often shortened to KOS).
The key error message here is kos is an unknown thread package. It means that you don't have applied the KOS patches before compiling your sh-elf cross-compiler.
To solve this issue, you just have to enter the make patch command before running everything else. Please note, if you just enter the make command, it will already apply the patches.
To finish this answer, you may check the KallistiOS Nitro repository, as this repo is handling the official KOS plus a lot of community patches, including some very interesting things about the dc-chain utility, like complete documentation.

LFS 7.2: Hundreds of errors in glibc make check

I am on Section 6.9 of the LFS book. Everything before this section seemed fine.
When I ran make check I got a huge number of errors. A longer transcript of my make check run can be found here on Pastebin.
Summary of test results:
865 FAIL
1308 PASS
202 XFAIL
Makefile:321: recipe for target 'tests' failed
make[1]: *** [tests] Error 1
make[1]: Leaving directory '/sources/glibc-2.21'
Makefile:9: recipe for target 'check' failed
make: *** [check] Error 2
I'm wondering, if looking at the transcript anyone can infer something obvious that I did incorrectly. I think I followed the book word for word, but I may have missed something along the way.
It's likely that GLIBC make check expects some basic command to be present, but that command is missing from your LFS system.
I just checked my GLIBC build, and all the conform tests use /usr/bin/perl.
Look for errors in conform/XPG4/locale.h/linknamespace.out. The problem will likely be obvious.
/bin/sh: line 2: no: command not found
So it's likely that configure looked for perl, didn't find it, and set PERL in config.make to no.
To fix this, you need to install perl before you can run make check.

Resources