![]() |
|
NetBSD Package System (pkgsrc) Installation and upgrading of packages on NetBSD. |
![]() |
|
Thread Tools | Display Modes |
|
|||
![]()
I'm using the cpuflags package:
Code:
$ make show-var VARNAME=COPTS -pipe $ make show-var VARNAME=CPUFLAGS $ make show-var VARNAME=CPU_FLAGS -mfpmath=sse -msse3 -march=native |
|
||||
![]()
About CFLAGS, vs COPTS, CPUFLAGS, CPU_FLAGS:
My original /etc/mk.conf file from many years ago used CFLAGS only. This document still recommends it https://www.netbsd.org/docs/pkgsrc/configuring.html I then found COPTS and CPUFLAGS in man mk.conf. It's not clear to me if that is only used for building the kernel and userland or also for pkgsrc. Sensucht94 also uses CPUFLAGS in his fancy /etc/mk.conf file http://daemonforums.org/showthread.php?t=11326 My ultimate goal is to rebuild pkgsrc with debug symbols so I can analyze core files. What I have now in /etc/mk.conf Code:
CPUFLAGS+= -march=native COPTS+= -g -O2 -pipe CFLAGS+= -g Code:
/usr/pkgsrc/graphics/xli# make show-var VARNAME=COPTS -g -O2 -pipe /usr/pkgsrc/graphics/xli# make show-var VARNAME=CFLAGS -O2 -g -D_FORTIFY_SOURCE=2 /usr/pkgsrc/graphics/xli# make show-var VARNAME=CPUFLAGS -march=native /usr/pkgsrc/graphics/xli# make clean; make /usr/pkgsrc/graphics/xli# gdb /var/tmp/pkgsrc/graphics/xli/work/xli-2005-02-27/xli ... Reading symbols from /var/tmp/pkgsrc/graphics/xli/work/xli-2005-02-27/xli... (No debugging symbols found in /var/tmp/pkgsrc/graphics/xli/work/xli-2005-02-27/xli) |
|
||||
![]() Quote:
I just tried a package based on ./configure and there my flags are passed through and debugging symbols are found. Code:
Reading symbols from /var/tmp/pkgsrc/devel/yasm/work/yasm-1.3.0/yasm... |
|
||||
![]()
I experimented with CFLAGS, COPTS, CPUFLAGS, CPU_FLAGS adding -g.
I only find debugging symbols in the binary when -g is passed via CFLAGS. Sensucht94 and thirdm, I recommend you double-checking your optimization flags. You may find I'm right and only CFLAGS (and CXXFLAGS for g++) are passed the compiler. |
|
||||
![]()
What seems to work for all tested packages is creating this wrapper
Code:
$ cat /opt/bin/gcc /usr/bin/gcc -g $* Same for g++. Not elegant, but hey. I hesitate putting my fancy CFLAGS into this wrapper so that also xli and other non-configure based packages benefit from custom CFLAGS, because some package Makefiles do magic transformations of CLFAGS. |
|
|||
![]()
For myself I don't want to add any custom wrappers around gcc. pkgsrc does more than enough wrapping itself for my taste.
I'm new to pkgsrc and NetBSD, but my guess is that this is one of those things that we cannot expect pkgsrc itself to solve. Maybe xli (and others you've tried?) is one of those packages made to ignore custom flags and needs to be patched. See section 10.15 of the pkgsrc guide. |
|
||||
![]()
Sorry, for replying after so much time, but I noticed you tagged me in this thread while skipping through past discussions. I don't know if this is still relevant, anyway:
Quote:
Quote:
Projects sometimes set their own CFLAGS and it's not good practice to patch their Makefiles to hard-code specific flags, since pkgsrc is cross-platform and what may work on NetBSD may not work elsewhere. The proper way to do this is to pass pkgsrc's CFLAGS (set dynamically and platform-dependent) to the 'internal' make (the package's own build system) before building. Looking at graphics/xli Makefile, you can see that CFLAGS are not explicitly passed to the internal make (via MAKE_FLAGS+), while the package itself resets CFLAGS within its own Makefile.std. Since xli uses imake, here's a diff to apply standard CFLAGS (and add debug symbols): Code:
--- Makefile.orig 2022-11-22 12:29:32.838470167 +0000 +++ Makefile @@ -12,6 +12,11 @@ COMMENT= X11 Image Loading Utility USE_IMAKE= YES +CFLAGS+= -g + +MAKE_FLAGS+= CCOPTIONS=${CFLAGS:Q} +MAKE_FLAGS+= LOCAL_LDFLAGS=${LDFLAGS:Q} + INSTALLATION_DIRS+= lib/X11/app-defaults Code:
MAKE_FLAGS+= CFLAGS=${CFLAGS:Q} MAKE_FLAGS+= LDFLAGS=${LDFLAGS:Q}
__________________
“Mi casa tendrá dos piernas y mis sueños no tendrán fronteras„ |
![]() |
Tags |
cflags, pkgsrc |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
New to OpenBSD, could use some help on some issues and possible optimization options | therue | OpenBSD General | 27 | 17th November 2019 02:11 PM |
flags in vi's man page | attilio | OpenBSD Packages and Ports | 4 | 13th December 2016 12:34 PM |
openbsd server optimization | barti | OpenBSD General | 18 | 30th July 2012 02:52 PM |
Which is the significance about pkgsrc-2009Q2 and pkgsrc-2009Q3? | aleunix | NetBSD Package System (pkgsrc) | 3 | 16th December 2009 07:19 AM |
FreeBSD Kernel Optimization | komodo | FreeBSD General | 5 | 22nd June 2009 07:15 AM |