timmerk / libfreefare

Automatically exported from code.google.com/p/libfreefare
Other
0 stars 0 forks source link

./configure --prefix=/usr Fails on Raspberry Pi due to missing pkg-config #30

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Fresh Arch Linux on RPI SD Card as root

wget https://libfreefare.googlecode.com/files/libfreefare-0.4.0.tar.bz2
wget https://libnfc.googlecode.com/files/libnfc-1.7.0.tar.bz2
tar xvjf libnfc-1.7.0.tar.bz2
tar xvjf libfreefare-0.4.0.tar.bz2

cd libnfc-1.7.0
./configure --prefix=/usr
make
make install
cd ..

cd libfreefare-0.4.0
./configure --prefix=/usr

What is the expected output? What do you see instead?
I see: libnfc >= 1.7.0 is mandatory
but libnfc is correctly installed!
I expect to see successful ./configure 

What version of the product are you using? On what operating system?
Raspberry Pi version B 512MB RAM, Arch Linux
Linux alarmpi 3.12.23-1-ARCH #1 PREEMPT Fri Jun 27 01:32:04 MDT 2014 armv6l 
GNU/Linux

Please provide any additional information below.
The error is caused by PKG_CHECK_MODULES macro in configure.ac which returns 
invalid output. 
PKG_CHECK_MODULES returns correct output when pkg-config is installed.
i.e. pacman -S pkg-config

This is really annoying error, it took me a few hours to figure out what's 
wrong.

Original issue reported on code.google.com by tilo...@gmail.com on 3 Jul 2014 at 5:45

GoogleCodeExporter commented 9 years ago
"If you look through the autoconf mailing list archive, you will see this 
debated ad-nauseum. I'm not saying that you should avoid using pkg-config 
(although I do believe it is best to do so), but please be aware that many 
people to recommend avoiding it completely."
http://stackoverflow.com/questions/8578181/using-the-pkg-config-macro-pkg-check-
modules-failing

Please replace pkg-config with something else.

Original comment by tilo...@gmail.com on 3 Jul 2014 at 5:51

GoogleCodeExporter commented 9 years ago
I search the documentation and it looks like it is not easy to make ./configure 
fail with a clear message when pkg-config is not found (using 
PKG_PROG_PKG_CONFIG).

In the ./configure output you had:
checking for pkg-config... no
checking for LIBNFC... no
configure: error: libnfc >= 1.7.0 is mandatory.

I agree it is not obvious that the line "checking for pkg-config... no" is 
important.

If you have a better solution than pkg-config please provide it.

Original comment by ludovic....@gmail.com on 4 Jul 2014 at 3:57

GoogleCodeExporter commented 9 years ago
Yes

Here you are
http://stackoverflow.com/questions/592620/how-to-check-if-a-program-exists-from-
a-bash-script

