Regarding the optflags patch, is it possible to drop altogether the hardcoded "-O3" in C/CXXFLAGS in the various configure.in? This would remove the need for 4 autoreconf when using another optimization level
-- Bernard Cafarelli (Voyageur) Gentoo developer (NX, GNUstep, net-misc, llvm/clang, ...)
On Tuesday 2013-01-08 13:23, Bernard Cafarelli wrote:
Regarding the optflags patch, is it possible to drop altogether the hardcoded "-O3" in C/CXXFLAGS in the various configure.in? This would remove the need for 4 autoreconf when using another optimization level
Why would autoreconf be rerun if you use ./configure CFLAGS=-O2 CXXFLAGS=-O2?
Le Tue, 8 Jan 2013 17:07:12 +0100 (CET) Jan Engelhardt <jengelh@inai.de> a écrit:
Why would autoreconf be rerun if you use ./configure CFLAGS=-O2 CXXFLAGS=-O2?
I meant, without first removing the "-O3" from configure.in (before autoreconf)
With current configure.in, setting CXXFLAGS to "-O2" will give this: nxcomp $ autoreconf && ./configure && make [...] g++ -c -O2 -O3 -fno-rtti -fno-exceptions -I../nx-X11/exports/include -Wmissing-declarations -fPIC -DIN_ADDR_T=in_addr_t -DVERSION=\"3.5.0\" -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -Wall -Wpointer-arith EncodeBuffer.cpp
Editing CXXFLAGS to "$CXXFLAGS -fno-rtti -fno-exceptions" will use user-defined optimization level 2
If hardcoded "-O3" is required, some test could be added to set "-O3" if CXXFLAGS is unset, then appending the rtti/exceptions flags
On Wednesday 2013-01-09 01:00, Bernard Cafarelli wrote:
Le Tue, 8 Jan 2013 17:07:12 +0100 (CET) Jan Engelhardt <jengelh@inai.de> a écrit:
Why would autoreconf be rerun if you use ./configure CFLAGS=-O2 CXXFLAGS=-O2?
I meant, without first removing the "-O3" from configure.in (before autoreconf)
With current configure.in, setting CXXFLAGS to "-O2" will give this: nxcomp $ autoreconf && ./configure && make [...] g++ -c -O2 -O3 -fno-rtti -fno-exceptions -I../nx-X11/exports/include -Wmissing-declarations -fPIC -DIN_ADDR_T=in_addr_t -DVERSION=\"3.5.0\" -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -Wall -Wpointer-arith EncodeBuffer.cpp
I tried the following, but it's not taking any effect. Must be some !@#$%^& going on. <<<< Give user-specified CXXFLAGS/CFLAGS/LDFLAGS/LIBS higher precedence. --- nxcomp/Makefile.in | 6 ++---- nxcompext/Makefile.in | 14 +++++++------- nxcompshad/Makefile.in | 5 ++--- nxproxy/Makefile.in | 4 ++-- 4 files changed, 13 insertions(+), 16 deletions(-) Index: nx-libs-3.5.0.17/nxcomp/Makefile.in =================================================================== --- nx-libs-3.5.0.17.orig/nxcomp/Makefile.in +++ nx-libs-3.5.0.17/nxcomp/Makefile.in @@ -36,8 +36,7 @@ LIBVERSION=@LIBVERSION@ # CXX = @CXX@ -CXXFLAGS = @CXXFLAGS@ @X_CFLAGS@ @DEFS@ \ - -Wall -Wpointer-arith +CXXFLAGS = @X_CFLAGS@ @DEFS@ -Wall -Wpointer-arith @CXXFLAGS@ CXXINCLUDES = CXXDEFINES = @@ -46,8 +45,7 @@ CXXDEFINES = # CC = @CC@ -CCFLAGS = @CFLAGS@ @X_CFLAGS@ @DEFS@ \ - -Wall -Wpointer-arith +CCFLAGS = @X_CFLAGS@ @DEFS@ -Wall -Wpointer-arith @CFLAGS@ CCINCLUDES = CCDEFINES = Index: nx-libs-3.5.0.17/nxcompext/Makefile.in =================================================================== --- nx-libs-3.5.0.17.orig/nxcompext/Makefile.in +++ nx-libs-3.5.0.17/nxcompext/Makefile.in @@ -28,26 +28,26 @@ LIBVERSION=@LIBVERSION@ # CXX = @CXX@ -CXXFLAGS = @CXXFLAGS@ @X_CFLAGS@ @DEFS@ \ +CXXFLAGS = @X_CFLAGS@ @DEFS@ \ -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \ - -Wmissing-declarations -Wnested-externs + -Wmissing-declarations -Wnested-externs @CXXFLAGS@ CXXINCLUDES = -I. -I../nxcomp CXXDEFINES = CC = @CC@ -CCFLAGS = @CFLAGS@ @X_CFLAGS@ @DEFS@ \ +CCFLAGS = @X_CFLAGS@ @DEFS@ \ -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \ - -Wmissing-declarations -Wnested-externs + -Wmissing-declarations -Wnested-externs @CFLAGS@ CCINCLUDES = -I. -I../nxcomp CCDEFINES = -LDFLAGS = @LDFLAGS@ -L../nxcomp -LIBS = @LIBS@ -lz -lNX_X11 -lXcomp +LDFLAGS = -L../nxcomp @LDFLAGS@ +LIBS = -lz -lNX_X11 -lXcomp @LIBS@ # # Only if THREADS is defined # -# LIBS = @LIBS@ -lz -ljpeg -lpthread -lNX_X11 -lXcomp +# LIBS = -lz -ljpeg -lpthread -lNX_X11 -lXcomp @LIBS@ # srcdir = @srcdir@ Index: nx-libs-3.5.0.17/nxcompshad/Makefile.in =================================================================== --- nx-libs-3.5.0.17.orig/nxcompshad/Makefile.in +++ nx-libs-3.5.0.17/nxcompshad/Makefile.in @@ -31,8 +31,7 @@ LIBVERSION=@LIBVERSION@ # CXX = @CXX@ -CXXFLAGS = @CXXFLAGS@ @X_CFLAGS@ @DEFS@ \ - -Wall -Wpointer-arith +CXXFLAGS = @X_CFLAGS@ @DEFS@ -Wall -Wpointer-arith @CXXFLAGS@ CXXINCLUDES = CXXDEFINES = @@ -48,7 +47,7 @@ CCINCLUDES = CCDEFINES = LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ -lNX_X11 +LIBS = -lNX_X11 @LIBS@ # # Only if THREADS is defined. Index: nx-libs-3.5.0.17/nxproxy/Makefile.in =================================================================== --- nx-libs-3.5.0.17.orig/nxproxy/Makefile.in +++ nx-libs-3.5.0.17/nxproxy/Makefile.in @@ -11,9 +11,9 @@ LIBVERSION=@LIBVERSION@ # -Wredundant-decls # CXX = @CXX@ -CXXFLAGS = @CXXFLAGS@ @X_CFLAGS@ @DEFS@ \ +CXXFLAGS = @X_CFLAGS@ @DEFS@ \ -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \ - -Wmissing-declarations -Wnested-externs + -Wmissing-declarations -Wnested-externs @CXXFLAGS@ CXXINCLUDES = -I. -I../nxcomp
On Wed, Jan 9, 2013 at 3:16 PM, Jan Engelhardt <jengelh@inai.de> wrote:
On Wednesday 2013-01-09 01:00, Bernard Cafarelli wrote:
Le Tue, 8 Jan 2013 17:07:12 +0100 (CET) Jan Engelhardt <jengelh@inai.de> a écrit:
Why would autoreconf be rerun if you use ./configure CFLAGS=-O2 CXXFLAGS=-O2?
I meant, without first removing the "-O3" from configure.in (before autoreconf)
With current configure.in, setting CXXFLAGS to "-O2" will give this: nxcomp $ autoreconf && ./configure && make [...] g++ -c -O2 -O3 -fno-rtti -fno-exceptions -I../nx-X11/exports/include -Wmissing-declarations -fPIC -DIN_ADDR_T=in_addr_t -DVERSION=\"3.5.0\" -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -Wall -Wpointer-arith EncodeBuffer.cpp
I tried the following, but it's not taking any effect. Must be some !@#$%^& going on.
<<<<
Give user-specified CXXFLAGS/CFLAGS/LDFLAGS/LIBS higher precedence.
nxcomp/Makefile.in | 6 ++---- nxcompext/Makefile.in | 14 +++++++------- nxcompshad/Makefile.in | 5 ++--- nxproxy/Makefile.in | 4 ++-- 4 files changed, 13 insertions(+), 16 deletions(-)
Index: nx-libs-3.5.0.17/nxcomp/Makefile.in
--- nx-libs-3.5.0.17.orig/nxcomp/Makefile.in +++ nx-libs-3.5.0.17/nxcomp/Makefile.in @@ -36,8 +36,7 @@ LIBVERSION=@LIBVERSION@ #
CXX = @CXX@ -CXXFLAGS = @CXXFLAGS@ @X_CFLAGS@ @DEFS@ \
+CXXFLAGS = @X_CFLAGS@ @DEFS@ -Wall -Wpointer-arith @CXXFLAGS@ CXXINCLUDES = CXXDEFINES =-Wall -Wpointer-arith
@@ -46,8 +45,7 @@ CXXDEFINES = #
CC = @CC@ -CCFLAGS = @CFLAGS@ @X_CFLAGS@ @DEFS@ \
+CCFLAGS = @X_CFLAGS@ @DEFS@ -Wall -Wpointer-arith @CFLAGS@ CCINCLUDES = CCDEFINES =-Wall -Wpointer-arith
Index: nx-libs-3.5.0.17/nxcompext/Makefile.in
--- nx-libs-3.5.0.17.orig/nxcompext/Makefile.in +++ nx-libs-3.5.0.17/nxcompext/Makefile.in @@ -28,26 +28,26 @@ LIBVERSION=@LIBVERSION@ #
CXX = @CXX@ -CXXFLAGS = @CXXFLAGS@ @X_CFLAGS@ @DEFS@ \ +CXXFLAGS = @X_CFLAGS@ @DEFS@ \ -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \
-Wmissing-declarations -Wnested-externs
CXXINCLUDES = -I. -I../nxcomp CXXDEFINES =-Wmissing-declarations -Wnested-externs @CXXFLAGS@
CC = @CC@ -CCFLAGS = @CFLAGS@ @X_CFLAGS@ @DEFS@ \ +CCFLAGS = @X_CFLAGS@ @DEFS@ \ -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \
-Wmissing-declarations -Wnested-externs
CCINCLUDES = -I. -I../nxcomp CCDEFINES =-Wmissing-declarations -Wnested-externs @CFLAGS@
-LDFLAGS = @LDFLAGS@ -L../nxcomp -LIBS = @LIBS@ -lz -lNX_X11 -lXcomp +LDFLAGS = -L../nxcomp @LDFLAGS@ +LIBS = -lz -lNX_X11 -lXcomp @LIBS@
# # Only if THREADS is defined # -# LIBS = @LIBS@ -lz -ljpeg -lpthread -lNX_X11 -lXcomp +# LIBS = -lz -ljpeg -lpthread -lNX_X11 -lXcomp @LIBS@ #
srcdir = @srcdir@ Index: nx-libs-3.5.0.17/nxcompshad/Makefile.in
--- nx-libs-3.5.0.17.orig/nxcompshad/Makefile.in +++ nx-libs-3.5.0.17/nxcompshad/Makefile.in @@ -31,8 +31,7 @@ LIBVERSION=@LIBVERSION@ #
CXX = @CXX@ -CXXFLAGS = @CXXFLAGS@ @X_CFLAGS@ @DEFS@ \
+CXXFLAGS = @X_CFLAGS@ @DEFS@ -Wall -Wpointer-arith @CXXFLAGS@ CXXINCLUDES = CXXDEFINES =-Wall -Wpointer-arith
@@ -48,7 +47,7 @@ CCINCLUDES = CCDEFINES =
LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ -lNX_X11 +LIBS = -lNX_X11 @LIBS@
# # Only if THREADS is defined. Index: nx-libs-3.5.0.17/nxproxy/Makefile.in
--- nx-libs-3.5.0.17.orig/nxproxy/Makefile.in +++ nx-libs-3.5.0.17/nxproxy/Makefile.in @@ -11,9 +11,9 @@ LIBVERSION=@LIBVERSION@ # -Wredundant-decls # CXX = @CXX@ -CXXFLAGS = @CXXFLAGS@ @X_CFLAGS@ @DEFS@ \ +CXXFLAGS = @X_CFLAGS@ @DEFS@ \ -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \
-Wmissing-declarations -Wnested-externs
-Wmissing-declarations -Wnested-externs @CXXFLAGS@
CXXINCLUDES = -I. -I../nxcomp
AFAIUI, this is not a fix. Instead of replacing the hardcoded values, this patch ensures that all options end behind the hardcoded values. This makes it impossible to drop compiler flags that are specified within. This may be fair when your goal is to only change the optimization level, but may be insufficient when the goal is a hardened build. -- regards, Reinhard
On Wednesday 2013-01-09 15:21, Reinhard Tartler wrote:
+++ nx-libs-3.5.0.17/nxcomp/Makefile.in @@ -36,8 +36,7 @@ LIBVERSION=@LIBVERSION@ #
CXX = @CXX@ -CXXFLAGS = @CXXFLAGS@ @X_CFLAGS@ @DEFS@ \
+CXXFLAGS = @X_CFLAGS@ @DEFS@ -Wall -Wpointer-arith @CXXFLAGS@ CXXINCLUDES = CXXDEFINES =-Wall -Wpointer-arith
AFAIUI, this is not a fix. Instead of replacing the hardcoded values, this patch ensures that all options end behind the hardcoded values. This makes it impossible to drop compiler flags that are specified within.
This may be fair when your goal is to only change the optimization level, but may be insufficient when the goal is a hardened build.
I don't care about the "hardened" because that is just another case of "user wants to specify his own CFLAGS". I had hoped that @CXXFLAGS@ would be those user-specific ones, but alas, no. *Total dismay at Makefile authors who still squat on CXXFLAGS*
Hi Jan, On Mi 09 Jan 2013 15:26:06 CET Jan Engelhardt wrote:
On Wednesday 2013-01-09 15:21, Reinhard Tartler wrote:
+++ nx-libs-3.5.0.17/nxcomp/Makefile.in @@ -36,8 +36,7 @@ LIBVERSION=@LIBVERSION@ #
CXX = @CXX@ -CXXFLAGS = @CXXFLAGS@ @X_CFLAGS@ @DEFS@ \
+CXXFLAGS = @X_CFLAGS@ @DEFS@ -Wall -Wpointer-arith @CXXFLAGS@ CXXINCLUDES = CXXDEFINES =-Wall -Wpointer-arith
AFAIUI, this is not a fix. Instead of replacing the hardcoded values, this patch ensures that all options end behind the hardcoded values. This makes it impossible to drop compiler flags that are specified within.
This may be fair when your goal is to only change the optimization level, but may be insufficient when the goal is a hardened build.
I don't care about the "hardened" because that is just another case of "user wants to specify his own CFLAGS". I had hoped that @CXXFLAGS@ would be those user-specific ones, but alas, no. *Total dismay at Makefile authors who still squat on CXXFLAGS*
All kind of flags are hard-coded in linux.cf in nx-X11/cf/ (I think). You may know imake better then I do. If you could take another look at it, that would be awesome. Note: LDFLAGS appear to be named LDOPTIONS in nx-X11. Note, that nxcomp, nxcompshad and nxcompext are configured and built from within nx-X11/programs/Xserver/Makefile.in (IIRC, might be the Makfile.in one level up). So the nx* builds are prepared by imake. I guess the only way to address it is to teach imake to let through *FLAGS. The nx-X11 build process is a bummer..., I agree with that. Any help and improvement is really appreciated. Greets + HELP!!! + Arggghhh..., Mike -- DAS-NETZWERKTEAM mike gabriel, rothenstein 5, 24214 neudorf-bornstein fon: +49 (1520) 1976 148 GnuPG Key ID 0x25771B31 mail: mike.gabriel@das-netzwerkteam.de, http://das-netzwerkteam.de freeBusy: https://mail.das-netzwerkteam.de/freebusy/m.gabriel%40das-netzwerkteam.de.xf...
On Wednesday 2013-01-09 16:10, Mike Gabriel wrote:
All kind of flags are hard-coded in linux.cf in nx-X11/cf/ (I think). You may know imake better then I do. If you could take another look at it, that would be awesome.
Note: LDFLAGS appear to be named LDOPTIONS in nx-X11.
Note, that nxcomp, nxcompshad and nxcompext are configured and built from within nx-X11/programs/Xserver/Makefile.in (IIRC, might be the Makfile.in one level up). So the nx* builds are prepared by imake. I guess the only way to address it is to teach imake to let through *FLAGS.
The nx-X11 build process is a bummer..., I agree with that. Any help and improvement is really appreciated.
Can we split nxcomp, nxcompshad, nxcompext and nxproxy into separate tarballs in any way? After all, they are "just" addons to an existing (X11|nx-libs) tree that gets installed as well and which looks usable.
On Wed, Jan 9, 2013 at 4:22 PM, Jan Engelhardt <jengelh@inai.de> wrote:
On Wednesday 2013-01-09 16:10, Mike Gabriel wrote:
All kind of flags are hard-coded in linux.cf in nx-X11/cf/ (I think). You may know imake better then I do. If you could take another look at it, that would be awesome.
Note: LDFLAGS appear to be named LDOPTIONS in nx-X11.
Note, that nxcomp, nxcompshad and nxcompext are configured and built from within nx-X11/programs/Xserver/Makefile.in (IIRC, might be the Makfile.in one level up). So the nx* builds are prepared by imake. I guess the only way to address it is to teach imake to let through *FLAGS.
The nx-X11 build process is a bummer..., I agree with that. Any help and improvement is really appreciated.
Can we split nxcomp, nxcompshad, nxcompext and nxproxy into separate tarballs in any way? After all, they are "just" addons to an existing (X11|nx-libs) tree that gets installed as well and which looks usable.
That's what I have initially implemented.
This was reverted because it caused strange segfaults nobody had the capacity to fully analyze. Mike can fill in the details.
-- regards, Reinhard
Hi Bernard,
On Di 08 Jan 2013 13:23:22 CET Bernard Cafarelli wrote:
Regarding the optflags patch, is it possible to drop altogether the
hardcoded "-O3" in C/CXXFLAGS in the various configure.in? This
would remove the need for 4 autoreconf when using another
optimization level
I actually plan to work on hardening the nx-libs build [1]. If you
have experience with that, please appear on #x2go irc.freenode.net and
let us discuss the needed steps.
Greets, Mike
[1] http://wiki.debian.org/Hardening
--
DAS-NETZWERKTEAM mike gabriel, rothenstein 5, 24214 neudorf-bornstein fon: +49 (1520) 1976 148
GnuPG Key ID 0x25771B31 mail: mike.gabriel@das-netzwerkteam.de, http://das-netzwerkteam.de
freeBusy: https://mail.das-netzwerkteam.de/freebusy/m.gabriel%40das-netzwerkteam.de.xf...