tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: cwrapper g++ -v erroring out (Re: Help with attempt to update devel/gdb (currently in wip/gdb))



Ping again.

Right now I can build the updated gdb 16.2 which brings its own
libtools, after applying the wrapper patches to un-break innocent calls
to gcc -v / g++ -v.

Regardless of the future path of gdb and forcing it to use pkgsrc's
libtool everywhere in the sub-builds, can we agree that it would be OK
to apply the wrapper changes?

Would I hurt anyone with this? I really don't see why the wrappers
should break any scripts asking for the compiler version and build
info, like

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/15.1.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /usr/src/gcc-15.1.0/configure --disable-multilib --enable-lto --enable-cet=auto --enable-default-ssp --enable-default-pie --enable-checking=release --disable-werror --with-linker-hash-style=gnu --enable-install-libiberty --enable-plugin --disable-isl-version-check --enable-cloog-backend=isl --enable-linker-build-id --enable-gnu-unique-object --enable-bootstrap --disable-libstdcxx-pch --enable-clocale=gnu --disable-libunwind-exceptions --enable-__cxa_atexit --enable-threads=posix --enable-shared --enable-languages=fortran,lto --with-bugurl=http://bugs.sourcemage.org --infodir=/usr/share/info --mandir=/usr/share/man --libexecdir=/usr/lib --libdir=/usr/lib --prefix=/usr --build=x86_64-pc-linux-gnu --with-gmp=/ --with-mpc=/usr --with-mpfr=/ --with-system-zlib --disable-nls --enable-libquadmath
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 15.1.0 (GCC) 

Pkgsrc wrappers turn that into a linker error.


Index: mk/wrapper/wrapper.sh
===================================================================
RCS file: /cvsroot/pkgsrc/mk/wrapper/wrapper.sh,v
retrieving revision 1.24
diff -u -r1.24 wrapper.sh
--- mk/wrapper/wrapper.sh       22 Aug 2018 20:48:37 -0000      1.24
+++ mk/wrapper/wrapper.sh       28 Apr 2025 06:28:41 -0000
@@ -94,6 +94,12 @@
 init_queue cmdbuf
 
 append_extra_args=yes
+# ThOr: avoid extra fuss if code just calls gcc -v to get version information, without
+# any actual compile/link. Adding -Wl,foobar flags produces a linker error as there are
+# no inputs to link.
+if test "$#" = 1 && test "$1" = -v; then
+  append_extra_args=no
+fi
 . $scan
 
 case $append_extra_args in

Index: pkgtools/cwrappers/Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/pkgtools/cwrappers/Makefile,v
retrieving revision 1.28
diff -u -r1.28 Makefile
--- pkgtools/cwrappers/Makefile 9 Nov 2022 13:14:15 -0000       1.28
+++ pkgtools/cwrappers/Makefile 28 Apr 2025 07:00:06 -0000
@@ -1,6 +1,7 @@
 # $NetBSD: Makefile,v 1.28 2022/11/09 13:14:15 joerg Exp $
 
 PKGNAME=               cwrappers-20220403
+PKGREVISION=           1
 CATEGORIES=            pkgtools sysutils
 
 MAINTAINER=            pkgsrc-users%NetBSD.org@localhost
Index: pkgtools/cwrappers/files/bin/base-wrapper.c
===================================================================
RCS file: /cvsroot/pkgsrc/pkgtools/cwrappers/files/bin/base-wrapper.c,v
retrieving revision 1.8
diff -u -r1.8 base-wrapper.c
--- pkgtools/cwrappers/files/bin/base-wrapper.c 4 Apr 2022 11:54:35 -0000       1.8
+++ pkgtools/cwrappers/files/bin/base-wrapper.c 28 Apr 2025 07:00:06 -0000
@@ -122,6 +122,8 @@
        struct arglist args;
        struct argument *arg;
        char **argv2;
+       /* ThOr: Hack to avoid breaking gcc -v with linker arguments. */
+       int modify_args = !(argc == 2 && !strcmp(argv[1], "-v"));
 
        init_generic_transform();
 
@@ -149,7 +151,8 @@
 #else
        operation_mode_cc(&args);
 #endif
-       arglist_apply_config(&args);
+       if(modify_args)
+               arglist_apply_config(&args);
 #if !defined(WRAPPER_LIBTOOL) && !defined(WRAPPER_SHLIBTOOL)
        /*
         * The --sysroot argument will be applied only to the compiler



Am Fri, 2 May 2025 15:53:06 +0200
schrieb "Dr. Thomas Orgis" <thomas.orgis%uni-hamburg.de@localhost>:

> Ping.
> 
> What would be a way forward to fix up devel/gdb properly?
> 
> Right now, I have hacks that make the generation of various libtools in
> the build tree work. But pkgsrc would like it all to use its libtool
> instead.
> 
> How to proceed to something that aligns nicely with pkgsrc? Hack
> libtool generation templates in gdb sources? Just give in and un-break
> them by making cwrappers not error out on `gcc -v` (my hack)?
> 
> Right now, current gdb and pkgsrc are incompatible. That's not
> sustainable. A debugger is kindof useful in a Unix system …
> 
> 
> Alrighty then,
> 
> Thomas
> 



-- 
Dr. Thomas Orgis
HPC @ Universität Hamburg


Home | Main Index | Thread Index | Old Index