dslm4515 / Musl-LFS

Linux From Scratch using Musl as Libc
GNU General Public License v3.0
170 stars 21 forks source link

071-IPRoute2: error: static declaration of 'setns' follows non-static declaration #73

Closed takusuman closed 2 years ago

takusuman commented 2 years ago

I was trying to compile IPRoute2 and just got this error. There's nothing unusual on my CFLAGS (in fact, it's empty). Any clue of what can be happening?

sh configure /usr/include TC schedulers ATM no

libc has setns: no SELinux support: no libbpf support: no ELF support: yes libmnl support: no Berkeley DB: no need for strlcpy: yes libcap support: yes

lib CC libgenl.o CC libnetlink.o libnetlink.c:154:2: warning: #warning "libmnl required for error support" [-Wcpp] 154 | #warning "libmnl required for error support" | ^~~ AR libnetlink.a CC utils.o In file included from utils.c:41: ../include/namespace.h:41:19: error: static declaration of 'setns' follows non-static declaration 41 | static inline int setns(int fd, int nstype) | ^~~~~ In file included from ../include/namespace.h:5, from utils.c:41: /usr/include/sched.h:78:5: note: previous declaration of 'setns' was here 78 | int setns(int, int); | ^~~~~ make[1]: [utils.o] Error 1 make: [all] Error 2

takusuman commented 2 years ago

Digging a little, I've found this maillist thread from 2011. https://patchwork.ozlabs.org/project/netdev/patch/m1mxgfkr3g.fsf@fess.ebiederm.org/

takusuman commented 2 years ago

What if I disable DEFINES += -D_GNU_SOURCE?

Edit: Eh, almost...

namespace.c: In function 'netns_switch': namespace.c:72:6: warning: implicit declaration of function 'unshare' [-Wimplicit-function-declaration] 72 | if (unshare(CLONE_NEWNS) < 0) { | ^~~ namespace.c:72:14: error: 'CLONE_NEWNS' undeclared (first use in this function); did you mean 'CLONE_NEWNET'? 72 | if (unshare(CLONE_NEWNS) < 0) { | ^~~ | CLONE_NEWNET namespace.c:72:14: note: each undeclared identifier is reported only once for each function it appears in make[1]: [namespace.o] Error 1 make: [all] Error 2

I'll try to dig more around this tomorrow. May I've missed some package? My distribution hasn't some (mostly GNU) packages installed because some of it would become redundant in the end. After all, it isn't exactly based on Musl-LFS, we're just following the guide partially.

Edit²: I'll read the dependencies appendix from Linux from Scratch 9.0, may something there can enlighten me more. https://www.linuxfromscratch.org/lfs/view/9.0/appendices/dependencies.html

Edit³: Strange enough, I theoretically have all the dependencies installed to compile it.

takusuman commented 2 years ago

cc: @dslm4515

dslm4515 commented 2 years ago

Strange. Are you using the latest version of iproute2? I can't remember what version my latest build uses... I'll have to check once I'm back at my desk.

takusuman commented 2 years ago

Are you using the latest version of iproute2?

I'm using the same version that Musl-LFS 9.00, the 5.12.0 version. Alpine Linux uses an older version (4.13.0) with some patches for building with musl, apparently. https://git.alpinelinux.org/aports/tree/main/iproute2/APKBUILD?h=3.9-stable

takusuman commented 2 years ago

Ok, screw it. If I can't get this working tomorrow morning, I'll assume that this is some error that I've done and redo the chroot stage again from scratch.

dslm4515 commented 2 years ago

I'm building another MLFS build. Last build was messy, trying to get Vulkan support to work. I also realized, I should install non-essential packages in /opt instead of /usr, such as X11/Xorg and wlroots.

I am now at the same point, building IPRoute2. But building version 5.16.0.

ax25_ntop.c:5:10: fatal error: netax25/ax25.h: No such file or directory
    5 | #include <netax25/ax25.h>
      |          ^~~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [../config.mk:39: ax25_ntop.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:73: all] Error 2

I will check Alpine and Void

dslm4515 commented 2 years ago

Alpine shows dependencies for libax25 and libmnl ... yet LFS, shows neither package built.

Perhaps, kernel headers are old on my build?

dslm4515 commented 2 years ago

Nope. Building iproute2-5.17.0 builds fine:

$ sed -i /ARPD/d Makefile
$ rm -fv man/man8/arpd.8
$ sed -i 's/.m_ipt.o//' tc/Makefile
$ make NETNS_RUN_DIR=/run/netns
$ make DOCDIR=/usr/share/doc/iproute2-5.17.0 install
takusuman commented 2 years ago

Nope. Building iproute2-5.17.0 builds fine:

$ sed -i /ARPD/d Makefile
$ rm -fv man/man8/arpd.8
$ sed -i 's/.m_ipt.o//' tc/Makefile
$ make NETNS_RUN_DIR=/run/netns
$ make DOCDIR=/usr/share/doc/iproute2-5.17.0 install

I'll try to build 5.17.0 when I get there again.

takusuman commented 2 years ago

Well, I'm back @dslm4515. Apparently, I've broke some headers by running gmake headers with non-orthodox UNIX tools --- in case, Heirloom ones --- or by running find -name '.*' -exec rm -rvf {} \; instead of informing -type f and using rm -vf instead of rm -rvf (after all, we're not deleting any directories). That's a thing that I think you should fix there too, since this "bug" is somewhat "inherited" from Copacabana Linux --- in other words, blame it on me.

takusuman commented 2 years ago

libc has setns: no

Touché.