Skip to contentSkip to conversation

package/iptraf-ng: Needs -D_GNU_SOURCE to fix musl build

PATCH New Bernd Kuhls 2 participants 2 messages May 23, 2016 – May 24, 2016

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 package/iptraf-ng: Needs -D_GNU_SOURCE to fix musl build

Compiling iptraf-ng using musl is broken:

src/ipfrag.c:193:52: error: 'struct tcphdr' has no member named 'source'

    ftmp->s_port = ntohs(((struct tcphdr *) tpacket)->source);

Musl guards these fields in the netinet/tcp.h header file with _GNU_SOURCE, for details see https://dev.openwrt.org/ticket/19889

Patch ported from
http://git.alpinelinux.org/cgit/aports/tree/main/iptraf-ng/APKBUILD#n28

Fixes
http://autobuild.buildroot.net/results/4ce/4cedd4dbaafca76e839f45cc0a4bb8c2c181920d/
http://autobuild.buildroot.net/results/72b/72b019ce5bb52b8b87d92cce675708f7b9f8a96e/
http://autobuild.buildroot.net/results/f67/f67f1c2a627a6d535dd5c00e2ee131b5c5a99a0a/

---
v2: extended patch comment (Thomas)

 package/iptraf-ng/iptraf-ng.mk | 1 +
 1 file changed, 1 insertion(+)
package/iptraf-ng/iptraf-ng.mk +1 -0
index 7313873..404db8b 100644
@@ -11,5 +11,6 @@ IPTRAF_NG_LICENSE_FILES = LICENSE
 IPTRAF_NG_DEPENDENCIES = ncurses
 
 IPTRAF_NG_MAKE_ENV = NCURSES_LDFLAGS="-lpanel -lncurses"
+IPTRAF_NG_CONF_ENV += CFLAGS="$(TARGET_CFLAGS) -D_GNU_SOURCE"
 
 $(eval $(autotools-package))
Signature · 1 line
2.8.1
#1 lore raw

PATCH v2 1/1 package/iptraf-ng: Needs -D_GNU_SOURCE to fix musl build

Hello,

Quoted 11 lines · Bernd Kuhls

Compiling iptraf-ng using musl is broken:

src/ipfrag.c:193:52: error: 'struct tcphdr' has no member named 'source'

    ftmp->s_port = ntohs(((struct tcphdr *) tpacket)->source);

Musl guards these fields in the netinet/tcp.h header file with _GNU_SOURCE, for details see https://dev.openwrt.org/ticket/19889

Patch ported from
http://git.alpinelinux.org/cgit/aports/tree/main/iptraf-ng/APKBUILD#n28

Quoted 7 lines

Fixes
http://autobuild.buildroot.net/results/4ce/4cedd4dbaafca76e839f45cc0a4bb8c2c181920d/
http://autobuild.buildroot.net/results/72b/72b019ce5bb52b8b87d92cce675708f7b9f8a96e/
http://autobuild.buildroot.net/results/f67/f67f1c2a627a6d535dd5c00e2ee131b5c5a99a0a/

Thanks for the better commit log.

Quoted 2 lines

IPTRAF_NG_MAKE_ENV = NCURSES_LDFLAGS="-lpanel -lncurses"
+IPTRAF_NG_CONF_ENV += CFLAGS="$(TARGET_CFLAGS) -D_GNU_SOURCE"

These two assignments should have been grouped into just one, so I've changed that and applied to master. Thanks!

Can you report the problem upstream, and get it fixed there? There has been some commits 6 weeks ago upstream, so it seems to be active. See
https://git.fedorahosted.org/cgit/iptraf-ng.git/log/.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com