Allow override of CFLAGS
Simon Horman
maintainerPATCH 1/1 Allow override of CFLAGS
When building ipvsadm this allows make to add to CFLAGS supplied on the command line.
This seems to make sense as Makefile and libipvs/Makefile add different CFLAGS but it may be desirable to supply supplementary flags when building ipvsadm.
In particular the following may be useful when building ipvsadm on Debian Jessie.
make CFLAGS='-I/usr/include/libnl3' LIBS='-lnl-3 -lnl-genl-3 -lnl-3 -lpopt'
--- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
@@ -48,7 +48,7 @@ STATIC_LIBS = libipvs/libipvs.a ifeq "${ARCH}" "sparc64" CFLAGS = -Wall -Wunused -Wstrict-prototypes -g -m64 -pipe -mcpu=ultrasparc -mcmodel=medlow else - CFLAGS = -Wall -Wunused -Wstrict-prototypes -g + CFLAGS = -I/usr/include/libnl3 -Wall -Wunused -Wstrict-prototypes -g endif
Signature · 1 line
1.8.3.2
Julian Anastasov
maintainerHello,
Quoted 2 lines · Simon Horman
When building ipvsadm this allows make to add to CFLAGS supplied on the command line.
Hm, the change below simply adds -I, variable
override is already possible before the change. Is the commit correct?
Quoted 8 lines
This seems to make sense as
Makefileand libipvs/Makefile add different CFLAGS but it may be desirable to supply supplementary flags when building ipvsadm.In particular the following may be useful when building ipvsadm on Debian Jessie.
make CFLAGS='-I/usr/include/libnl3' LIBS='-lnl-3 -lnl-genl-3 -lnl-3 -lpopt'
Hm, such command line vars override the
vars in Makefiles, they do not add to them. So, it is not good for libipvs where -fPIC is the difference.
make has such rules for vars:
Order of variables:
- command line
- makefile
- environment
For example: var=env make var=command_line
If -e is provided order is: command line, environment, makefile
Sub-make: only command line and environment vars are inherited,
use 'export' to provide variables defined in makefile
As result, we can support EXTRA_CFLAGS when
we want to add -Idir or other options, for example:
Makefile:
CFLAGS = $(EXTRA_CFLAGS) -Wall -Wunused -Wstrict-prototypes -g
libipvs/Makefile:
CFLAGS = $(EXTRA_CFLAGS) -Wall -Wunused -Wstrict-prototypes -g -fPIC
Then:
1. Add to CFLAGS by providing EXTRA_CFLAGS, override LIBS:
make EXTRA_CFLAGS='-I/usr/include/libnl3' \ LIBS='-lnl-3 -lnl-genl-3 -lnl-3 -lpopt'
2. Override CFLAGS for both Makefiles because CFLAGS from command line is inherited in sub-make
make CFLAGS='-I/usr/include/libnl3 -fPIC' \ LIBS='-lnl-3 -lnl-genl-3 -lnl-3 -lpopt' We can add EXTRA_LIBS if needed to complement
EXTRA_CFLAGS.
Also, this is NOT an alternative:
Makefile:
CFLAGS+=-Wall -Wunused -Wstrict-prototypes -g
Makefile:
CFLAGS+=-Wall -Wunused -Wstrict-prototypes -g -fPIC
because make CFLAGS=... will override the var,
makefile can override command line vars in such way but it is ugly:
override var=DEFERRED
override var:=IMMEDIATE
override var+=APPEND
Quoted 20 lines
Signed-off-by Simon Horman <[email protected]>--- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Makefile +1
-1@@ -48,7 +48,7 @@ STATIC_LIBS = libipvs/libipvs.a ifeq "${ARCH}" "sparc64" CFLAGS = -Wall -Wunused -Wstrict-prototypes -g -m64 -pipe -mcpu=ultrasparc -mcmodel=medlow else - CFLAGS = -Wall -Wunused -Wstrict-prototypes -g + CFLAGS = -I/usr/include/libnl3 -Wall -Wunused -Wstrict-prototypes -g endifSignature · 1 line
1.8.3.2
Regards
--
Julian Anastasov <[email protected]>
Simon Horman
maintainerQuoted 11 lines · Julian Anastasov
Hello,
Quoted 2 lines · Simon Horman
When building ipvsadm this allows make to add to CFLAGS supplied on the command line.
Hm, the change below simply adds -I, variable
override is already possible before the change. Is the commit correct?
The commit is completely wrong, sorry!
Quoted 58 lines
Quoted 8 lines
This seems to make sense as
Makefileand libipvs/Makefile add different CFLAGS but it may be desirable to supply supplementary flags when building ipvsadm.In particular the following may be useful when building ipvsadm on Debian Jessie.
make CFLAGS='-I/usr/include/libnl3' LIBS='-lnl-3 -lnl-genl-3 -lnl-3 -lpopt'
Hm, such command line vars override the
vars in Makefiles, they do not add to them. So, it is not good for libipvs where -fPIC is the difference.make has such rules for vars:
Order of variables:
- command line
- makefile
- environmentFor example: var=env make var=command_line
If -e is provided order is: command line, environment, makefile
Sub-make: only command line and environment vars are inherited,
use 'export' to provide variables defined in makefileAs result, we can support
EXTRA_CFLAGSwhen
we want to add -Idir or other options, for example:
Makefile:
CFLAGS = $(EXTRA_CFLAGS) -Wall -Wunused -Wstrict-prototypes -glibipvs/Makefile:
CFLAGS = $(EXTRA_CFLAGS) -Wall -Wunused -Wstrict-prototypes -g -fPICThen:
1. Add to CFLAGS by providing
EXTRA_CFLAGS, override LIBS:make EXTRA_CFLAGS='-I/usr/include/libnl3' \ LIBS='-lnl-3 -lnl-genl-3 -lnl-3 -lpopt'2. Override CFLAGS for both Makefiles because CFLAGS from command line is inherited in sub-make
make CFLAGS='-I/usr/include/libnl3 -fPIC' \ LIBS='-lnl-3 -lnl-genl-3 -lnl-3 -lpopt' We can add EXTRA_LIBS if needed to complement
EXTRA_CFLAGS.Also, this is NOT an alternative:
Makefile:
CFLAGS+=-Wall -Wunused -Wstrict-prototypes -g
Makefile:
CFLAGS+=-Wall -Wunused -Wstrict-prototypes -g -fPIC
Quoted 7 lines
because make CFLAGS=... will override the var,
makefile can override command line vars in such way but it is ugly:override var=DEFERRED
override var:=IMMEDIATE
override var+=APPEND
I was planning to use override but somehow I sent the wrong version of the patch.
However, I like your EXTRA_CFLAGS and EXTRA_LIBS idea better. Should I send a patch or would you like to?
Quoted 27 lines
Quoted 21 lines
Signed-off-by Simon Horman <[email protected]>--- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Makefile +1
-1@@ -48,7 +48,7 @@ STATIC_LIBS = libipvs/libipvs.a ifeq "${ARCH}" "sparc64" CFLAGS = -Wall -Wunused -Wstrict-prototypes -g -m64 -pipe -mcpu=ultrasparc -mcmodel=medlow else - CFLAGS = -Wall -Wunused -Wstrict-prototypes -g + CFLAGS = -I/usr/include/libnl3 -Wall -Wunused -Wstrict-prototypes -g endifSignature · 1 line
1.8.3.2Regards
--
Julian Anastasov <[email protected]>
Julian Anastasov
maintainerHello,
Quoted 39 lines · Simon Horman
Quoted 37 lines · Julian Anastasov
As result, we can support
EXTRA_CFLAGSwhen
we want to add -Idir or other options, for example:
Makefile:
CFLAGS = $(EXTRA_CFLAGS) -Wall -Wunused -Wstrict-prototypes -glibipvs/Makefile:
CFLAGS = $(EXTRA_CFLAGS) -Wall -Wunused -Wstrict-prototypes -g -fPICThen:
1. Add to CFLAGS by providing
EXTRA_CFLAGS, override LIBS:make EXTRA_CFLAGS='-I/usr/include/libnl3' \ LIBS='-lnl-3 -lnl-genl-3 -lnl-3 -lpopt'2. Override CFLAGS for both Makefiles because CFLAGS from command line is inherited in sub-make
make CFLAGS='-I/usr/include/libnl3 -fPIC' \ LIBS='-lnl-3 -lnl-genl-3 -lnl-3 -lpopt' We can add EXTRA_LIBS if needed to complement
EXTRA_CFLAGS.Also, this is NOT an alternative:
Makefile:
CFLAGS+=-Wall -Wunused -Wstrict-prototypes -g
Makefile:
CFLAGS+=-Wall -Wunused -Wstrict-prototypes -g -fPICbecause make CFLAGS=... will override the var,
makefile can override command line vars in such way but it is ugly:
Quoted 8 lines
Quoted 3 lines
override var=DEFERRED
override var:=IMMEDIATE
override var+=APPENDI was planning to use override but somehow I sent the wrong version of the patch.
However, I like your
EXTRA_CFLAGSandEXTRA_LIBSidea better. Should I send a patch or would you like to?
You can try it, hope it works.
Regards
--
Julian Anastasov <[email protected]>
Quoted 11 lines · Simon Horman
When building ipvsadm this allows make to add to CFLAGS supplied on the command line.
This seems to make sense as
Makefileand libipvs/Makefile add different CFLAGS but it may be desirable to supply supplementary flags when building ipvsadm.In particular the following may be useful when building ipvsadm on Debian Jessie.
make CFLAGS='-I/usr/include/libnl3' LIBS='-lnl-3 -lnl-genl-3 -lnl-3 -lpopt'
For libnl3, what about ...
cflags: $(shell pkg-config --cflags libnl-3.0) $(shell pkg-config --cflags libnl-3.0) libs: $(shell pkg-config --libs libnl-3.0) $(shell pkg-config --libs libnl-genl-3.0)
Quoted 19 lines
Signed-off-by Simon Horman <[email protected]>--- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Makefile +1
-1@@ -48,7 +48,7 @@ STATIC_LIBS = libipvs/libipvs.a ifeq "${ARCH}" "sparc64" CFLAGS = -Wall -Wunused -Wstrict-prototypes -g -m64 -pipe -mcpu=ultrasparc -mcmodel=medlow else - CFLAGS = -Wall -Wunused -Wstrict-prototypes -g + CFLAGS = -I/usr/include/libnl3 -Wall -Wunused -Wstrict-prototypes -g endif
ipvsadm git head not compiling on RHEL6
I noticed that I get an compile error, when compiling ipvsadm git HEAD 1ea1f41f4 on RHEL6.4.
Compile Error:
gcc -Wall -Wunused -Wstrict-prototypes -g -o ipvsadm ipvsadm.o config_stream.o dynamic_array.o libipvs/libipvs.a -lpopt -lnl libipvs/libipvs.a(libipvs.o): In function `ipvs_nl_send_message':/home/jbrouer/git/ipvsadm/libipvs/libipvs.c:76: undefined reference to nl_socket_alloc' /home/jbrouer/git/ipvsadm/libipvs/libipvs.c:91: undefined reference to nl_socket_free' /home/jbrouer/git/ipvsadm/libipvs/libipvs.c:107: undefined reference to nl_socket_free' /home/jbrouer/git/ipvsadm/libipvs/libipvs.c:112: undefined reference to nl_socket_free'
collect2: ld returned 1 exit status
make: *** [ipvsadm] Error 1
I'll investigate, but hints would be appreciated ;-)
Signature · 5 lines
Best regards, Jesper Dangaard Brouer MSc.CS, Sr. Network Kernel Developer at Red Hat Author of http://www.iptv-analyzer.org LinkedIn: http://www.linkedin.com/in/brouer
Re: ipvsadm git head not compiling on RHEL6
Quoted 15 lines · Jesper Dangaard Brouer
I noticed that I get an compile error, when compiling ipvsadm git HEAD
1ea1f41f4on RHEL6.4.Compile Error:
gcc -Wall -Wunused -Wstrict-prototypes -g -o ipvsadm ipvsadm.o config_stream.o dynamic_array.o libipvs/libipvs.a -lpopt -lnl libipvs/libipvs.a(libipvs.o): In function `ipvs_nl_send_message':
/home/jbrouer/git/ipvsadm/libipvs/libipvs.c:76: undefined reference tonl_socket_alloc' /home/jbrouer/git/ipvsadm/libipvs/libipvs.c:91: undefined reference tonl_socket_free'/home/jbrouer/git/ipvsadm/libipvs/libipvs.c:107: undefined reference tonl_socket_free' /home/jbrouer/git/ipvsadm/libipvs/libipvs.c:112: undefined reference tonl_socket_free'
collect2: ld returned 1 exit status
make: *** [ipvsadm] Error 1
Quoted 1 line
I'll investigate, but hints would be appreciated ;-)
Did you try using libnl3? (Migrating to libnl3 would be better anyway as distributions try to get rid of supporting libnl.)
I think sometime in libnl*, nl_handle_{alloc,free} was changed to nl_socket_{alloc,free}.
Maybe try changing include locations and libs that are linked against to libnl3.
Simon Horman
maintainerRe: ipvsadm git head not compiling on RHEL6
Quoted 18 lines · Daniel Borkmann
Quoted 15 lines · Jesper Dangaard Brouer
I noticed that I get an compile error, when compiling ipvsadm git HEAD
1ea1f41f4on RHEL6.4.Compile Error:
gcc -Wall -Wunused -Wstrict-prototypes -g -o ipvsadm ipvsadm.o config_stream.o dynamic_array.o libipvs/libipvs.a -lpopt -lnl libipvs/libipvs.a(libipvs.o): In function `ipvs_nl_send_message':
/home/jbrouer/git/ipvsadm/libipvs/libipvs.c:76: undefined reference tonl_socket_alloc' /home/jbrouer/git/ipvsadm/libipvs/libipvs.c:91: undefined reference tonl_socket_free'/home/jbrouer/git/ipvsadm/libipvs/libipvs.c:107: undefined reference tonl_socket_free' /home/jbrouer/git/ipvsadm/libipvs/libipvs.c:112: undefined reference tonl_socket_free'
collect2: ld returned 1 exit status
make: *** [ipvsadm] Error 1Quoted 1 line
I'll investigate, but hints would be appreciated ;-)
Quoted 8 lines
Did you try using libnl3? (Migrating to libnl3 would be better anyway as distributions try to get rid of supporting libnl.)
I think sometime in libnl*, nl_handle_{alloc,free} was changed to nl_socket_{alloc,free}.
Maybe try changing include locations and libs that are linked against to libnl3.
I'm pretty sure that I saw the same problem and that using libnl3 was the solution.
Re: ipvsadm git head not compiling on RHEL6
In reply to Daniel BorkmannQuoted 16 lines · On Thu, 08 Aug 2013 10:27:05 +0200 Daniel Borkmann <[email protected]> wrote:
Quoted 15 lines · Jesper Dangaard Brouer
I noticed that I get an compile error, when compiling ipvsadm git HEAD
1ea1f41f4on RHEL6.4.Compile Error:
gcc -Wall -Wunused -Wstrict-prototypes -g -o ipvsadm ipvsadm.o config_stream.o dynamic_array.o libipvs/libipvs.a -lpopt -lnl libipvs/libipvs.a(libipvs.o): In function `ipvs_nl_send_message':
/home/jbrouer/git/ipvsadm/libipvs/libipvs.c:76: undefined reference tonl_socket_alloc' /home/jbrouer/git/ipvsadm/libipvs/libipvs.c:91: undefined reference tonl_socket_free'/home/jbrouer/git/ipvsadm/libipvs/libipvs.c:107: undefined reference tonl_socket_free' /home/jbrouer/git/ipvsadm/libipvs/libipvs.c:112: undefined reference tonl_socket_free'
collect2: ld returned 1 exit status
make: *** [ipvsadm] Error 1
Quoted 4 lines
Quoted 1 line
I'll investigate, but hints would be appreciated ;-)
Did you try using libnl3? (Migrating to libnl3 would be better anyway as distributions try to get rid of supporting libnl.)
Nope, I'm using the default libnl coming with RHEL6.4.
Its not really an option to import/change to libnl3 for RHEL6. But you could try poking Thomas Graf ;-)
Quoted 2 lines
I think sometime in libnl*, nl_handle_{alloc,free} was changed to nl_socket_{alloc,free}.
Yes, I can see that your libnl3 commit f48e93c1 (libipvs: libnl3: fix compilation error) caused this issue.
Quoted 2 lines
Maybe try changing include locations and libs that are linked against to libnl3.
We officially support ipvsadm for RHEL6, so its not an option to link against libnl3, as we need to supply an official package... else we/I would need to have an adaption patch in the RPM (I were looking to rebase RHEL6 to use the upcoming ipvsadm release).
Signature · 5 lines
Best regards, Jesper Dangaard Brouer MSc.CS, Sr. Network Kernel Developer at Red Hat Author of http://www.iptv-analyzer.org LinkedIn: http://www.linkedin.com/in/brouer
Re: ipvsadm git head not compiling on RHEL6
Quoted 25 lines · Jesper Dangaard Brouer
Quoted 16 lines · On Thu, 08 Aug 2013 10:27:05 +0200 Daniel Borkmann <[email protected]> wrote:
Quoted 15 lines · Jesper Dangaard Brouer
I noticed that I get an compile error, when compiling ipvsadm git HEAD
1ea1f41f4on RHEL6.4.Compile Error:
gcc -Wall -Wunused -Wstrict-prototypes -g -o ipvsadm ipvsadm.o config_stream.o dynamic_array.o libipvs/libipvs.a -lpopt -lnl libipvs/libipvs.a(libipvs.o): In function `ipvs_nl_send_message':
/home/jbrouer/git/ipvsadm/libipvs/libipvs.c:76: undefined reference tonl_socket_alloc' /home/jbrouer/git/ipvsadm/libipvs/libipvs.c:91: undefined reference tonl_socket_free'/home/jbrouer/git/ipvsadm/libipvs/libipvs.c:107: undefined reference tonl_socket_free' /home/jbrouer/git/ipvsadm/libipvs/libipvs.c:112: undefined reference tonl_socket_free'
collect2: ld returned 1 exit status
make: *** [ipvsadm] Error 1Quoted 4 lines
Quoted 1 line
I'll investigate, but hints would be appreciated ;-)
Did you try using libnl3? (Migrating to libnl3 would be better anyway as distributions try to get rid of supporting libnl.)
Nope, I'm using the default libnl coming with RHEL6.4.
Quoted 8 lines
Its not really an option to import/change to libnl3 for RHEL6. But you could try poking Thomas Graf ;-)
Quoted 2 lines
I think sometime in libnl*, nl_handle_{alloc,free} was changed to nl_socket_{alloc,free}.
Yes, I can see that your libnl3 commit
f48e93c1(libipvs: libnl3: fix compilation error) caused this issue.
Well, because it broke the build when using libnl3 which should be the way to go for most users. ;-)
You could add a fall-back define for libnl1 users, so that there's just a textual replacement to the old name.
Quoted 7 lines
Quoted 2 lines
Maybe try changing include locations and libs that are linked against to libnl3.
We officially support ipvsadm for RHEL6, so its not an option to link against libnl3, as we need to supply an official package... else we/I would need to have an adaption patch in the RPM (I were looking to rebase RHEL6 to use the upcoming ipvsadm release).
Re: ipvsadm git head not compiling on RHEL6
Quoted 37 lines · Daniel Borkmann
Quoted 36 lines · Jesper Dangaard Brouer
Quoted 21 lines · On Thu, 08 Aug 2013 10:27:05 +0200 Daniel Borkmann <[email protected]> wrote:
Quoted 20 lines · Jesper Dangaard Brouer
I noticed that I get an compile error, when compiling ipvsadm git HEAD
1ea1f41f4on RHEL6.4.Compile Error:
gcc -Wall -Wunused -Wstrict-prototypes -g -o ipvsadm ipvsadm.o config_stream.o dynamic_array.o libipvs/libipvs.a -lpopt -lnl libipvs/libipvs.a(libipvs.o): In function `ipvs_nl_send_message':
/home/jbrouer/git/ipvsadm/libipvs/libipvs.c:76: undefined reference tonl_socket_alloc' /home/jbrouer/git/ipvsadm/libipvs/libipvs.c:91: undefined reference tonl_socket_free'/home/jbrouer/git/ipvsadm/libipvs/libipvs.c:107: undefined reference tonl_socket_free' /home/jbrouer/git/ipvsadm/libipvs/libipvs.c:112: undefined reference tonl_socket_free'
collect2: ld returned 1 exit status
make: *** [ipvsadm] Error 1Quoted 4 lines
Quoted 1 line
I'll investigate, but hints would be appreciated ;-)
Did you try using libnl3? (Migrating to libnl3 would be better anyway as distributions try to get rid of supporting libnl.)
Nope, I'm using the default libnl coming with RHEL6.4.
Its not really an option to import/change to libnl3 for RHEL6. But you could try poking Thomas Graf ;-)
Quoted 2 lines
I think sometime in libnl*, nl_handle_{alloc,free} was changed to nl_socket_{alloc,free}.
Quoted 16 lines
Quoted 2 lines
Yes, I can see that your libnl3 commit
f48e93c1(libipvs: libnl3: fix compilation error) caused this issue.Well, because it broke the build when using libnl3 which should be the way to go for most users. ;-)
You could add a fall-back define for libnl1 users, so that there's just a textual replacement to the old name.
Quoted 7 lines
Quoted 2 lines
Maybe try changing include locations and libs that are linked against to libnl3.
We officially support ipvsadm for RHEL6, so its not an option to link against libnl3, as we need to supply an official package... else we/I would need to have an adaption patch in the RPM (I were looking to rebase RHEL6 to use the upcoming ipvsadm release).
libnl1 and libnl3 are not API compatible.
Simon Horman
maintainerQuoted 11 lines · Daniel Borkmann
Quoted 10 lines · Simon Horman
When building ipvsadm this allows make to add to CFLAGS supplied on the command line.
This seems to make sense as
Makefileand libipvs/Makefile add different CFLAGS but it may be desirable to supply supplementary flags when building ipvsadm.In particular the following may be useful when building ipvsadm on Debian Jessie.
Quoted 6 lines
Quoted 1 line
make CFLAGS='-I/usr/include/libnl3' LIBS='-lnl-3 -lnl-genl-3 -lnl-3 -lpopt'
For libnl3, what about ...
cflags: $(shell pkg-config --cflags libnl-3.0) $(shell pkg-config --cflags libnl-3.0) libs: $(shell pkg-config --libs libnl-3.0) $(shell pkg-config --libs libnl-genl-3.0)
That seems reasonable to me. Is it likely to work on a variety of distributions?
Quoted 21 lines
Quoted 20 lines
Signed-off-by Simon Horman <[email protected]>--- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Makefile +1
-1@@ -48,7 +48,7 @@ STATIC_LIBS = libipvs/libipvs.a ifeq "${ARCH}" "sparc64" CFLAGS = -Wall -Wunused -Wstrict-prototypes -g -m64 -pipe -mcpu=ultrasparc -mcmodel=medlow else - CFLAGS = -Wall -Wunused -Wstrict-prototypes -g + CFLAGS = -I/usr/include/libnl3 -Wall -Wunused -Wstrict-prototypes -g endif
Quoted 14 lines · Simon Horman
Quoted 13 lines · Daniel Borkmann
Quoted 11 lines · Simon Horman
When building ipvsadm this allows make to add to CFLAGS supplied on the command line.
This seems to make sense as
Makefileand libipvs/Makefile add different CFLAGS but it may be desirable to supply supplementary flags when building ipvsadm.In particular the following may be useful when building ipvsadm on Debian Jessie.
make CFLAGS='-I/usr/include/libnl3' LIBS='-lnl-3 -lnl-genl-3 -lnl-3 -lpopt'
Quoted 7 lines
Quoted 4 lines
For libnl3, what about ...
cflags: $(shell pkg-config --cflags libnl-3.0) $(shell pkg-config --cflags libnl-3.0) libs: $(shell pkg-config --libs libnl-3.0) $(shell pkg-config --libs libnl-genl-3.0)That seems reasonable to me. Is it likely to work on a variety of distributions?
Afaik, this should do the job at least on the major ones like Fedora/RHEL and Debian, also Gentoo, etc. I once had people sending me patches to switch to pkg-config on netsniff-ng.
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Signed-off-by Simon Horman <[email protected]>--- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Makefile +1
-1@@ -48,7 +48,7 @@ STATIC_LIBS = libipvs/libipvs.a ifeq "${ARCH}" "sparc64" CFLAGS = -Wall -Wunused -Wstrict-prototypes -g -m64 -pipe -mcpu=ultrasparc -mcmodel=medlow else - CFLAGS = -Wall -Wunused -Wstrict-prototypes -g + CFLAGS = -I/usr/include/libnl3 -Wall -Wunused -Wstrict-prototypes -g endif
PATCH 1/1 ipvsadm: fix compiling tool on distros with only libnl-1
In reply to Daniel BorkmannSome distros have not moved to libnl3 yet. Add a fallback option for compiling on distro's with only libnl1.
Using pkg-config to detect what versions of libnl is available.
--- libipvs/Makefile | 5 +++++ libipvs/libipvs.c | 5 +++++ 2 files changed, 10 insertions(+)
libipvs/Makefile +5 -0
@@ -10,6 +10,11 @@ INCLUDE += $(shell if [ -f ../../ip_vs.h ]; then \ echo "-I../../."; fi;) DEFINES = $(shell if [ ! -f ../../ip_vs.h ]; then \ echo "-DHAVE_NET_IP_VS_H"; fi;) +DEFINES += $(shell if which pkg-config > /dev/null 2>&1; then \ + if pkg-config --exists libnl-3.0; then :; \ + elif pkg-config --exists libnl-2.0; then :; \ + elif pkg-config --exists libnl-1; \ + then echo "-DFALLBACK_LIBNL1"; fi; fi) .PHONY = all clean install dist distclean rpm rpms STATIC_LIB = libipvs.a
libipvs/libipvs.c +5 -0
@@ -32,6 +32,11 @@ static void* ipvs_func = NULL;struct ip_vs_getinfo ipvs_info;#ifdef LIBIPVS_USE_NL +#ifdef FALLBACK_LIBNL1 +#define nl_sock nl_handle +#define nl_socket_alloc nl_handle_alloc +#define nl_socket_free nl_handle_destroy +#endif static struct nl_sock *sock =NULL ;static int family, try_nl =1 ;#endif
Re: [PATCH] ipvsadm: fix compiling tool on distros with only libnl-1
Quoted 6 lines · Jesper Dangaard Brouer
Some distros have not moved to libnl3 yet. Add a fallback option for compiling on distro's with only libnl1.
Using pkg-config to detect what versions of libnl is available.
Signed-off-by Jesper Dangaard Brouer <[email protected]>
Quoted 38 lines
--- libipvs/Makefile | 5 +++++ libipvs/libipvs.c | 5 +++++ 2 files changed, 10 insertions(+)libipvs/Makefile +5
-0@@ -10,6 +10,11 @@ INCLUDE += $(shell if [ -f ../../ip_vs.h ]; then \ echo "-I../../."; fi;) DEFINES = $(shell if [ ! -f ../../ip_vs.h ]; then \ echo "-DHAVE_NET_IP_VS_H"; fi;) +DEFINES += $(shell if which pkg-config > /dev/null 2>&1; then \ + if pkg-config --exists libnl-3.0; then :; \ + elif pkg-config --exists libnl-2.0; then :; \ + elif pkg-config --exists libnl-1; \ + then echo "-DFALLBACK_LIBNL1"; fi; fi) .PHONY = all clean install dist distclean rpm rpms STATIC_LIB = libipvs.alibipvs/libipvs.c +5
-0@@ -32,6 +32,11 @@ static void* ipvs_func = NULL;struct ip_vs_getinfo ipvs_info;#ifdef LIBIPVS_USE_NL +#ifdef FALLBACK_LIBNL1 +#define nl_sock nl_handle +#define nl_socket_alloc nl_handle_alloc +#define nl_socket_free nl_handle_destroy +#endif static struct nl_sock *sock =NULL ;static int family, try_nl =1 ;#endif
Re: [PATCH] ipvsadm: fix compiling tool on distros with only libnl-1
In reply to Jesper Dangaard BrouerQuoted 6 lines · Jesper Dangaard Brouer
Some distros have not moved to libnl3 yet. Add a fallback option for compiling on distro's with only libnl1.
Using pkg-config to detect what versions of libnl is available.
Signed-off-by Jesper Dangaard Brouer <[email protected]>
This patch looks fine, but I think it only solves part of the problem. The Makefile still contains following code:
ifneq (0,$(HAVE_NL))
LIBS += -lnl
endif
First, I think the HAVE_NL conditional can be removed. But more importantly the correct netlink library should be appended to the LIBS variable. With the current code we'll always link against libnl-1.
On Fedora with both libnl and libnl-3 installed:
$ pkg-config --libs libnl-3.0 -lnl-3 $ pkg-config --libs libnl-1 -lnl
Ryan
Quoted 38 lines
--- libipvs/Makefile | 5 +++++ libipvs/libipvs.c | 5 +++++ 2 files changed, 10 insertions(+)libipvs/Makefile +5
-0@@ -10,6 +10,11 @@ INCLUDE += $(shell if [ -f ../../ip_vs.h ]; then \ echo "-I../../."; fi;) DEFINES = $(shell if [ ! -f ../../ip_vs.h ]; then \ echo "-DHAVE_NET_IP_VS_H"; fi;) +DEFINES += $(shell if which pkg-config > /dev/null 2>&1; then \ + if pkg-config --exists libnl-3.0; then :; \ + elif pkg-config --exists libnl-2.0; then :; \ + elif pkg-config --exists libnl-1; \ + then echo "-DFALLBACK_LIBNL1"; fi; fi) .PHONY = all clean install dist distclean rpm rpms STATIC_LIB = libipvs.alibipvs/libipvs.c +5
-0@@ -32,6 +32,11 @@ static void* ipvs_func = NULL;struct ip_vs_getinfo ipvs_info;#ifdef LIBIPVS_USE_NL +#ifdef FALLBACK_LIBNL1 +#define nl_sock nl_handle +#define nl_socket_alloc nl_handle_alloc +#define nl_socket_free nl_handle_destroy +#endif static struct nl_sock *sock =NULL ;static int family, try_nl =1 ;#endif
Simon Horman
maintainerRe: [PATCH] ipvsadm: fix compiling tool on distros with only libnl-1
Quoted 20 lines · Ryan O'Hara
Quoted 6 lines · Jesper Dangaard Brouer
Some distros have not moved to libnl3 yet. Add a fallback option for compiling on distro's with only libnl1.
Using pkg-config to detect what versions of libnl is available.
Signed-off-by Jesper Dangaard Brouer <[email protected]>This patch looks fine, but I think it only solves part of the problem. The
Makefilestill contains following code:ifneq (0,$(HAVE_NL))
LIBS += -lnl
endifFirst, I think the
HAVE_NLconditional can be removed. But more importantly the correct netlink library should be appended to the LIBS variable. With the current code we'll always link against libnl-1.
Quoted 8 lines
On Fedora with both libnl and libnl-3 installed:
$ pkg-config --libs libnl-3.0 -lnl-3 $ pkg-config --libs libnl-1 -lnlRyan
Daniel could you amend your patch or provide a second patch to use pkg-confog for LIBS too. It seems like a good idea to me.
Quoted 41 lines
Quoted 40 lines
--- libipvs/Makefile | 5 +++++ libipvs/libipvs.c | 5 +++++ 2 files changed, 10 insertions(+)libipvs/Makefile +5
-0@@ -10,6 +10,11 @@ INCLUDE += $(shell if [ -f ../../ip_vs.h ]; then \ echo "-I../../."; fi;) DEFINES = $(shell if [ ! -f ../../ip_vs.h ]; then \ echo "-DHAVE_NET_IP_VS_H"; fi;) +DEFINES += $(shell if which pkg-config > /dev/null 2>&1; then \ + if pkg-config --exists libnl-3.0; then :; \ + elif pkg-config --exists libnl-2.0; then :; \ + elif pkg-config --exists libnl-1; \ + then echo "-DFALLBACK_LIBNL1"; fi; fi) .PHONY = all clean install dist distclean rpm rpms STATIC_LIB = libipvs.alibipvs/libipvs.c +5
-0@@ -32,6 +32,11 @@ static void* ipvs_func = NULL;struct ip_vs_getinfo ipvs_info;#ifdef LIBIPVS_USE_NL +#ifdef FALLBACK_LIBNL1 +#define nl_sock nl_handle +#define nl_socket_alloc nl_handle_alloc +#define nl_socket_free nl_handle_destroy +#endif static struct nl_sock *sock =NULL ;static int family, try_nl =1 ;#endif
PATCH v2 1/1 ipvsadm: fix compiling tool on distros with only libnl-1
Some distros have not moved to libnl3 yet. Add a fallback option for compiling on distro's with only libnl1.
Using pkg-config to detect what versions of libnl is available.
---
V2: My git mail config were wrongly configured, and the orig
patch only reached RedHat recipients, thus I'm resending hoping my email client does not screw the patches...
libipvs/Makefile | 5 +++++ libipvs/libipvs.c | 5 +++++ 2 files changed, 10 insertions(+)
libipvs/Makefile +5 -0
@@ -10,6 +10,11 @@ INCLUDE += $(shell if [ -f ../../ip_vs.h ]; then \ echo "-I../../."; fi;) DEFINES = $(shell if [ ! -f ../../ip_vs.h ]; then \ echo "-DHAVE_NET_IP_VS_H"; fi;) +DEFINES += $(shell if which pkg-config > /dev/null 2>&1; then \ + if pkg-config --exists libnl-3.0; then :; \ + elif pkg-config --exists libnl-2.0; then :; \ + elif pkg-config --exists libnl-1; \ + then echo "-DFALLBACK_LIBNL1"; fi; fi) .PHONY = all clean install dist distclean rpm rpms STATIC_LIB = libipvs.a
libipvs/libipvs.c +5 -0
@@ -32,6 +32,11 @@ static void* ipvs_func = NULL;struct ip_vs_getinfo ipvs_info;#ifdef LIBIPVS_USE_NL +#ifdef FALLBACK_LIBNL1 +#define nl_sock nl_handle +#define nl_socket_alloc nl_handle_alloc +#define nl_socket_free nl_handle_destroy +#endif static struct nl_sock *sock =NULL ;static int family, try_nl =1 ;#endif
Re: [PATCH v2] ipvsadm: fix compiling tool on distros with only libnl-1
Quoted 8 lines · Jesper Dangaard Brouer
Some distros have not moved to libnl3 yet. Add a fallback option for compiling on distro's with only libnl1.
Using pkg-config to detect what versions of libnl is available.
Signed-off-by Jesper Dangaard Brouer <[email protected]>Acked-by Daniel Borkmann <[email protected]>
Quoted 8 lines
---
V2: My git mail config were wrongly configured, and the orig
patch only reached RedHat recipients, thus I'm resending hoping my email client does not screw the patches...libipvs/Makefile | 5 +++++ libipvs/libipvs.c | 5 +++++ 2 files changed, 10 insertions(+)
Thanks, applied.
Re: [PATCH] ipvsadm: fix compiling tool on distros with only libnl-1
In reply to Simon HormanQuoted 11 lines · On Fri, 9 Aug 2013 14:47:36 +0900 Simon Horman <[email protected]> wrote:
Quoted 10 lines · Ryan O'Hara
Quoted 6 lines · Jesper Dangaard Brouer
Some distros have not moved to libnl3 yet. Add a fallback option for compiling on distro's with only libnl1.
Using pkg-config to detect what versions of libnl is available.
Signed-off-by Jesper Dangaard Brouer <[email protected]>This patch looks fine, but I think it only solves part of the problem. The
Makefilestill contains following code:
This, patch only address making libnl1 work again.
Quoted 8 lines
Quoted 8 lines
ifneq (0,$(HAVE_NL))
LIBS += -lnl
endifFirst, I think the
HAVE_NLconditional can be removed. But more importantly the correct netlink library should be appended to the LIBS variable. With the current code we'll always link against libnl-1.
True. It seems to me that the libnl3 work have not been fully completed. And the reason Simon send the "Allow override of CFLAGS", which allowed him to compile with libnl3 via:
make CFLAGS='-I/usr/include/libnl3' LIBS='-lnl-3 -lnl-genl-3 -lpopt'
Quoted 11 lines
Quoted 8 lines
On Fedora with both libnl and libnl-3 installed:
$ pkg-config --libs libnl-3.0 -lnl-3 $ pkg-config --libs libnl-1 -lnlRyan
Daniel could you amend your patch or provide a second patch to use pkg-confog for LIBS too. It seems like a good idea to me.
I think a second patch, to address libnl3 issues would be best.
Quoted 39 lines
Quoted 39 lines
Quoted 38 lines
--- libipvs/Makefile | 5 +++++ libipvs/libipvs.c | 5 +++++ 2 files changed, 10 insertions(+)libipvs/Makefile +5
-0@@ -10,6 +10,11 @@ INCLUDE += $(shell if [ -f ../../ip_vs.h ]; then \ echo "-I../../."; fi;) DEFINES = $(shell if [ ! -f ../../ip_vs.h ]; then \ echo "-DHAVE_NET_IP_VS_H"; fi;) +DEFINES += $(shell if which pkg-config > /dev/null 2>&1; then \ + if pkg-config --exists libnl-3.0; then :; \ + elif pkg-config --exists libnl-2.0; then :; \ + elif pkg-config --exists libnl-1; \ + then echo "-DFALLBACK_LIBNL1"; fi; fi) .PHONY = all clean install dist distclean rpm rpms STATIC_LIB = libipvs.alibipvs/libipvs.c +5
-0@@ -32,6 +32,11 @@ static void* ipvs_func = NULL;struct ip_vs_getinfo ipvs_info;#ifdef LIBIPVS_USE_NL +#ifdef FALLBACK_LIBNL1 +#define nl_sock nl_handle +#define nl_socket_alloc nl_handle_alloc +#define nl_socket_free nl_handle_destroy +#endif static struct nl_sock *sock =NULL ;static int family, try_nl =1 ;#endif
Signature · 5 lines
Best regards, Jesper Dangaard Brouer MSc.CS, Sr. Network Kernel Developer at Red Hat Author of http://www.iptv-analyzer.org LinkedIn: http://www.linkedin.com/in/brouer
Re: [PATCH] ipvsadm: fix compiling tool on distros with only libnl-1
Quoted 39 lines · Jesper Dangaard Brouer
Quoted 11 lines · On Fri, 9 Aug 2013 14:47:36 +0900 Simon Horman <[email protected]> wrote:
Quoted 10 lines · Ryan O'Hara
Quoted 6 lines · Jesper Dangaard Brouer
Some distros have not moved to libnl3 yet. Add a fallback option for compiling on distro's with only libnl1.
Using pkg-config to detect what versions of libnl is available.
Signed-off-by Jesper Dangaard Brouer <[email protected]>This patch looks fine, but I think it only solves part of the problem. The
Makefilestill contains following code:This, patch only address making libnl1 work again.
Quoted 8 lines
Quoted 8 lines
ifneq (0,$(HAVE_NL))
LIBS += -lnl
endifFirst, I think the
HAVE_NLconditional can be removed. But more importantly the correct netlink library should be appended to the LIBS variable. With the current code we'll always link against libnl-1.True. It seems to me that the libnl3 work have not been fully completed. And the reason Simon send the "Allow override of CFLAGS", which allowed him to compile with libnl3 via:
make CFLAGS='-I/usr/include/libnl3' LIBS='-lnl-3 -lnl-genl-3 -lpopt'
Quoted 7 lines
Quoted 7 lines
On Fedora with both libnl and libnl-3 installed:
$ pkg-config --libs libnl-3.0 -lnl-3 $ pkg-config --libs libnl-1 -lnl
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Ryan
Daniel could you amend your patch or provide a second patch to use pkg-confog for LIBS too. It seems like a good idea to me.
I think a second patch, to address libnl3 issues would be best.
Agreed, will do that after yours got into the tree.
Quoted 40 lines
Quoted 39 lines
Quoted 39 lines
Quoted 38 lines
--- libipvs/Makefile | 5 +++++ libipvs/libipvs.c | 5 +++++ 2 files changed, 10 insertions(+)libipvs/Makefile +5
-0@@ -10,6 +10,11 @@ INCLUDE += $(shell if [ -f ../../ip_vs.h ]; then \ echo "-I../../."; fi;) DEFINES = $(shell if [ ! -f ../../ip_vs.h ]; then \ echo "-DHAVE_NET_IP_VS_H"; fi;) +DEFINES += $(shell if which pkg-config > /dev/null 2>&1; then \ + if pkg-config --exists libnl-3.0; then :; \ + elif pkg-config --exists libnl-2.0; then :; \ + elif pkg-config --exists libnl-1; \ + then echo "-DFALLBACK_LIBNL1"; fi; fi) .PHONY = all clean install dist distclean rpm rpms STATIC_LIB = libipvs.alibipvs/libipvs.c +5
-0@@ -32,6 +32,11 @@ static void* ipvs_func = NULL;struct ip_vs_getinfo ipvs_info;#ifdef LIBIPVS_USE_NL +#ifdef FALLBACK_LIBNL1 +#define nl_sock nl_handle +#define nl_socket_alloc nl_handle_alloc +#define nl_socket_free nl_handle_destroy +#endif static struct nl_sock *sock =NULL ;static int family, try_nl =1 ;#endif
Re: [PATCH] ipvsadm: fix compiling tool on distros with only libnl-1
Quoted 40 lines · Daniel Borkmann
Quoted 39 lines · Jesper Dangaard Brouer
Quoted 11 lines · On Fri, 9 Aug 2013 14:47:36 +0900 Simon Horman <[email protected]> wrote:
Quoted 10 lines · Ryan O'Hara
Quoted 6 lines · Jesper Dangaard Brouer
Some distros have not moved to libnl3 yet. Add a fallback option for compiling on distro's with only libnl1.
Using pkg-config to detect what versions of libnl is available.
Signed-off-by Jesper Dangaard Brouer <[email protected]>This patch looks fine, but I think it only solves part of the problem. The
Makefilestill contains following code:This, patch only address making libnl1 work again.
Quoted 8 lines
Quoted 8 lines
ifneq (0,$(HAVE_NL))
LIBS += -lnl
endifFirst, I think the
HAVE_NLconditional can be removed. But more importantly the correct netlink library should be appended to the LIBS variable. With the current code we'll always link against libnl-1.True. It seems to me that the libnl3 work have not been fully completed. And the reason Simon send the "Allow override of CFLAGS", which allowed him to compile with libnl3 via:
make CFLAGS='-I/usr/include/libnl3' LIBS='-lnl-3 -lnl-genl-3 -lpopt'
Quoted 7 lines
Quoted 7 lines
On Fedora with both libnl and libnl-3 installed:
$ pkg-config --libs libnl-3.0 -lnl-3 $ pkg-config --libs libnl-1 -lnl
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Ryan
Daniel could you amend your patch or provide a second patch to use pkg-confog for LIBS too. It seems like a good idea to me.
I think a second patch, to address libnl3 issues would be best.
Agreed, will do that after yours got into the tree.
I have pushed the following.
commit ca23ad37d5c7b1b393afa0f72461d81ee884e059
Author: Jesper Dangaard Brouer <[email protected]> Date: Fri Aug 9 08:27:14 2013 +0200
ipvsadm: fix compiling tool on distros with only libnl-1
Some distros have not moved to libnl3 yet. Add a fallback option for compiling on distro's with only libnl1.
Using pkg-config to detect what versions of libnl is available.
libipvs/Makefile +5 -0
@@ -10,6 +10,11 @@ INCLUDE += $(shell if [ -f ../../ip_vs.h ]; then \ echo "-I../../."; fi;) DEFINES = $(shell if [ ! -f ../../ip_vs.h ]; then \ echo "-DHAVE_NET_IP_VS_H"; fi;) +DEFINES += $(shell if which pkg-config > /dev/null 2>&1; then \ + if pkg-config --exists libnl-3.0; then :; \ + elif pkg-config --exists libnl-2.0; then :; \ + elif pkg-config --exists libnl-1; \ + then echo "-DFALLBACK_LIBNL1"; fi; fi) .PHONY = all clean install dist distclean rpm rpms STATIC_LIB = libipvs.a
libipvs/libipvs.c +5 -0
@@ -32,6 +32,11 @@ static void* ipvs_func = NULL;struct ip_vs_getinfo ipvs_info;#ifdef LIBIPVS_USE_NL +#ifdef FALLBACK_LIBNL1 +#define nl_sock nl_handle +#define nl_socket_alloc nl_handle_alloc +#define nl_socket_free nl_handle_destroy +#endif static struct nl_sock *sock =NULL ;static int family, try_nl =1 ;#endif