After upgrading to Fedora 41 I get a compile error with rpmbuild --rebuild

After upgrading from Fedora 38 to Fedora 41 I am getting a compile error with recompiling a source rpm package.

rpmbuild --rebuild package.fc41.src.rpm

error: passing argument 1 of ‘gzwrite’ from incompatible pointer type [-Wincompatible-pointer-types]

If I recompile this same source rpm package in a mock environment it compiles without error:

mock -r /etc/mock/fedora-41-x86_64.cfg --no-clean package.fc41.src.rpm

What is different about the mock environment? I checked both rpm --eval “%{optflags}” and rpm -E “%{build_ldflags}” in the mock shell and on the Fedora 41 machine and they matched. Why would the mock environment not give the
[-Wincompatible-pointer-types] error?

Weclome to Fedora @skyknight .

Did you upgrade in one step from 38 to 41? If yes normally max two steps you can make on an Upgrade.
In your case it would have been 38-40 and then in a further step 40-41.

If you answer with no about the upgrade steps, then it still can be because of some differences between the upgraded and the mock environment. Some old/missing dependencies or so… The mock brings everything in one package/group and seams to be up to date.

That is the only explanation I have. Let’s see what explanations the packager collegues have :wink:

Likely mock is using different versions of the compiler.
You can look at the mock logs is /var/mock for clues.

Is your system full updated?

I upgraded from 38 to 39, 39 to 40, 40 to 41. I also suspected something was not properly installed on the running Fedora 41 system so I reinstalled all packages:

First I removed all 32bit packages
sudo dnf remove $(rpm -qa |grep i686)
Then reinstalled all installed packages
sudo dnf reinstall $(rpm -qa)

The reinstall completed successfully so the system should be good. I have also tried the rpmbuild recompile on another Fedora 41 system with the same results.

On the Fedora 41 system
gcc --version
gcc (GCC) 14.2.1 20240912 (Red Hat 14.2.1-3)

In the mock Fedora 41 chroot
sh-5.2# gcc --version
gcc (GCC) 14.2.1 20240912 (Red Hat 14.2.1-3)

So gcc is the same version on both and yes the system is fully updated to Fedora 41.

gcc build flags on the Fedora 41 system:

rpm --eval “%{optflags}”
“-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wno-complain-wrong-lang -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer”

rpm --eval “%{build_ldflags}”
“-Wl,-z,relro -Wl,--as-needed  -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1  ”

gcc build flags in the Fedora 41 mock environment:

<mock-chroot> sh-5.2# rpm --eval “%{optflags}”
“-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wno-complain-wrong-lang -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer”

<mock-chroot> sh-5.2# rpm --eval “%{build_ldflags}”
“-Wl,-z,relro -Wl,--as-needed  -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1  ”

The gcc flags are the same in both environments. On the Fedora 41 system I have gcc installed with:

  dnf group install "Development Tools"
  dnf group install 'C Development Tools and Libraries'

Maybe the mock environment does not have all that installed. The rpm spec inside the source rpm has these requires, but it is the same source rpm I am using in both environments so that should not make a difference.

BuildRequires: gcc
BuildRequires: ncurses-devel
BuildRequires: libpq-devel
BuildRequires: bison flex procps-ng
BuildRequires: rpcgen libtirpc-devel

Here is the actual rpm that I am trying to rebuild:

dnf download --source aubit4gl
rpmbuild --rebuild aubit4gl-1.6.1.p4-2.fc41.src.rpm

You might have a config file that is changing the compile in yourt $HOME somewhere.

Try creating a new user and doing the build. Does that get the same error?
Also you might research how that error is enabled.

Same results using a different user. I also tried it on another Fedora 41 system and got the same results.

Find out how to control that error with GCC options and see if you can find them being use.

I can get it to compile using -Wno-implicit-function-declaration, but that should not be necessary because in the mock environment I do not need to do this.

rpmbuild --rebuild aubit4gl-1.6.1.p4-2.fc41.src.rpm --define "optflags $(rpm --eval %optflags) -Wno-implicit-function-declaration"

There are 2 issues.

  1. The code has a bug that the rpmbuild reported.
  2. The mock build does not match the rpmbuild.

You could tell upstream about (1) and ask about (2) on the Fedora developers mailing list.

I am not sure the code does have a bug since it compiles clean in the mock environment.

I assume that an implicitly defined function is a bug.

[quote=“Sky Knight, post:5, topic:136862, username:skyknight”]
Here is the actual rpm that I am trying to rebuild:

/usr/bin/gmake -C tools/configuration
gmake[1]: Entering directory '/root/rpmbuild/BUILD/aubit4gl-1.6.1.p4-build/aubit4glsrc/tools/configuration'
/usr/bin/bash mk_config > config.4gl
/usr/bin/bash /root/rpmbuild/BUILD/aubit4gl-1.6.1.p4-build/aubit4glsrc/bin/aubit 4glpc -fPIC -DPIC  --verbose config.4gl -c -o config.ao
ERROR: Cannot locate aubit-config STOP.
gmake[1]: *** [../../incl/a4gl.mk:327: config.ao] Error 1
gmake[1]: Leaving directory '/root/rpmbuild/BUILD/aubit4gl-1.6.1.p4-build/aubit4glsrc/tools/configuration'
make: *** [Makefile:298: corecompile] Error 2
error: Bad exit status from /var/tmp/rpm-tmp.O3MBNt (%build)

Does this compile for you?

mock -r /etc/mock/fedora-41-x86_64.cfg --no-clean aubit4gl-1.6.1.p4-2.fc41.src.rpm

Looking at the actual gcc flags that are used during compile on the Fedora 41 server these options are used and are not used in the mock environment:

-Wno-complain-wrong-lang
-shared

In the mock environment gcc is using -c which the Fedora 41 compile is not.

Where are these flags being picked up from since I did check
rpm --eval “%{optflags}” and rpm --eval “%{build_ldflags}” which matched on both environments.

It does. There could be many reasons for that—package list differences, root vs regular user, length of the pathname of the build directory.

It looks like this is an issue with Fedora 41 since I also get the same errors when compiling an IBM Informix 4GL program.

c4gl -fcommon  -c lib.4gl
lib.ec: In function ‘pg_nextval’:
lib.ec:5762:1: error: implicit declaration of function ‘strcpy’ [-Wimplicit-function-declaration]
 5762 | strcpy(Var," select nextval ( pg_get_serial_sequence ( ?  , ?  ) ) ");
      | ^~~~~~
lib.ec:15:1: note: include ‘<string.h>’ or provide a declaration of ‘strcpy’
   14 | #include <fglrep.h>
  +++ |+#include <string.h>
   15 | #define I4GL_SQLCA /* I4GLC1 */

The Informix esqlc compiler is generating the lib.ec file and is not using the include “string.h”.

This is all looking like an issue with the upstream code.
Try reporting to them.

Also you have a work around that works for rpmbuild.
What is it that you want to achieve?

I need to recompile aubit4gl with IBM Informix esqlc support, which is closed source. When Fedora 41 eventually becomes a Red Hat release this will work since IBM will want Informix to run on their Red Hat OS.

It compiles clean on Fedora 39, but not on Fedora 40 or Fedora 41. So I need to get gcc to behave the same as on Fedora 39.