[CMake] [vtk-developers] python, postgreSQL, VTK build

Darren Weber darren.weber.lists at gmail.com
Fri Aug 29 16:39:54 EDT 2008


For my install of PGSQL, I had to build pqxx from source and I have the
following libraries:

[ dweber at elegans ~/src/kitware/VTK_build ]$ ls /Library/PostgreSQL/8.3/lib/
libecpg.6.0.dylib*  libecpg.dylib@             libecpg_compat.a
libpgtypes.3.0.dylib*  libpgtypes.dylib@  libpq.a
libecpg.6.dylib@    libecpg_compat.3.0.dylib*  libecpg_compat.dylib@
libpgtypes.3.dylib@    libpq.5.1.dylib*   libpq.dylib@
libecpg.a           libecpg_compat.3.dylib@    libpgport.a
libpgtypes.a           libpq.5.dylib@     postgresql/
[ dweber at elegans ~/src/kitware/VTK_build ]$
[ dweber at elegans ~/src/kitware/VTK_build ]$ ls /usr/local/lib/libpqxx*
/usr/local/lib/libpqxx-3.0.0.dylib*  /usr/local/lib/libpqxx.a
/usr/local/lib/libpqxx.dylib@  /usr/local/lib/libpqxx.la*
[ dweber at elegans ~/src/kitware/VTK_build ]$


This is what I see for a VTK-5-2 checkout in VTK/IO/CMakeLists.txt (just the
PGSQL section):

