Git Product home page Git Product logo

Comments (6)

bbonev avatar bbonev commented on June 2, 2024 1

Yes, they contain commas and that brings confusion to filter-out.
Sorry, I should have tested it before posting.

Does that work:

diff --git a/Makefile b/Makefile
index 790653c..347c061 100644
--- a/Makefile
+++ b/Makefile
@@ -3,6 +3,11 @@ CFLAGS+=-Wall -Wextra -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SO
 LDFLAGS+=-g -Wl,-z,relro -Wl,-z,now -fPIE -pie
 LIBS+=-lpcap
 
+ifeq ($(shell uname -s),Darwin)
+LDFLAGSTODROP:=-Wl,-z,relro -Wl,-z,now
+LDFLAGS:=$(filter-out $(LDFLAGSTODROP),$(LDFLAGS))
+endif
+
 all: dhcpdump dhcpdump.8
 
 clean:

from dhcpdump.

bbonev avatar bbonev commented on June 2, 2024

Thanks for reporting.

I do not have access to any MacOS system, can you test the following patch:

diff --git a/Makefile b/Makefile
index 790653c..38526bb 100644
--- a/Makefile
+++ b/Makefile
@@ -3,6 +3,10 @@ CFLAGS+=-Wall -Wextra -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SO
 LDFLAGS+=-g -Wl,-z,relro -Wl,-z,now -fPIE -pie
 LIBS+=-lpcap
 
+# silently eliminate flags that are not supported by the compiler
+CFLAGS:=$(foreach tfl,$(CFLAGS),$(shell $(CC) $(tfl) -xc -c /dev/null -o /dev/null >/dev/null 2>/dev/null&&echo $(tfl)))
+LDFLAGS:=$(foreach tfl,$(LDFLAGS),$(shell $(CC) $(tfl) -xc -c /dev/null -o /dev/null >/dev/null 2>/dev/null&&echo $(tfl)))
+
 all: dhcpdump dhcpdump.8
 
 clean:

from dhcpdump.

EricFromCanada avatar EricFromCanada commented on June 2, 2024

No effect. But this works; with a bit of adjustment it could detect the compiler instead of just the operating system.

CFLAGS+=${CPPFLAGS}
CFLAGS+=-Wall -Wextra -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -O3 -fPIE
LDFLAGS+=-g -fPIE -pie
LIBS+=-lpcap

UNAME := $(shell uname)
ifneq ($(UNAME), Darwin)
  LDFLAGS+=-Wl,-z,relro -Wl,-z,now
endif

from dhcpdump.

bbonev avatar bbonev commented on June 2, 2024

That is quite the anti-pattern... Some day clang or whatever CC is there on Darwin may start supporting these options.

Please try this:

diff --git a/Makefile b/Makefile
index 790653c..5fa85a1 100644
--- a/Makefile
+++ b/Makefile
@@ -3,6 +3,11 @@ CFLAGS+=-Wall -Wextra -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SO
 LDFLAGS+=-g -Wl,-z,relro -Wl,-z,now -fPIE -pie
 LIBS+=-lpcap
 
+ifeq ($(shell uname -s),Darwin)
+LDFLAGS:=$(filter-out -Wl,-z,relro,$(LDFLAGS))
+LDFLAGS:=$(filter-out -Wl,-z,now,$(LDFLAGS))
+endif
+
 all: dhcpdump dhcpdump.8
 
 clean:

from dhcpdump.

EricFromCanada avatar EricFromCanada commented on June 2, 2024

Looks like you can't pass strings directly to filter-out; they have to be within a variable.

from dhcpdump.

bbonev avatar bbonev commented on June 2, 2024

I'd assume it is OK

from dhcpdump.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.