<div dir="ltr">Set POSTGRES_LIBRARIES to the full path to the pq dylib...<div><br><br><div class="gmail_quote">On Fri, Aug 29, 2008 at 4:39 PM, Darren Weber <span dir="ltr"><<a href="mailto:darren.weber.lists@gmail.com">darren.weber.lists@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div dir="ltr"><br>For my install of PGSQL, I had to build pqxx from source and I have the following libraries:<div class="Ih2E3d">
<br><br>[ dweber@elegans ~/src/kitware/VTK_build ]$ ls /Library/PostgreSQL/8.3/lib/<br>libecpg.6.0.dylib*  libecpg.dylib@             libecpg_compat.a       libpgtypes.3.0.dylib*  libpgtypes.dylib@  libpq.a<br>
libecpg.6.dylib@    libecpg_compat.3.0.dylib*  libecpg_compat.dylib@  libpgtypes.3.dylib@    libpq.5.1.dylib*   libpq.dylib@<br>libecpg.a           libecpg_compat.3.dylib@    libpgport.a            libpgtypes.a           libpq.5.dylib@     postgresql/<br>

[ dweber@elegans ~/src/kitware/VTK_build ]$ <br></div>[ dweber@elegans ~/src/kitware/VTK_build ]$ ls /usr/local/lib/libpqxx*<br>/usr/local/lib/libpqxx-3.0.0.dylib*  /usr/local/lib/libpqxx.a  /usr/local/lib/libpqxx.dylib@  /usr/local/lib/<a href="http://libpqxx.la" target="_blank">libpqxx.la</a>*<div class="Ih2E3d">
<br>
[ dweber@elegans ~/src/kitware/VTK_build ]$ <br><br><br></div>This is what I see for a VTK-5-2 checkout in VTK/IO/CMakeLists.txt (just the PGSQL section):<br><br>#-----------------------------------------------------------------------------<br>

# PostgreSQL<br># build the PostgreSQL database backend (if the PostgresSQL and pqxx libraries are available)<br>#<br>OPTION( VTK_USE_POSTGRES "Build the PostgreSQL driver for vtkSQLDatabase." OFF)<br>MARK_AS_ADVANCED(VTK_USE_POSTGRES)<br>

IF ( VTK_USE_POSTGRES )<br>  FIND_PACKAGE( PQXX REQUIRED )<br>  IF ( BUILD_TESTING )<br>    SET ( VTK_PSQL_TEST_URL "" CACHE STRING "A URL for a PostgreSQL server of the form psql://[[username[:password]@]hostname[:port]]/[dbname]" ) <br>

  ENDIF ( BUILD_TESTING )<br>ENDIF ( VTK_USE_POSTGRES )<br>#<br># Only include the Postgres backend if the user has explicitly turned on<br># VTK_USE_POSTGRES. If so, user must also have set POSTGRES_LIBRARIES<br># and POSTGRES_INCLUDE_DIRECTORIES to valid values.<br>

IF ( VTK_USE_POSTGRES AND PQXX_FOUND )<br>  INCLUDE_DIRECTORIES( ${PQXX_INCLUDE_DIRECTORIES} )<br>  SET( Kit_SRCS<br>    ${Kit_SRCS}<br>    vtkPostgreSQLDatabase.cxx<br>    vtkPostgreSQLQuery.cxx<br>  )<br>  LINK_LIBRARIES( ${PQXX_LIBRARIES} )<br>

ENDIF ( VTK_USE_POSTGRES AND PQXX_FOUND )<br><br>#-----------------------------------------------------------------------------<br><br><br>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:<br>

<br>PQXX_HEADER_PATH /usr/local/include<br>PQXX_LIBRARY /usr/local/lib/libpqxx.dylib                                                                                     <br>PQXX_INCLUDE_DIRECTORIES         /usr/local/include<br>


PQXX_LIBRARIES                   /usr/local/lib/libpqxx.dylib<br> 
 <br>POSTGRES_INCLUDE_DIRECTORIES     /opt/local/include/postgresql83                                                                                  <br>POSTGRES_LIBRARIES               /opt/local/lib/postgresql83                                                                                      <br>

<br>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).<br>

<br>So, I've tried to manually change the POSTGRES* paths to:<br><br>POSTGRES_INCLUDE_DIRECTORIES /Library/PostgreSQL/8.3/include<br>
POSTGRES_LIBRARIES /Library/PostgreSQL/8.3/lib<br><br>However, I got a stack of warnings at the end of the generation (for most vtk components):<br><br>WARNING: Target "vtkIO" requests linking to directory "/Library/PostgreSQL/8.3/lib".  Targets may link only to libraries.  CMake is dropping the entry.<br>

<br><br>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:<br><br>PQXX NOT FOUND<br><br>and the PGSQL paths remained empty.  I'm stumbling around in the dark :-(<br>

<br>Thanks!<div><div></div><div class="Wj3C7c"><br><br><br><br><br><br><br><br><div class="gmail_quote">On Fri, Aug 29, 2008 at 12:57 PM, David Cole <span dir="ltr"><<a href="mailto:david.cole@kitware.com" target="_blank">david.cole@kitware.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex"><div dir="ltr">As David Thompson rightfully pointed out, we should not be using LINK_LIBRARIES in VTK's CMakeLists.txt files.<div>

<br></div><div>Change the LINK_LIBRARIES statement in VTK/IO/CMakeLists.txt to:</div><div>
<div>    SET(KIT_LIBS ${KIT_LIBS} ${POSTGRES_LIBRARIES})</div><div><br></div><div>and make sure that POSTGRES_LIBRARIES has the full path to pq in it, and it should work.</div><div><br></div><div>Let us know if it works, and we will commit that change to CVS HEAD in VTK.</div>