#-----------------------------------------------------------------------------
# PostgreSQL
# build the PostgreSQL database backend (if the PostgresSQL and pqxx
libraries are available)
#
OPTION( VTK_USE_POSTGRES "Build the PostgreSQL driver for vtkSQLDatabase."
OFF)
MARK_AS_ADVANCED(VTK_USE_POSTGRES)
IF ( VTK_USE_POSTGRES )
  FIND_PACKAGE( PQXX REQUIRED )
  IF ( BUILD_TESTING )
    SET ( VTK_PSQL_TEST_URL "" CACHE STRING "A URL for a PostgreSQL server
of the form psql://[[username[:password]@]hostname[:port]]/[dbname]" )
  ENDIF ( BUILD_TESTING )
ENDIF ( VTK_USE_POSTGRES )
#
# Only include the Postgres backend if the user has explicitly turned on
# VTK_USE_POSTGRES. If so, user must also have set POSTGRES_LIBRARIES
# and POSTGRES_INCLUDE_DIRECTORIES to valid values.
IF ( VTK_USE_POSTGRES AND PQXX_FOUND )
  INCLUDE_DIRECTORIES( ${PQXX_INCLUDE_DIRECTORIES} )
  SET( Kit_SRCS
    ${Kit_SRCS}
    vtkPostgreSQLDatabase.cxx
    vtkPostgreSQLQuery.cxx
  )
  LINK_LIBRARIES( ${PQXX_LIBRARIES} )
ENDIF ( VTK_USE_POSTGRES AND PQXX_FOUND )

#-----------------------------------------------------------------------------


So I changed the LINK_LIBRARIES as suggested and I'm running ccmake in the
same build (I don't want to scrap it and lose the cache completely, it has a
lot of settings that I need).  So now ccmake is finding:

PQXX_HEADER_PATH /usr/local/include
PQXX_LIBRARY
/usr/local/lib/libpqxx.dylib

PQXX_INCLUDE_DIRECTORIES         /usr/local/include
PQXX_LIBRARIES                   /usr/local/lib/libpqxx.dylib

POSTGRES_INCLUDE_DIRECTORIES
/opt/local/include/postgresql83

POSTGRES_LIBRARIES
/opt/local/lib/postgresql83


In my case, I first installed PGSQL with macports and then removed it using
macports.  So, ccmake has a stale entry that is not updated when I run it
again.  I should probably scrap this build directory and start again.  Maybe
there is a way to ensure ccmake double-checks the cache entries?  That might
be easier, because a lot of this build is already done.  It should be
finding the /Library/PostgreSQL/ path, which is what I used to build the
pqxx library (there was no pqxx in macports).

So, I've tried to manually change the POSTGRES* paths to:

POSTGRES_INCLUDE_DIRECTORIES /Library/PostgreSQL/8.3/include
POSTGRES_LIBRARIES /Library/PostgreSQL/8.3/lib

However, I got a stack of warnings at the end of the generation (for most
vtk components):

WARNING: Target "vtkIO" requests linking to directory
"/Library/PostgreSQL/8.3/lib".  Targets may link only to libraries.  CMake
is dropping the entry.


So then I set all the PGSQL and PQXX paths to an empty value and I toggled
off and on VTK_USE_POSTGRESQL and it came back with:

PQXX NOT FOUND

and the PGSQL paths remained empty.  I'm stumbling around in the dark :-(

Thanks!







On Fri, Aug 29, 2008 at 12:57 PM, David Cole <david.cole at kitware.com> wrote:

> As David Thompson rightfully pointed out, we should not be using
> LINK_LIBRARIES in VTK's CMakeLists.txt files.
> Change the LINK_LIBRARIES statement in VTK/IO/CMakeLists.txt to:
>     SET(KIT_LIBS ${KIT_LIBS} ${POSTGRES_LIBRARIES})
>
> and make sure that POSTGRES_LIBRARIES has the full path to pq in it, and it
> should work.
>
> Let us know if it works, and we will commit that change to CVS HEAD in VTK.
>
>
> Thanks,
> David Cole
>
>
> On Fri, Aug 29, 2008 at 3:51 PM, Darren Weber <
> darren.weber.lists at gmail.com> wrote:
>
>>
>> I had some choices on how to install MySQL and PostgreSQL on OS X (Leopard
>> Server, in my case).  There is a "default" install of MySQL for Leopard
>> server, but it had no development libraries that I could find.  There was no
>> default install of PostgreSQL.  I first tried macports, but I found some
>> problems with those installations (can't recall the details now).  I moved
>> to install binaries from the main web sites for both MySQL and PostgreSQL.
>> Those binary installs mostly take care of a few configuration issues
>> (although there are some startup and symlink issues for MySQL; I had to
>> create symlinks in /usr/bin to point to /usr/local/mysql/bin;
>> /usr/local/mysql is a symlink to /usr/local/mysql-<version>).  The
>> PostgreSQL installs into /Library/PostgreSQL/<version>/*
>>
>> I started looking into dyld, but I'm not sure that's the problem here.
>>
>> Is there a way I can run just the cmake utility that should find these
>> libraries?  I noticed in the ccmake curses interface that the libraries were
>> found or I just entered the "right" path values.  I'll double check that.
>>
>> Thanks!
>>
>>
>>
>> On Fri, Aug 29, 2008 at 12:24 PM, David Thompson <dcthomp at sandia.gov>wrote:
>>
>>> On Fri, 2008-08-29 at 11:58 -0600, David Cole wrote:
>>> > Nevertheless, you should at least be able to link to it if you specify
>>> > the full path to the library. Where is the CMake code that does
>>> > TARGET_LINK_LIBRARIES for this lib?
>>>
>>> The PostgreSQL library is located with this script:
>>>   VTK/CMake/FindPOSTGRES.cmake
>>> and a call to LINK_LIBRARIES is made here:
>>>   VTK/IO/CMakeLists.txt
>>> if PostgreSQL is turned on. Interestingly, LINK_LIBRARIES is used
>>> instead of TARGET_LINK_LIBRARIES. Perhaps that should be changed to
>>> TARGET_LINK_LIBRARIES (both for PostgreSQL and MySQL)? Also, perhaps on
>>> MacOS X there are some dependent libraries required that are not being
>>> located? The FindPOSTGRES.cmake script doesn't look for any, so if zlib
>>> or any ssl libraries are required that might cause trouble in the case
>>> where libpq is static.
>>>
>>>        David
>>>
>>> >  Do we use FIND_LIBRARY to get this lib path when linking to it or
>>> > what?
>>> >
>>> >
>>> > Is there a Postgres SQL VTK developer out there?
>>>
>>> >
>>> >
>>> >
>>> > 2008/8/29 Darren Weber <darren.weber.lists at gmail.com>
>>> >
>>> >         For the record, there's some useful information on OS X
>>> >         library paths in
>>> >         'man dyld'
>>> >
>>> >         I assume the binary install of postgreSQL is not adding to one
>>> >         of these path settings.
>>> >
>>> >
>>> >
>>> >
>>> >         On Fri, Aug 29, 2008 at 8:47 AM, Darren Weber
>>> >         <darren.weber.lists at gmail.com> wrote:
>>> >
>>> >                 I've got a link error when building VTK on OSX.  I've
>>> >                 enabled postgresql and python wrapping.
>>> >
>>> >                 [ 73%] Built target vtk
>>> >                 Scanning dependencies of target vtkpython
>>> >                 [ 73%] Building CXX object
>>> >
>>> Wrapping/Python/CMakeFiles/vtkpython.dir/vtkPythonAppInit.o
>>> >                 Linking CXX executable ../../bin/vtkpython
>>> >                 ld: file not found: libpq.5.dylib
>>> >                 collect2: ld returned 1 exit status
>>> >                 make[2]: *** [bin/vtkpython] Error 1
>>> >                 make[1]: ***
>>> >                 [Wrapping/Python/CMakeFiles/vtkpython.dir/all] Error 2
>>> >                 make: *** [all] Error 2
>>> >
>>> >
>>> >                 I've used the binary installer for postgresql, which
>>> >                 goes into /Library/PostgreSQL/8.3/*
>>> >
>>> >                 [ dweber at elegans ~/src/kitware/VTK_build ]$
>>> >                 ls /Library/PostgreSQL/8.3/lib/
>>> >                 libecpg.6.0.dylib*  libecpg.dylib@
>>> >                 libecpg_compat.a       libpgtypes.3.0.dylib*
>>> >                 libpgtypes.dylib@  libpq.a
>>> >                 libecpg.6.dylib@    libecpg_compat.3.0.dylib*
>>> >                 libecpg_compat.dylib@  libpgtypes.3.dylib@
>>> >                 libpq.5.1.dylib*   libpq.dylib@
>>> >                 libecpg.a           libecpg_compat.3.dylib@
>>> >                 libpgport.a            libpgtypes.a
>>> >                 libpq.5.dylib@     postgresql/
>>> >                 [ dweber at elegans ~/src/kitware/VTK_build ]$
>>> >
>>> >
>>> >                 Is this a simple problem of loading up an LD path or
>>> >                 something so the build can find it?  What's the best
>>> >                 way to do this on OSX?
>>> >
>>> >                 Thanks, Darren
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >         _______________________________________________
>>> >         vtk-developers mailing list
>>> >         vtk-developers at vtk.org
>>> >         http://www.vtk.org/mailman/listinfo/vtk-developers
>>> >
>>> >
>>> >
>>>
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20080829/83ccd383/attachment-0001.htm>


More information about the CMake mailing list