#12 Compiling pxview with a custom-built pxlib fails

open
nobody
None
5
2012-09-16
2012-09-16
Zoltan P
No

Hi,

when compiling pxview with a pxlib that has been installed to a nonstandard location, the configure script fails because it is not able to find pxlib. The source of the problem is that in the configure script the math library is not linked to the test executable, hence building fails, but the error message is wrong. A proper fix would be to link the math library (-lm) to the tests of configure.
A workaround is to set the LIBS variable to "-lm" when running the configure script.

Example:

~/Desktop/profoto-dump/pxview-0.2.5$ ./configure --with-pxlib=/home/zoltanp/Desktop/profoto-dump/pxview-0.2.5/../pxlib

checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
....
checking for localtime... yes
checking for PX_timestamp2string in -lpx... no
configure: error: libpx not found. You will need at least libpx 0.4.4

contents of config.log:

configure:23041: checking for PX_timestamp2string in -lpx
configure:23071: gcc -o conftest -g -O2 conftest.c -lpx -L/home/zoltanp/Desktop/profoto-dump/pxview-0.2.5/../pxlib/lib >&5
/home/zoltanp/Desktop/profoto-dump/pxview-0.2.5/../pxlib/lib/libpx.so: undefined reference to `fmod'
collect2: ld returned 1 exit status
configure:23077: $? = 1
configure: failed program was:
| /* confdefs.h. */
|
| #define PACKAGE_NAME "pxview"
| #define PACKAGE_TARNAME "pxview"
| #define PACKAGE_VERSION "0.2.5"
....
| /* Override any gcc2 internal prototype to avoid an error. */
| #ifdef __cplusplus
| extern "C"
| #endif
| /* We use char because int might match the return type of a gcc2
| builtin and then its argument prototype would still apply. */
| char PX_timestamp2string ();
| int
| main ()
| {
| PX_timestamp2string ();
| ;
| return 0;
| }
configure:23102: result: no
configure:23107: error: libpx not found. You will need at least libpx 0.4.4

As it can be seen, the missing function is "fmod". This function is located in the math library (-lm).

Workaround is:

$ LIBS=-lm ./configure --with-pxlib=/home/zoltanp/Desktop/profoto-dump/pxview-0.2.5/../pxlib

In this case confgure finishes correctly.

Discussion


Log in to post a comment.