dslm4515 / CMLFS

Clang-Built Musl Linux From Scratch
MIT License
99 stars 18 forks source link

libelf: force ac_cv_c99=yes rather than recreating autoconf #34

Closed konimex closed 2 years ago

konimex commented 2 years ago

As we all know, the only function we need for elfutils is libelf, so the gnu99 check is not needed at all in this case. We can bypass the check entirely by adding a flag rather than patching the whole autoconf process and regenerating the configure file.

owl4ce commented 2 years ago

I know this, but did you succeed just with flag like that? I mean when building.

konimex commented 2 years ago

Sure, here's my log: https://termbin.com/9ww7.

Here's the build flag just in case you're interested. https://termbin.com/en1j

owl4ce commented 2 years ago

Sure, here's my log: https://termbin.com/9ww7.

Oh I see, before I thought you removed the patch. Turns out it's actually only on the part that removes gnu99 checker in the patch. That's good.

konimex commented 2 years ago

While I currently do only remove the configure.ac, I don't think we need the patch in its entirety. Since in the current state, the build file for libelf only builds... libelf. So elfcompress.c, readelf.c, and strip.c will not be touched at all since they're not part of libelf.

dslm4515 commented 2 years ago

Obviously, modified patch and added flag to configure command does build successfully.

But ...

Build also succeeds without patch BUT with extra flag for configure. I think @konimex is right, patch is not needed for CMLFS, but perhaps useful for building the entire elfutils package.

I will change build to the following:

# Add missing files
cp -vr ../files/elfutils-void/error.h lib/
cp -vr ../files/elfutils-void/error.h src/

# Configure source to skip GNU99 test/support
CFLAGS="-Wno-error -Wno-null-dereference -DFNM_EXTMATCH=0" \
CXXFLAGS="-Wno-error -Wl,-z,stack-size=2097152" \
ac_cv_c99=yes \
./configure --prefix=/usr \
            --disable-debuginfod \
            --disable-libdebuginfod

# Build lib first as libelf requires it
make -C lib && make -C libelf

# Install library
make -C libelf install

# Install pkgconfig file for library
install -vm644 config/libelf.pc /usr/lib/pkgconfig