Yubico / yubikey-personalization

YubiKey Personalization cross-platform library and tool
https://developers.yubico.com/yubikey-personalization/
BSD 2-Clause "Simplified" License
299 stars 82 forks source link

error: 'optreset' undeclared (first use in this function) when building #115

Closed 4x0v7 closed 6 years ago

4x0v7 commented 6 years ago

Hi there! I'm creating a Dockerfile and running into an issue when running make check

The error is:

test_args_to_config.c: In function '_test_config':
test_args_to_config.c:136:11: error: 'optreset' undeclared (first use in this function)

Ref: https://github.com/Yubico/yubikey-personalization/blob/907444ccc194082c6df0ed2b6385502af59bcae2/tests/test_args_to_config.c#L136

Prior to this, autoreconf --install and ./configure are running OK.

Any help would be appreciated!

4x0v7 commented 6 years ago

I should mention, base image alpine:3.7

installing packages

apk --no-cache add \
    alpine-sdk \
    asciidoc \
    autoconf \
    automake \
    bash \
    gawk \
    gcc \
    git \
    libtool \
    libusb-dev \
    make \
    musl
klali commented 6 years ago

so the interesting thing that breaks here is at https://github.com/Yubico/yubikey-personalization/blob/master/tests/test_args_to_config.c#L133 and the reason for this seems to be that you're building with musl libc. The ifdef there is to make sure we set up the getopt stuff correctly for a bsd libc, we should probably try to test for that rather than including all libc that don't behave like this.

4x0v7 commented 6 years ago

Thanks @klali! I realise now my mistake was trying to build with alpine, which as you say is musl libc. I'll close this issue, thank you very much for the information!