<div><br></div><div><br></div><div>Thanks,</div><div>David Cole</div><div><div></div><div><div><br></div><div><br></div><div class="gmail_quote">On Fri, Aug 29, 2008 at 3:51 PM, Darren Weber <span dir="ltr"><<a href="mailto:darren.weber.lists@gmail.com" target="_blank">darren.weber.lists@gmail.com</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex"><div dir="ltr"><br>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>/*<br>



<br>I started looking into dyld, but I'm not sure that's the problem here.<br><br>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.<br>



<br>Thanks!<div><div></div><div><br><br><br><div class="gmail_quote">On Fri, Aug 29, 2008 at 12:24 PM, David Thompson <span dir="ltr"><<a href="mailto:dcthomp@sandia.gov" target="_blank">dcthomp@sandia.gov</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">
<div>On Fri, 2008-08-29 at 11:58 -0600, David Cole wrote:<br>
> Nevertheless, you should at least be able to link to it if you specify<br>
> the full path to the library. Where is the CMake code that does<br>
> TARGET_LINK_LIBRARIES for this lib?<br>
<br>
</div>The PostgreSQL library is located with this script:<br>
   VTK/CMake/FindPOSTGRES.cmake<br>
and a call to LINK_LIBRARIES is made here:<br>
   VTK/IO/CMakeLists.txt<br>
if PostgreSQL is turned on. Interestingly, LINK_LIBRARIES is used<br>
instead of TARGET_LINK_LIBRARIES. Perhaps that should be changed to<br>
TARGET_LINK_LIBRARIES (both for PostgreSQL and MySQL)? Also, perhaps on<br>
MacOS X there are some dependent libraries required that are not being<br>
located? The FindPOSTGRES.cmake script doesn't look for any, so if zlib<br>
or any ssl libraries are required that might cause trouble in the case<br>
where libpq is static.<br>
<font color="#888888"><br>
        David<br>
</font><div><div></div><div><br>
>  Do we use FIND_LIBRARY to get this lib path when linking to it or<br>
> what?<br>
><br>
><br>
> Is there a Postgres SQL VTK developer out there?<br>
<br>
><br>
><br>
><br>
> 2008/8/29 Darren Weber <<a href="mailto:darren.weber.lists@gmail.com" target="_blank">darren.weber.lists@gmail.com</a>><br>
><br>
>         For the record, there's some useful information on OS X<br>
>         library paths in<br>
>         'man dyld'<br>
><br>
>         I assume the binary install of postgreSQL is not adding to one<br>
>         of these path settings.<br>
><br>
><br>
><br>
><br>
>         On Fri, Aug 29, 2008 at 8:47 AM, Darren Weber<br>
>         <<a href="mailto:darren.weber.lists@gmail.com" target="_blank">darren.weber.lists@gmail.com</a>> wrote:<br>
><br>
>                 I've got a link error when building VTK on OSX.  I've<br>
>                 enabled postgresql and python wrapping.<br>
><br>
>                 [ 73%] Built target vtk<br>
>                 Scanning dependencies of target vtkpython<br>
>                 [ 73%] Building CXX object<br>
>                 Wrapping/Python/CMakeFiles/vtkpython.dir/vtkPythonAppInit.o<br>
>                 Linking CXX executable ../../bin/vtkpython<br>
>                 ld: file not found: libpq.5.dylib<br>
>                 collect2: ld returned 1 exit status<br>
>                 make[2]: *** [bin/vtkpython] Error 1<br>
>                 make[1]: ***<br>
>                 [Wrapping/Python/CMakeFiles/vtkpython.dir/all] Error 2<br>
>                 make: *** [all] Error 2<br>
><br>
><br>
>                 I've used the binary installer for postgresql, which<br>
>                 goes into /Library/PostgreSQL/8.3/*<br>
><br>
>                 [ dweber@elegans ~/src/kitware/VTK_build ]$<br>
>                 ls /Library/PostgreSQL/8.3/lib/<br>
>                 libecpg.6.0.dylib*  libecpg.dylib@<br>
>                 libecpg_compat.a       libpgtypes.3.0.dylib*<br>
>                 libpgtypes.dylib@  libpq.a<br>
>                 libecpg.6.dylib@    libecpg_compat.3.0.dylib*<br>
>                 libecpg_compat.dylib@  libpgtypes.3.dylib@<br>
>                 libpq.5.1.dylib*   libpq.dylib@<br>
>                 libecpg.a           libecpg_compat.3.dylib@<br>
>                 libpgport.a            libpgtypes.a<br>
>                 libpq.5.dylib@     postgresql/<br>
>                 [ dweber@elegans ~/src/kitware/VTK_build ]$<br>
><br>
><br>
>                 Is this a simple problem of loading up an LD path or<br>
>                 something so the build can find it?  What's the best<br>
>                 way to do this on OSX?<br>
><br>
>                 Thanks, Darren<br>
><br>
><br>
><br>
><br>
><br>
>         _______________________________________________<br>
>         vtk-developers mailing list<br>
>         <a href="mailto:vtk-developers@vtk.org" target="_blank">vtk-developers@vtk.org</a><br>
>         <a href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
><br>
><br>
><br>
<br>
<br>
</div></div></blockquote></div><br></div></div></div>
</blockquote></div><br></div></div></div></div>
</blockquote></div><br></div></div></div>
</blockquote></div><br></div></div>