Closed tim77 closed 3 years ago
Wow, thanks for trying it out right away, that's fast! π
There was in fact an internal change to the Makefile which creates all generated files in out/
. boxes.h is a generated file (from boxes.in.h). The Makefile changes to the out/
directory and uses the VPATH functionality to find sources in src/
and src/misc/
.
I notice that for some reason in the log fragment you posted, the build exits the out
dir before trying to compile boxes.c. That's unexpected - compilation of all files requires that the working directory is out/
. Are you using our Makefiles?
Also, boxes.h is created by the top-level Makefile, whereas compilation happens within the Makefile in src/
.
Are you using our Makefiles?
Yes. Using default, canonical macros in Fedora for it:
%make_build
which equivalent of
/usr/bin/make -O -j8 V=1 VERBOSE=1
And all this look like this:
%set_build_flags
%make_build \
CFLAGS='%{optflags}' \
debug \
GLOBALCONF=%{cfgfile} \
LDFLAGS='%{build_ldflags}' \
%{nil}
%set_build_flags
=
CFLAGS="${CFLAGS:--O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection}" ; export CFLAGS ;
CXXFLAGS="${CXXFLAGS:--O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection}" ; export CXXFLAGS ;
FFLAGS="${FFLAGS:--O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/usr/lib64/gfortran/modules}" ; export FFLAGS ;
FCFLAGS="${FCFLAGS:--O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/usr/lib64/gfortran/modules}" ; export FCFLAGS ;
LDFLAGS="${LDFLAGS:--Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld }" ; export LDFLAGS ;
LT_SYS_LIBRARY_PATH="${LT_SYS_LIBRARY_PATH:-/usr/lib64:}" ; export LT_SYS_LIBRARY_PATH ;
CC="${CC:-gcc}" ; export CC ;
CXX="${CXX:-g++}" ; export CXX
Ok, I'll try and look at this in greater detail tomorrow. We'll get it working, I'm sure.
Boxes builds fine on my Fedora, without even a single warning, and all tests are green. I used the fedora:latest
Docker container.
I kind of expected that, with what our past experience. π The problem must somehow be caused by the source RPM.
Can you share the spec file and full build log? The one that I have is still on 2.0.0. Thanks!
I could reproduce the problem, but you'll have to help me solve it. π
I noticed a few things:
gcc
calls had no -I
directives, which caused gcc to not find our include files (only system includes). Frankly, I don't know why it worked before. I added -I. -I../src
to the CFLAGS
in line 61 of the spec file. This fixed the "header not found" error.make
, it is executed and the build succeeds.Unrelated, I noticed a few minor things in the spec which might be interesting to you after we resolve the main problem:
GPL-2.0-only
instead of GPLv2+
.vim-common
for the build because it provides the xxd
tool we use in some of the new tests.%make_build build ...
instead of %make_build debug ...
(or just leave out the first argument entirely).Maybe relevant (or not). On ArchLinux, we got fatal error: parser.h: No such file or directory
when making in parallel (like make -j10
). make -j1
runs with no issue.
Full log here.
In file included from ../src/boxes.c:33:
../src/parsing.h:28:10: fatal error: parser.h: No such file or directory
28 | #include "parser.h"
| ^~~~~~~~~~
compilation terminated.
In file included from ../src/list.c:31:
../src/parsing.h:28:10: fatal error: parser.h: No such file or directory
28 | #include "parser.h"
| ^~~~
I assume this could caused because include paths no specified. This code not works look like https://github.com/ascii-boxes/boxes/blob/ba5ce91c849a707f851a401dbee6177aba0e79f2/src/Makefile#L69
I am not sure this related with new features in GCC or not, but maybe this also could help you:
The license should be GPL-2.0-only instead of GPLv2+.
Thanks, i'll fix this for sure in next update.
Boxes v2.1.0 requires vim-common for the build because it provides the xxd tool we use in some of the new tests.
Added.
Boxes is currently built with debug info included. For production, it should therefore probably be %make_build build ... instead of %make_build debug ... (or just leave out the first argument entirely).
RPM catch this debuginfo during build and put in separate debuginfo packages which not shipped with main package. Optimizations flags override as well by default Fedora build macroses.
Thanks @cuihaoleo! You really helped me out of a tight spot there.
I made a slight change to the Makefile to adjust for this effect, and now the source RPM builds fine on my Fedora. The final changes to the RPM spec also include the adjustment of the path were the executable is being created:
12c12
< License: GPLv2+
---
> License: GPL-2.0-only
21a22
> BuildRequires: vim-common
61c62
< CFLAGS='-I. -I../src %{optflags}' \
---
> CFLAGS='%{optflags}' \
72c73
< install -Dp -m 0755 src/%{name} %{buildroot}%{_bindir}/%{name}
---
> install -Dp -m 0755 out/%{name} %{buildroot}%{_bindir}/%{name}
https://github.com/ascii-boxes/boxes/commit/d1a1cf158016f24ee9d4785e3e07b82329964d0f and making -j1
doesn't help. See koji build https://koji.fedoraproject.org/koji/taskinfo?taskID=66356685.
Yes, you need to fix the spec file, too. (diff above)
But then it should work. At least it did on my machine, using your rpm commands. π
You can check the spec in SRPM. It's already with this fixes.
Dang, but the log file you linked does not show them. π Are you sure?
I don't know how to "check the SRPM". But I looked at this log, which does not have the flags: https://kojipkgs.fedoraproject.org//work/tasks/6685/66356685/build.log
CRUX maintainer here, -j1 fixes it over here as well.
@TimB87 That's great to hear! I hope you don't even need -j1
with the Makefile change from d1a1cf1. But either way, you're fine.
Just tried it and yes, that fixed it
@tsjensen Yes, i am sure.
does not have the flags
Which exactly? Package MUST compile with default Fedora build flags https://docs.fedoraproject.org/en-US/packaging-guidelines/#_compiler_flags
I tried even build and force with %global _smp_mflags %nil
.
99% of this make file mess could be solved by port Boxes to Cmake/Meson.
@tim77 Well, the -I
flags are required, because otherwise gcc can't find the includes.
I'm not an expert on this, but the page you linked says:
Adding to [...] these flags is permitted if thereβs a good reason to do so;
which seems to me that since we haven't yet migrated to another build system (and will probably not be able to do that for a long time because there are simply too many platforms to support), you have a good reason. π
@tsjensen i built it finally with proper, canonical build flags. Even with -j8
compiles fine. For all arches.
Closing as resolved. If you wish and when you will ready we can send you fully functional PR with Meson port. π Thanks!
Fantastic! Great work @tim77! β
Hello. 2.1.0 won't compile on Fedora.
Full build log f34.
Environment (please complete the following information):
v2.1.0
Fedora 33+