Bug 15997

Summary: Build Squid with GCC12.3 in Buildroot 2024.02 will fail
Product: buildroot Reporter: Roland Franke <fli4l>
Component: OtherAssignee: unassigned
Status: RESOLVED FIXED    
Severity: normal CC: buildroot
Priority: P5    
Version: 2024.02   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Host: Target:
Build:

Description Roland Franke 2024-03-15 21:11:25 UTC
Hello,
i try to build Squid V6.6 with buildroot 2024.02 and GCC12.3.
But this will fail with the following faults:
/usr/bin/g++ -O2 -I/home/roland/.fbr/fbr-4.0-test_1_2024-x86_64/buildroot/output/per-package/squid/host/include -o cf_gen ./cf_gen.cc -I. -I../include/ -I../src
./cf_gen.cc: In function 'int main(int, char**)':
./cf_gen.cc:268:63: error: forming reference to void
  268 |                     auto &newEntry = entries.emplace_back(name);
      |                                                               ^
./cf_gen.cc:277:68: error: forming reference to void
  277 |                     auto &newEntry = entries.emplace_back("comment");
      |                                                                    ^
make[2]: *** [Makefile:7264: cf_gen] Error 1

I have also try to add the old patch 
0004-libgcc-Exclude-UCLIBC-from-GLIBC-thread-check.patch
to GCC (As this patch is looks missing), but the build by me will still fail.

Are there any posibilty at your side for checking if the fail by you is also
or if this is depended on my system here.
Best regards,
Roland Franke
(Germany)
Comment 1 Roland Franke 2024-03-16 12:06:28 UTC
All looks for me actually as that i had a problem in the general system.
Means, that maybe from older buildroot-systems something is "stuck" and 
will not be overwritten from the new versions (With gcc, c++, .....)
If i activate in squid.mk the SQUID_AUTORECONF = y the build will stuck
with "missing aclocal-1.15", but the system has aclocal-1.16 installed.
Maybe that information will help for finding the problem.
Comment 2 Peter Seiderer 2024-03-16 13:49:01 UTC
Note: this one is the only g++ call of the squid build using the host compiler '/usr/bin/g++' to build an internal tool

Which host system? Which host compiler ('/usr/bin/g++ --version')?

Compiles for me without failure using g++ 12.3.0, 13.2.1 and 14.0.1, but
e.g. the following fails with the same error you mention:

$ /usr/bin/g++ -std=c++11 -O2 -I/home/seiderer/Work/Buildroot/build_bug_15997_squid_001/host/include -o cf_gen ./cf_gen.cc -I. -I../include/ -I../src
./cf_gen.cc: In function ‘int main(int, char**)’:
./cf_gen.cc:268:63: error: forming reference to void
  268 |                     auto &newEntry = entries.emplace_back(name);
      |                                                               ^
./cf_gen.cc:277:68: error: forming reference to void
  277 |                     auto &newEntry = entries.emplace_back("comment");
      |                                                     


Same with '-std=c++14', but '-std=c++17' works fine...
Comment 3 Peter Seiderer 2024-03-16 13:55:34 UTC
Or try the following quick fix:

--- a/package/squid/squid.mk
+++ b/package/squid/squid.mk
@@ -21,7 +21,7 @@ SQUID_CONF_ENV = \
        ac_cv_func_strnstr=no \
        ac_cv_have_squid=yes \
        BUILDCXX="$(HOSTCXX)" \
-       BUILDCXXFLAGS="$(HOST_CXXFLAGS)"
+       BUILDCXXFLAGS="$(HOST_CXXFLAGS) -std=c++17"
 SQUID_CONF_OPTS = \
        --enable-async-io=8 \
        --enable-linux-netfilter \
Comment 4 Roland Franke 2024-03-16 16:16:45 UTC
I will work with host debian 11 (bullseye).
gcc and g++ in version 10.2.1-6 (Standard-version)
Please accept, that with buildroot-2023.08.3 this fault was not come
on the same computer (Hyper-V VM on a windows-host).

Build tested with the:
BUILDCXXFLAGS="$(HOST_CXXFLAGS) -std=c++17"
will work for me also.

Thank you for your support.
Comment 5 Arnout Vandecappelle 2024-03-17 21:36:49 UTC
Fixed in commit 9347905b95dfe045ee40ae69d9d3f00a2c1b7168.