$ command -v pkg-config >/dev/null 2>&1 || { echo >&2 "I require foo but it's 
not installed.  Aborting."; exit 1; }
OR
$ type pkg-config >/dev/null 2>&1 || { echo >&2 "I require foo but it's not 
installed.  Aborting."; exit 1; }
OR
$ hash pkg-config 2>/dev/null || { echo >&2 "I require foo but it's not 
installed.  Aborting."; exit 1; }

Many thanks

Original comment by tilo...@gmail.com on 4 Jul 2014 at 5:52

GoogleCodeExporter commented 9 years ago
I propose the attach patch.

It would be better to not fail if libnfc is not found by pkg-config and try to 
link with libnfc using $LIBNFC_LIBS and only fail if nothing works. This is 
what I do for PCSC in my CCID driver for example.

Original comment by ludovic....@gmail.com on 6 Jul 2014 at 4:59

Attachments:

GoogleCodeExporter commented 9 years ago
Output WITHOUT pkg-config installed:

checking for pkg-config... no
checking for LIBNFC... no
configure: error: libnfc >= 1.7.0 is mandatory.
Does not work. 

Bear in mind that "set | grep pkg" does not return anything even after 
pkg-config installation. Checking for path variable is not reliable in this 
case. 

Original comment by tilo...@gmail.com on 6 Jul 2014 at 7:58

GoogleCodeExporter commented 9 years ago
I would suggest using the:
command -v pkg-config >/dev/null 2>&1 || { echo >&2 "I require pkg-config but 
it's not installed.  Aborting."; exit 1; }

Original comment by tilo...@gmail.com on 6 Jul 2014 at 8:18

GoogleCodeExporter commented 9 years ago
For your comment #5 I guess you have not applied my proposed patch or you have 
not regenerated the ./configure script.

Original comment by ludovic....@gmail.com on 7 Jul 2014 at 7:27

GoogleCodeExporter commented 9 years ago
Yes you are right. Sorry for that.

The output without pkg-config is:
checking openssl/rand.h usability... yes
checking openssl/rand.h presence... yes
checking for openssl/rand.h... yes
checking for pkg-configx... no
configure: error: Please install pkg-config

:) Works

Original comment by tilo...@gmail.com on 7 Jul 2014 at 11:02

GoogleCodeExporter commented 9 years ago
Does not work. I installed pkg-config and output is:

checking openssl/rand.h usability... yes
checking openssl/rand.h presence... yes
checking for openssl/rand.h... yes
checking for pkg-configx... no
configure: error: Please install pkg-config
[root@alarmpi libfreefare-0.4.0]# pkg-config
Must specify package names on the command line

Original comment by tilo...@gmail.com on 7 Jul 2014 at 11:08

GoogleCodeExporter commented 9 years ago
This is output of set command on my system with pkg-config installed:

[root@alarmpi libfreefare-0.4.0]# set
BASH=/bin/bash
BASHOPTS=cmdhist:complete_fullquote:expand_aliases:extquote:force_fignore:hostco
mplete:interactive_comments:login_shell:progcomp:promptvars:sourcepath
BASH_ALIASES=()
BASH_ARGC=()
BASH_ARGV=()
BASH_CMDS=()
BASH_LINENO=()
BASH_SOURCE=()
BASH_VERSINFO=([0]="4" [1]="3" [2]="18" [3]="1" [4]="release" 
[5]="armv6l-unknown-linux-gnueabihf")
BASH_VERSION='4.3.18(1)-release'
COLUMNS=127
DIRSTACK=()
EUID=0
GROUPS=()
HISTFILE=/root/.bash_history
HISTFILESIZE=500
HISTSIZE=500
HOME=/root
HOSTNAME=alarmpi
HOSTTYPE=armv6l
IFS=$' \t\n'
LANG=C
LINES=44
LOGNAME=root
MACHTYPE=armv6l-unknown-linux-gnueabihf
MAIL=/var/spool/mail/root
MAILCHECK=60
OLDPWD=/root
OPTERR=1
OPTIND=1
OSTYPE=linux-gnueabihf
PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/core_perl
PIPESTATUS=([0]="1")
PPID=328
PROMPT_COMMAND='printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" 
"${PWD/#$HOME/\~}"'
PS1='[\u@\h \W]\$ '
PS2='> '
PS3='> '
PS4='+ '
PWD=/root/libfreefare-0.4.0
SHELL=/bin/bash
SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:moni
tor
SHLVL=1
SSH_CLIENT='192.168.0.2 8741 22'
SSH_CONNECTION='192.168.0.2 8741 192.168.0.7 22'
SSH_TTY=/dev/pts/0
TERM=xterm
UID=0
USER=root
XDG_RUNTIME_DIR=/run/user/0
XDG_SESSION_ID=c1
_=--prefix=/usr

Original comment by tilo...@gmail.com on 7 Jul 2014 at 11:19

GoogleCodeExporter commented 9 years ago
My patch is bogus. Replace "pkg-configx" by "pkg-config"

Original comment by ludovic....@gmail.com on 7 Jul 2014 at 11:52

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I tried that but it didn't work either. 

[root@alarmpi ~]# pkg-config --version
0.28
[root@alarmpi ~]# whereis pkg-config
pkg-config: /usr/bin/pkg-config /usr/share/man/man1/pkg-config.1.gz
[root@alarmpi ~]# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/core_perl

configure.ac line 61 changed to <<AC_CHECK_PROG(PKG_CONFIG, pkg-config)>>

[root@alarmpi libfreefare-0.4.0]# autoconf configure.ac > configure
[root@alarmpi libfreefare-0.4.0]# ./configure --prefix=/usr
... snip ...
checking for pkg-config... no
configure: error: Please install pkg-config

Original comment by tilo...@gmail.com on 7 Jul 2014 at 12:14

GoogleCodeExporter commented 9 years ago
Wrong patch again. Try with the attached one.

Original comment by ludovic....@gmail.com on 9 Jul 2014 at 10:21

Attachments: