#21917 closed enhancement (fixed)
7zip-25.00 build fail
| Reported by: | zeckma | Owned by: | Douglas R. Reno |
|---|---|---|---|
| Priority: | normal | Milestone: | 12.4 |
| Component: | BOOK | Version: | git |
| Severity: | medium | Keywords: | |
| Cc: |
Description
A user on the LFS Discord brought this issue to me.
Currently, 7zip uses Werror. Something else is that the for loop we employ does not catch errors, but can be circumvented by doing bash -e or set -e for the for loop specifically.
The end result is:
../../UI/Common/ArchiveExtractCallback.cpp:68:11: error: macro ‘REPLACE_SLASHES_from_Linux_to_Sys’ is not used [-Werror=unused-macros]
68 | #define REPLACE_SLASHES_from_Linux_to_Sys(s)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
make: *** [../../7zip_gcc.mak:884: b/g/ArchiveExtractCallback.o] Error 1
make: *** Waiting for unfinished jobs....
However, the process will then read the next make file as if the error didn't happen. The error still occurs and we should fix this. The macro from what I heard actually appears in other files, so we can't just remove the macro. But turning Werror off should be sufficient.
Change History (11)
comment:1 by , 14 months ago
comment:2 by , 14 months ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
comment:3 by , 14 months ago
Using set -e will be a bad idea as it would exit the current Bash instance on error and no extra instance was created beforehand. So bash -e would be best, like what we do for pages that have clumped packages, like Xorg Libraries.
comment:4 by , 14 months ago
Fixed at r12.3-1141-g7b997cc16b and r12.3-1142-gedb82cdeed.
The fix is wrapping the loop in (...) and and || exit for the make command in the loop, like the loop in the installation instruction.
comment:5 by , 14 months ago
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
comment:6 by , 14 months ago
FTR we cannot simply use || break here because it'll cause the loop to terminate with a zero status code.
comment:8 by , 14 months ago
| Resolution: | fixed |
|---|---|
| Status: | closed → reopened |
The issue was not fixed. CFLAGS_WARN_ALL=-Wall still leads to a build failure. The loop catches errors however.
The issue is that the make file contains this:
ifneq ($(CC), xlc) CFLAGS_WARN_WALL = -Werror -Wall -Wextra endif
So CFLAGS_WARN_WALL will get overwritten. This is why Gentoo edits the make file directly.
comment:9 by , 14 months ago
| Resolution: | → fixed |
|---|---|
| Status: | reopened → closed |
Fixed at 59e23dc357c508d15e5d354548a470494bd69ac0.
follow-up: 11 comment:10 by , 14 months ago
Hmm... Per my .zsh_history I tried CFLAGS_WARN_ALL="" first which didn't work, then tried CFLAGS_WARN_WALL="" which caused a lot of spurious warnings, and finally tried CFLAGS_WARN_WALL=-Wall which worked. Not sure why I made it wrong editing the book :(.
comment:11 by , 14 months ago
Replying to Xi Ruoyao:
Hmm... Per my .zsh_history I tried CFLAGS_WARN_ALL="" first which didn't work, then tried CFLAGS_WARN_WALL="" which caused a lot of spurious warnings, and finally tried CFLAGS_WARN_WALL=-Wall which worked. Not sure why I made it wrong editing the book :(.
Now I see what happened, the book says CFLAGS_WARN_ALL=-Wall instead of CFLAGS_WARN_WALL=-Wall. I do think a sed is better regardless since everything else remains, just -Werror is now out of the process, and it isn't per make file, it's more of a master make file from what I can tell that gets called at some point by cmpl_gcc.mak.

Gentoo does:
sed 's/-Werror //g' -i CPP/7zip/7zip_gcc.mak. This should work for us. We should still properly handle errors in the for loop so that errors are caught and dealt with.