Skip to content
Advertisement

error: ‘res_ninit’ was not declared in this scope; did you mean ‘res_init’?

I am trying to install an application from its source code in the alpine it says there is no res_ninit, res_nsearch and res_nclose but we can see here that do exists in the Linux headers and I have already installed apk add linux-headers, how can I resolve this issue?

JavaScript

Update: I cat the header file /usr/include/resolv.h and we can see that function does not exists, so the question is how can I set up Linux header like ubuntu that can work in the alpine?

JavaScript

Advertisement

Answer

in the Linux headers

Linux is generally/colloquially the name of all unix-ish operating systems with a Linux kernel, but specifically, Linux refers to the Linux kernel tiself. The resolve headers are not part of Linux kernel. linux-headers install headers needed to compile Linux kernel modules. It’s unrelated.

The mentioned resolver headers are implemented inside glibc GNU C library. Alpine distribution uses musl implementation of C standard library, not glibc.

how can I resolve this issue?

One of:

  • you can implement res_ninit and relevant function that depend on musl and use that implementation when compiling the application
  • patch mysql-connector yourself to be compilable with musl
  • compile/install glibc to your system and compile mysql-connector against it
  • do not use alpine for programs that require glibc and use only glibc-compatibile Linux distribution
  • notify mysql-connector developers about the issue and financially support them so they will fix the issue
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement