landley / toybox

toybox
http://landley.net/toybox
BSD Zero Clause License
2.44k stars 340 forks source link

can't build package which need pkg-config when configure #526

Closed jacky-lau-1 closed 3 weeks ago

jacky-lau-1 commented 3 weeks ago

I add ethtool build script to mkroot/packages:

#!/bin/echo Try "mkroot/mkroot.sh ethtool"

download 63c6456b77f7978a7b37e62c1b38346b2ef2d91c \
  https://netfilter.org/projects/libmnl/files/libmnl-1.0.5.tar.bz2

download 9a43584490a64ce109a846bd92dfec53a0573f2a \
  https://mirrors.edge.kernel.org/pub/software/network/ethtool/ethtool-6.11.tar.gz

PREFIX=$(realpath ..)/stage-ethtool

setupfor libmnl
env
./configure --host=$CROSS --prefix=$PREFIX --enable-static --disable-shared &&
make && make install

setupfor ethtool
env
./configure PKG_CONFIG_LIBDIR=$PREFIX/lib/pkgconfig --host=$CROSS --prefix=$PREFIX &&
make && make install

But the configure script of libmnl can't found diff command:

checking if riscv64-linux-musl-gcc supports -fno-rtti -fno-exceptions... ./configure: line 8232: diff: command not found
no

And the configure script of ethtool can't found pkg-config:

checking for riscv64-linux-musl-pkg-config... no
checking for pkg-config... no
checking for libmnl... no
configure: error: in `/home/test/toybox/root/build/riscv64-linux-musl-tmp/ethtool':
configure: error: The pkg-config script could not be found or is too old.  Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.
landley commented 3 weeks ago

On 11/1/24 12:33, jacky-lau-1 wrote:

I add ethtool build script to mkroot/packages:

Ok.

(I need to do a better "why" talk for mkroot. My general theory here was to build a system that you then build more stuff natively in, so dependency handling was approached differently. But this is a valid use case too...)

But the configure script of libmnl can't found diff command:


checking if riscv64-linux-musl-gcc supports -fno-rtti -fno-exceptions... ./configure: line 8232: diff: command not found

Which is still in pending. You can try PENDING=diff to build the one out of toybox, or if you pull the commit I just did you can mkrooot/mkroot.sh TOOLCHAIN=diff to symlink the one out of the host $PATH into root/build/airlock. (Although if it's already built the airlock you'll have to delete that directory before rerunning the build to force it to rebuild it.)

And the configure script of ethtool can't found pkg-config:

Which I don't even have serious plans to implement yet because I'm not entirely sure how it works. Starting with "dpkg-query -S $(which pkg-config)" and chasing the links the one in debian is apparently from from https://github.com/pkgconf/pkgconf but I dunno its theory of operation. According to "man pkg-conf" there are pc files with "man 5 pc" but it doesn't say WHERE they live.

I just ran pkg-config under strace and it's looking in /usr/share/pkgconfig, and /usr/lib/pkgconfig, and /usr/local/x86_64-linux-gnu-gnu-gnu-ia-stallman-ftaghn/pkgconfig and /usr/lib/stallman-ftaghn/pkgconfig and... is there a search path for this specified somewhere?

Anyway, doesn't look that hard to implement. Modulo I'm still not entirely sure what all it does. (I mostly try to avoid dependencies, and then if I do need something it's #include header and -l library and the build breaks obviously if it's not there. This is a dependency hell scalability solution, for a problem I've tried to avoid having...)

Anyway, try: mkroot/mkroot.sh TOOLCHAIN="diff pkg-config"

jacky-lau-1 commented 3 weeks ago

Great, I can build ethtool successful with mkroot/mkroot.sh TOOLCHAIN="diff pkg-config"