[Freeswitch-users] configure fails to find libpq

Steven Ayre steveayre at gmail.com
Fri Jun 14 13:58:08 MSD 2013


Looks to me like a bug in configure.in...

427: AC_CHECK_LIB([pq], [PQgetvalue],, AC_MSG_ERROR([no usable libpq;
please install PostgreSQL devel package or equivalent]))

Is the test whether it can link to libpq by checking if the PQgetvalue
function is available, problem is it doesn't seem to use the pg_config
values. So on a system like yours where libpq is installing to somewhere
other than the main lib directories it's unable to detect the libary.

File a Jira to track this if you haven't already done so.

-Steve


On 14 June 2013 15:35, Claus Andersen <clan at wheel.dk> wrote:

> On Thu, 13 Jun 2013, Steven Ayre wrote:
>
>  To answer your question of what the test is doing, it'll take the
>> required flags/libs from pg_config (which it
>> looks like it found) and then try compiling a tiny program linking to it
>> to check if the library exists and when
>> testing functions if that function is exported by that version of the
>> library. Any compile error means 'no'.
>> That ac_ variable is checking if its 'set' which'd mean the test passed.
>> Config.log will show all the tests
>> being run and any error output for them.
>> -Steve
>>
>
> Thank you very much. Most helpful!
>
> I had only tail'ed config.log and further up I found:
>
> configure:19550: checking for PostgreSQL libraries
> configure:19584: checking for PQgetvalue in -lpq
> configure:19619: gcc -o conftest -g -O2   conftest.c -lpq  -lodbc  >&5
> /usr/bin/ld: cannot find -lpq
> collect2: ld returned 1 exit status
> configure:19626: $? = 1
>
> So the linker is not able to find and include the library. The empty
> spaces after -O2 and -lpq might indicate that some empty variables might
> have been inserted.
>
>  From configure I know that we can find pg_config:
>>
>
> checking for pg_config... /usr/pgsql-9.2/bin/pg_config
> checking for PostgreSQL libraries... checking for PQgetvalue in -lpq... no
> configure: error: no usable libpq; please install PostgreSQL devel package
> or equivalent
>
> And from the shell I know I get the proper path:
> $ pg_config --libdir
> /usr/pgsql-9.2/lib
>
> And from the configure script it looks like the correct parameter is used:
> POSTGRESQL_LDFLAGS="`$PG_**CONFIG --ldflags` -L`$PG_CONFIG --libdir` -lpq"
>
> It looks like these flags are not passed to gcc/ld when linking conftest.c
>
> My conclusion is then that pg_config is found and the correct options and
> path are extracted but they are not used (ignored?) during testing. Or if
> they should be used - something even more serious is wrong.
>
> If that conclusion is correct I will file a Jira. The fix should be
> trivial for people in the know. I cannot determine whether the libdir
> should be added during the test. Or if pg_config should be ignored
> completely and replaced with a simple -with-pgsql-lib=dir.
>
> If I set LDFLAGS before I do a configure it works:
> $ LDFLAGS="${LDFLAGS} -L/usr/pgsql-9.2/lib"
> $ export LDFLAGS
> $./configure --enable-core-pgsql-support
>
> Configure then runs smoothly. Make does however fail but that is another
> issue I'll put in a seperate thread.
>
> With LDFLAGS set the relevant part of config.log now looks like this:
> configure:19604: checking for PQgetvalue in -lpq
> configure:19639: gcc -o conftest -g -O2   -L/usr/pgsql-9.2/lib conftest.c
> -lpq  -lodbc  >&5
> configure:19646: $? = 0
> configure:19667: result: yes
>
> Do you agree that this is a "proper" issue?
>
> Kind Regards,
> Claus Andersen
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> 
> 
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
>
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20130614/465a8cca/attachment-0001.html 


Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list