Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building on Alpine fails (configure: error: pkg-config not found) #17

Closed
agboom opened this issue Oct 15, 2019 · 14 comments
Closed

Building on Alpine fails (configure: error: pkg-config not found) #17

agboom opened this issue Oct 15, 2019 · 14 comments

Comments

@agboom
Copy link

agboom commented Oct 15, 2019

I'm trying to build pdlib in an Alpine Docker image (including the dlib dependency), but I'm stuck on the ./configure step.

Here is the output:

Cloning into 'pdlib'...
Configuring for:
PHP Api Version:         20180731
Zend Module Api No:      20180731
Zend Extension Api No:   320180731
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php7 -I/usr/include/php7/main -I/usr/include/php7/TSRM -I/usr/include/php7/Zend -I/usr/include/php7/ext -I/usr/include/php7/ext/date/lib
checking for PHP extension directory... /usr/lib/php7/modules
checking for PHP installed headers prefix... /usr/include/php7
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... no
checking for nawk... no
checking for awk... awk
checking if awk is broken... no
checking for pdlib support... yes, shared
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking how to run the C++ preprocessor... g++ -E
checking for pkg-config... configure: error: pkg-config not found
make: *** No targets specified and no makefile found.  Stop.
make: *** No rule to make target 'install'.  Stop.
The command '/bin/sh -c git clone https://github.com/goodspb/pdlib.git   ; cd pdlib   ; phpize   ; ./configure --enable-debug   ; make   ; make DESTDIR=/pdlib-install install' returned a non-zero code: 2

And here is the Dockerfile to reproduce:

FROM alpine

RUN apk update && apk add bash vim git

# DLib https://github.com/goodspb/pdlib#dependencies
RUN apk add cmake make gcc libc-dev g++ openblas-dev libx11-dev

RUN git clone https://github.com/davisking/dlib.git \
  ; cd dlib/dlib \
  ; mkdir build \
  ; cd build \
  ; cmake -DBUILD_SHARED_LIBS=ON .. \
  ; make \
  ; make DESTDIR=/dlib-install install \
  ; make install

# https://github.com/goodspb/pdlib#installation
RUN apk add php7-dev

RUN git clone https://github.com/goodspb/pdlib.git \
  ; cd pdlib \
  ; phpize \
  ; ./configure --enable-debug \ # <-- this is the step that fails
  ; make \
  ; make DESTDIR=/pdlib-install install

Any idea what could be going wrong?

@agboom agboom changed the title Building on Alpine fails Building on Alpine fails (configure: error: pkg-config not found) Oct 15, 2019
@matiasdelellis
Copy link
Contributor

Hi @agboom
Remove '--enable-debug' option.. I remember that this option failed me before..

@stalker314314
Copy link
Contributor

I started watching this repo, I completely missed this question. Hopefully, we will be notified on next one:)

@Happyfeet01
Copy link

It fails for me also at the configure step. (Ubuntu 18.04)

@agboom
Copy link
Author

agboom commented Nov 14, 2019

Thanks for your suggestion @matiasdelellis, I removed the option, but sadly it still gives the same error (configure: error: pkg-config not found).

@Happyfeet01
Copy link

apt install pkg-config

works for me

@agboom
Copy link
Author

agboom commented Nov 15, 2019

That's great! Sadly it doesn't work in the Alpine container. pkg-config is installed correctly and can be found in the path. Looking at the configure file, the problem is that pkgconfig --exists dlib-1 yields false.

The part in configure that fails is around line 4675:

  if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists dlib-1; then
     if $PKG_CONFIG dlib-1 --atleast-version 19.00; then
        LIBDLIB_CFLAGS=`$PKG_CONFIG dlib-1 --cflags`
        LIBDLIB_LIBDIR=`$PKG_CONFIG dlib-1 --libs`
        LIBDLIB_VERSON=`$PKG_CONFIG dlib-1 --modversion`
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: from pkgconfig: dlib version $LIBDLIB_VERSON" >&5
$as_echo "from pkgconfig: dlib version $LIBDLIB_VERSON" >&6; }
     else
        as_fn_error $? "system dlib is too old: version 19.00 required" "$LINENO" 5
     fi
  else
     if test -x "$PKG_CONFIG"; then echo "HI"; fi # <-- test to see if pkg-config is detected
     as_fn_error $? "pkg-config not found" "$LINENO" 5
  fi

@agboom
Copy link
Author

agboom commented Nov 15, 2019

I found the problem: pkg-config was looking in the wrong places. Setting PKG_CONFIG_PATH=/dlib-install/usr/local/lib64/pkgconfig/ before running ./configure solves this.

@agboom agboom closed this as completed Nov 15, 2019
@Snake883
Copy link

Should this be added to the Installation Instructions (README.md - https://github.com/goodspb/pdlib/blob/master/README.md#installation)?

apt install pkg-config

@stalker314314
Copy link
Contributor

Unfortunately, @goodspb (author) is unavailable. I am discussing with @matiasdelellis to fork this and continue from there.

@Claudio140
Copy link

I found the problem: pkg-config was looking in the wrong places. Setting PKG_CONFIG_PATH=/dlib-install/usr/local/lib64/pkgconfig/ before running ./configure solves this.

Sadly, this did not help for me. I use a Fedora server which only has pkgconf package, not pkg-config, but these two should basically be the same. What can I do?

@eliliam
Copy link

eliliam commented Jan 29, 2020

+1 on my end. Ubuntu 18.04 server and I have pkg-config installed from apt(I have actually used it from the cli myself, so I know it works) but configure says it is not found.

@agboom
Copy link
Author

agboom commented Jan 29, 2020

PKG_CONFIG_PATH=/dlib-install/usr/local/lib64/pkgconfig/ was pretty specific for my system. Did you find out where the pkgconfig directory was located on your system?

@Claudio140
Copy link

I found it, seems like I'm simply not used to non-default paths. Thanks for your hint. It was in /usr/local/lib64/pkgconfig

@hdp2101
Copy link

hdp2101 commented May 12, 2020

Hello

I found the pkgconfig as you showed the location, but can you tell me where to change this path of pkgconfig. still i see same error of pkg-config not found after i type PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig/ in terminal and when i run ./configure command.

If possible please give some idea about this error.

Thank you
Ashampoo_Snap_2020 05 12_15h51m00s_001_

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants