kisslinux / kiss

KISS Linux - Package Manager
https://kisslinux.github.io
MIT License
464 stars 62 forks source link

Default environment variables are affecting packages built with bmake #237

Closed konimex closed 3 years ago

konimex commented 3 years ago

Following up from issue #236 and issue https://github.com/wyvertux/wyverkiss/issues/26, I decided to reproduce this, and found a quite interesting result.

The two packages @f1nniboy tested never fail (at least in my tests) with bmake in kiss prior to version 5.5.0, I did a bisect and found out the first commit which triggers the breakage, is https://github.com/kisslinux/kiss/commit/61b5972ebbe5514d9bba007f9d97fc59a82a5897. We probably need to test some more.

The build log @f1nniboy provided will still apply here.

Build log for dhcpcd: https://dpaste.com/7ZSNC83TU.txt Build log for pigz: https://dpaste.com/5AV88LFRP.tx

dylanaraps commented 3 years ago

What does a diff of the logs show?

Also, can this be reproduced in prior versions like this?: CC=cc CXX=c++ ... kiss b dhcpcd pigz

konimex commented 3 years ago

Nope. Can't reproduce it with CC=cc, CXX=c++ ... kiss b dhcpcd pigz.

dylanaraps commented 3 years ago

Now... that's interesting. Will install bmake to see if I can reproduce.

konimex commented 3 years ago

Anyway, this is the diff. It seems $pkgdir is somehow included there.

https://termbin.com/vgjk

dylanaraps commented 3 years ago

I found this: When building with bmake -nostdinc and -idirafter ... are added for some reason.

-> grep nostdinc ~/dhcpcd-make 
-> grep nostdinc ~/dhcpcd-bmake 
cc  -O3 -march=native -pipe -std=c99 -nostdinc -idirafter /tmp/665/pkg/dhcpcd/usr/include -DHAVE_CONFIG_H -DNDEBUG -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -DINET -DARP -DARPING -DIPV4LL -DINET6 -DDHCP6 -DAUTH -DPRIVSEP -DPLUGIN_DEV -I.. -I../src -I./crypt -c common.c -o common.o
cc  -O3 -march=native -pipe -std=c99 -nostdinc -idirafter /tmp/665/pkg/dhcpcd/usr/include -DHAVE_CONFIG_H -DNDEBUG -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -DINET -DARP -DARPING -DIPV4LL -DINET6 -DDHCP6 -DAUTH -DPRIVSEP -DPLUGIN_DEV -I.. -I../src -I./crypt -c control.c -o control.o
cc  -O3 -march=native -pipe -std=c99 -nostdinc -idirafter /tmp/665/pkg/dhcpcd/usr/include -DHAVE_CONFIG_H -DNDEBUG -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -DINET -DARP -DARPING -DIPV4LL -DINET6 -DDHCP6 -DAUTH -DPRIVSEP -DPLUGIN_DEV -I.. -I../src -I./crypt -c dhcpcd.c -o dhcpcd.o
cc  -O3 -march=native -pipe -std=c99 -nostdinc -idirafter /tmp/665/pkg/dhcpcd/usr/include -DHAVE_CONFIG_H -DNDEBUG -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -DINET -DARP -DARPING -DIPV4LL -DINET6 -DDHCP6 -DAUTH -DPRIVSEP -DPLUGIN_DEV -I.. -I../src -I./crypt -c duid.c -o duid.o
cc  -O3 -march=native -pipe -std=c99 -nostdinc -idirafter /tmp/665/pkg/dhcpcd/usr/include -DHAVE_CONFIG_H -DNDEBUG -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -DINET -DARP -DARPING -DIPV4LL -DINET6 -DDHCP6 -DAUTH -DPRIVSEP -DPLUGIN_DEV -I.. -I../src -I./crypt -c eloop.c -o eloop.o
cc  -O3 -march=native -pipe -std=c99 -nostdinc -idirafter /tmp/665/pkg/dhcpcd/usr/include -DHAVE_CONFIG_H -DNDEBUG -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -DINET -DARP -DARPING -DIPV4LL -DINET6 -DDHCP6 -DAUTH -DPRIVSEP -DPLUGIN_DEV -I.. -I../src -I./crypt -c logerr.c -o logerr.o

Edit: What's weirder still is that these don't appear in dhcpcd's sources.

-> grep -r nostdinc
-> grep -r idirafter
-> 

Where are they coming from?

Edit2: They appear in bmake's source code:

-> grep -r nostdinc
mk/sys/UnixWare.mk:CPPFLAGS+=   -nostdinc -idirafter ${DESTDIR}/usr/include
mk/sys/SunOS.mk:CPPFLAGS+=  -nostdinc -idirafter ${DESTDIR}/usr/include
mk/sys/OSF1.mk:CPPFLAGS+=   -nostdinc -idirafter ${DESTDIR}/usr/include
mk/sys/Linux.mk:CPPFLAGS+=  -nostdinc -idirafter ${DESTDIR}/usr/include
mk/sys/HP-UX.mk:CPPFLAGS+=  -nostdinc -idirafter ${DESTDIR}/usr/include
mk/sys/AIX.mk:CPPFLAGS+=    -nostdinc -idirafter ${DESTDIR}/usr/include

Now, why are these flags in dhcpcd's build?

konimex commented 3 years ago

It's pointing to DESTDIR, so bmake expects the headers there instead of the usual directories if it's triggered during build stage (as opposed to install stage).

dylanaraps commented 3 years ago

Why does it do this?...

Also:

  .if defined(DESTDIR)
  CPPFLAGS+=  -nostdinc -idirafter ${DESTDIR}/usr/include
  .endif

The offending file on the system: /usr/share/mk/sys/Linux.mk

konimex commented 3 years ago

It's probably the expected behaviour in the BSDs? Should I patch it out for the time being? I think I'll send an email to the creator (since there are no github repo).

dylanaraps commented 3 years ago

I think it's best we patch this out. It behaves contrary to everything else that takes DESTDIR from the environment.

konimex commented 3 years ago

Pushed https://github.com/wyvertux/wyverkiss/commit/5e729dd79f4840a59589e213b4f444e74c5035b1. Can't reproduce anymore. Therefore, closing the issue.