[Insight-users] build of cableswig - how to specify the SWIG Lib directory?

Gaëtan Lehmann gaetan.lehmann at jouy.inra.fr
Sun May 17 16:15:00 EDT 2009


Hi Darren,

Could it be related to http://www.itk.org/Bug/view.php?id=6224 ?

Gaëtan


Le 16 mai 09 à 04:32, Darren Weber a écrit :

>
> Hi Luis,
>
> Thanks for pointing out the tutorial, nice tip.  I do have a  
> successful build, but it seems that I need something more than a  
> vanilla build and install.  I apologize in advance for this long  
> email, but there's no other way than this to explain the situation.   
> I may need a patch to somehow change how the cswig binary finds the  
> SWIGLib directory.
>
> I'm a registered MacPorts developer and my focus is on porting  
> kitware tools into the MacPorts system (see http:// 
> www.macports.org/).  I got involved in this so that I can document  
> the dependencies and the build configuration in a functional system  
> for OSX software distribution that will replicate a given  
> installation on any compatible OSX system, with MacPorts installed.
>
> In order to use MacPorts, all the configuration details are saved in  
> a Portfile in the MacPorts svn, i.e.:
> http://svn.macports.org/repository/macports/
>
> The Portfiles are pseudo tcl scripts.  The content is fairly easy to  
> read too, even if you don't know tcl.  For example, this is the  
> Portfile I've been working on for vtk 5.4.0:
> http://svn.macports.org/repository/macports/trunk/dports/graphics/vtk-devel/Portfile
> Similarly, this is the Portfile for itk 3.12.0 (still a work in  
> progress):
> http://svn.macports.org/repository/macports/trunk/dports/graphics/InsightToolkit/Portfile
> Also, here is a recent commit on a cableswig Portfile (a work in  
> progress):
> http://svn.macports.org/repository/macports/trunk/dports/devel/cableswig/Portfile
>
> One thing to understand about MacPorts is that all the configuration  
> and builds occur in a *temporary* workspace and the 'make install'  
> is directed to a *temporary* DESTDIR within the workspace.  Once all  
> the files are installed in the DESTDIR, the MacPorts system scans  
> and logs all the files, then "installs" them to a software  
> repository.  The final "activation" is actually a process of  
> hardlinks from the CMAKE_INSTALL_PATH to this software repository.   
> A library or application can be "deactivated" by simply removing the  
> hard links and it can be immediately re-activated by creating the  
> hard links again.  It's a neat system that includes dependency  
> resolution and it's sweet when it all works well.
>
> Note that the cmake variables have been updated to the following  
> (which must be defined using the command line cmake with -D options  
> for variables; ${prefix} is '/opt/local'):
>
> configure.args-append \
>     -DBISON_YACC:FILEPATH=${prefix}/bin/bison \
>     -DCMAKE_BUILD_TYPE:STRING=Release \
>     -DCMAKE_INSTALL_PREFIX:PATH=${prefix} \
>     -DCMAKE_OSX_SYSROOT=${universal_sysroot} \
>     -DCMAKE_SKIP_RPATH:BOOL=OFF \
>     -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
>     -DCSWIG_USE_SYSTEM_GCCXML:BOOL=ON \
>     -DSWIG_BUILD_EXAMPLES:BOOL=OFF \
>     -DBUILD_TESTING:BOOL=OFF
>
>
> Here's a summary of the build and installation to the DESTDIR  
> (everything works):
>
> [... snip the build details ...]
>
> Install the project...
> /opt/local/bin/cmake -P cmake_install.cmake
> -- Install configuration: "Release"
> -- Installing: /opt/local/var/macports/build/ 
> _Users_dweber_ports_devel_cableswig/work/destroot/opt/local/lib/ 
> CableSwig/CableSwigConfig.cmake
> -- Installing: /opt/local/var/macports/build/ 
> _Users_dweber_ports_devel_cableswig/work/destroot/opt/local/lib/ 
> CableSwig/SWIGLib/_std_deque.i
> ...[snip a few files]...
>
>
> [ dweber at X ~/ports/devel/cableswig ]$ ll work/destroot/opt/local/bin/
> total 1.8M
> -rwxr-xr-x 1 root admin 445K 2009-05-15 18:42 cableidx*
> -rwxr-xr-x 1 root admin 1.4M 2009-05-15 18:43 cswig*
>
> [ dweber at X ~/ports/devel/cableswig ]$ ll work/destroot/opt/local/lib/ 
> CableSwig/
> total 4.0K
> -rw-r--r--  1 root admin 314 2009-05-15 18:37 CableSwigConfig.cmake
> drwxr-xr-x 21 root admin 714 2009-05-15 18:43 SWIGLib/
> [ dweber at X ~/ports/devel/cableswig ]$ ll work/destroot/opt/local/lib/ 
> CableSwig/SWIGLib/
> total 96K
> -rw-r--r--  1 root admin 4.1K 2003-04-09 10:34 _std_deque.i
> -rw-r--r--  1 root admin  659 2004-02-18 06:45 allkw.swg
> -rw-r--r--  1 root admin 2.9K 2004-02-18 06:45 carrays.i
> -rw-r--r--  1 root admin 2.5K 2004-02-18 06:45 cdata.i
> -rw-r--r--  1 root admin 2.2K 2004-02-18 06:45 cmalloc.i
> -rw-r--r--  1 root admin 7.3K 2004-06-15 08:26 common.swg
> -rw-r--r--  1 root admin 6.2K 2003-04-09 10:34 constraints.i
> -rw-r--r--  1 root admin 3.6K 2004-02-18 06:45 cpointer.i
> -rw-r--r--  1 root admin   78 2003-04-09 10:34 cstring.i
> -rw-r--r--  1 root admin 8.6K 2004-02-18 06:45 exception.i
> drwxr-xr-x 14 root admin  476 2009-05-15 18:43 java/
> -rw-r--r--  1 root admin 2.0K 2004-02-18 06:45 math.i
> -rw-r--r--  1 root admin  115 2003-04-09 10:34 pointer.i
> drwxr-xr-x 33 root admin 1.1K 2009-05-15 18:43 python/
> -rw-r--r--  1 root admin  118 2003-04-09 10:34 std_deque.i
> -rw-r--r--  1 root admin  276 2004-02-18 06:45 stl.i
> -rw-r--r--  1 root admin  13K 2004-02-18 06:45 swig.swg
> -rw-r--r--  1 root admin   74 2004-02-18 06:45 swigrun.i
> drwxr-xr-x 15 root admin  510 2009-05-15 18:43 tcl/
>
>
>
> From here on, MacPorts takes over the "installation" and  
> "activation".   This is essentially a two step process: (a) the  
> entire installation is "installed" into a software repository in / 
> opt/local/var/macports/software/, then (b) the files in that  
> repository are "activated" by hard links to ${prefix} locations.   
> After that, the temporary build tree is removed, including the  
> DESTDIR.
>
>
> ####################BEGIN MACPORTS INSTALL and ACTIVATE
>
> [ dweber at X ~/ports/devel/cableswig ]$ sudo port -d install cableswig
>
> --->  Installing cableswig @20090514_0
> DEBUG: Executing org.macports.install (cableswig)
> DEBUG: installing directory: /opt/local/var/macports/software/ 
> cableswig/20090514_0/opt
> DEBUG: installing directory: /opt/local/var/macports/software/ 
> cableswig/20090514_0/opt/local
> DEBUG: installing directory: /opt/local/var/macports/software/ 
> cableswig/20090514_0/opt/local/bin
> DEBUG: installing file: /opt/local/var/macports/software/cableswig/ 
> 20090514_0/opt/local/bin/cableidx
> DEBUG: installing file: /opt/local/var/macports/software/cableswig/ 
> 20090514_0/opt/local/bin/cswig
> DEBUG: installing directory: /opt/local/var/macports/software/ 
> cableswig/20090514_0/opt/local/lib
> DEBUG: installing directory: /opt/local/var/macports/software/ 
> cableswig/20090514_0/opt/local/lib/CableSwig
> DEBUG: installing file: /opt/local/var/macports/software/cableswig/ 
> 20090514_0/opt/local/lib/CableSwig/CableSwigConfig.cmake
> DEBUG: installing directory: /opt/local/var/macports/software/ 
> cableswig/20090514_0/opt/local/lib/CableSwig/SWIGLib
> DEBUG: installing file: /opt/local/var/macports/software/cableswig/ 
> 20090514_0/opt/local/lib/CableSwig/SWIGLib/_std_deque.i
> DEBUG: installing file: /opt/local/var/macports/software/cableswig/ 
> 20090514_0/opt/local/lib/CableSwig/SWIGLib/allkw.swg
> DEBUG: installing file: /opt/local/var/macports/software/cableswig/ 
> 20090514_0/opt/local/lib/CableSwig/SWIGLib/carrays.i
> .
> .
> [snipped]
> .
> .
> DEBUG: installing file: /opt/local/var/macports/software/cableswig/ 
> 20090514_0/opt/local/lib/CableSwig/SWIGLib/tcl/tcl8kw.swg
> DEBUG: installing file: /opt/local/var/macports/software/cableswig/ 
> 20090514_0/opt/local/lib/CableSwig/SWIGLib/tcl/tclsh.i
> DEBUG: installing file: /opt/local/var/macports/software/cableswig/ 
> 20090514_0/opt/local/lib/CableSwig/SWIGLib/tcl/typemaps.i
> DEBUG: installing file: /opt/local/var/macports/software/cableswig/ 
> 20090514_0/opt/local/lib/CableSwig/SWIGLib/tcl/wish.i
> DEBUG: Executing org.macports.activate (cableswig)
>
> --->  Activating cableswig @20090514_0
> DEBUG: activating directory: /
> DEBUG: activating directory: /opt
> DEBUG: activating directory: /opt/local
> DEBUG: activating directory: /opt/local/bin
> DEBUG: activating file: /opt/local/bin/cableidx
> DEBUG: activating file: /opt/local/bin/cswig
> DEBUG: activating directory: /opt/local/lib
> DEBUG: activating directory: /opt/local/lib/CableSwig
> DEBUG: activating file: /opt/local/lib/CableSwig/CableSwigConfig.cmake
> DEBUG: activating directory: /opt/local/lib/CableSwig/SWIGLib
> DEBUG: activating file: /opt/local/lib/CableSwig/SWIGLib/_std_deque.i
> DEBUG: activating file: /opt/local/lib/CableSwig/SWIGLib/allkw.swg
> DEBUG: activating file: /opt/local/lib/CableSwig/SWIGLib/carrays.i
> DEBUG: activating file: /opt/local/lib/CableSwig/SWIGLib/cdata.i
> .
> .
> [snipped]
> .
> .
> DEBUG: activating file: /opt/local/lib/CableSwig/SWIGLib/tcl/ 
> std_vector.i
> DEBUG: activating file: /opt/local/lib/CableSwig/SWIGLib/tcl/ 
> swigtcl8.swg
> DEBUG: activating file: /opt/local/lib/CableSwig/SWIGLib/tcl/tcl8.swg
> DEBUG: activating file: /opt/local/lib/CableSwig/SWIGLib/tcl/ 
> tcl8kw.swg
> DEBUG: activating file: /opt/local/lib/CableSwig/SWIGLib/tcl/tclsh.i
> DEBUG: activating file: /opt/local/lib/CableSwig/SWIGLib/tcl/ 
> typemaps.i
> DEBUG: activating file: /opt/local/lib/CableSwig/SWIGLib/tcl/wish.i
>
> --->  Cleaning cableswig
> DEBUG: Executing org.macports.clean (cableswig)
>
> --->  Removing build directory for cableswig
> DEBUG: Removing directory: /opt/local/var/macports/build/ 
> _Users_dweber_ports_devel_cableswig
> DEBUG: delete: /opt/local/var/macports/build/ 
> _Users_dweber_ports_devel_cableswig
> DEBUG: Removing symlink: /Users/dweber/ports/devel/cableswig/work
> DEBUG: delete: /Users/dweber/ports/devel/cableswig/work
>
> ####################END MACPORTS INSTALL and ACTIVATE
>
>
> So far so good, everything appears to work.  Now, for the run-time  
> failure, cswig is looking for SWIGLib in the *source* path, not the  
> installation library path in /opt/local/lib/CableSwig/SWIGLib:
>
> [ dweber at X ~/ports/devel/cableswig ]$ ls -l /opt/local/bin/cswig
> -rwxr-xr-x 2 root admin 1.4M 2009-05-15 18:43 /opt/local/bin/cswig*
> [ dweber at X ~/ports/devel/cableswig ]$ which cswig
> /opt/local/bin/cswig
> [ dweber at X ~/ports/devel/cableswig ]$ cswig
> Cannot find SWIG Lib directory.  Checked:
>   /opt/local/var/macports/build/_Users_dweber_ports_devel_cableswig/ 
> work/cableswig-20090514/SWIG/Lib
> [ dweber at X ~/ports/devel/cableswig ]$ ls /opt/local/lib/CableSwig/ 
> SWIGLib/
> _std_deque.i  carrays.i  cmalloc.i   constraints.i  cstring.i     
> java/   pointer.i  std_deque.i  swig.swg   tcl/
> allkw.swg     cdata.i    common.swg  cpointer.i     exception.i   
> math.i  python/    stl.i        swigrun.i
>
>
> In looking at the CMakeLists.txt files, I wonder what controls the  
> SWIGLib path setting, e.g.:
>
> LINK_DIRECTORIES( "${LIBRARY_OUTPUT_PATH}" )
> LINK_DIRECTORIES( "${EXECUTABLE_OUTPUT_PATH}" )
>
> Near the end of CMakeLists.txt file in the section "# Settings for  
> the install tree." we have:
>
> SET(CableSwig_DEFAULT_LIB_CONFIG ${CMAKE_INSTALL_PREFIX}/$ 
> {CableSwig_INSTALL_ROOT}lib/CableSwig/SWIGLib)
>
> This seems to control the location of the installation for SWIGLib,  
> but not how cswig links to it (after installation).
>
> Again, sorry about the long explanation; there it is.  Will it be  
> possible to get this working as a stand-alone installation?  It  
> seems that cableswig is primarily designed to build and run within  
> the Insight build, rather than as a stand-alone binary.  To provide  
> the latter, I wonder if it's possible to identify a configuration  
> variable to change how cswig links to or finds the SWIGLib path?
>
> Kind regards,
> Darren
>
>
>
>
>
> On Fri, May 15, 2009 at 4:13 AM, Luis Ibanez  
> <luis.ibanez at kitware.com> wrote:
> Hi Darren,
>
> You may find useful to look at the Tutorial:
> http://farsight-toolkit.org/wiki/FARSIGHT_Tutorials/Building_Software/Building_CableSwig
>
> Please let us know if you still find any problems.
>
>
>    Thanks
>
>
>       Luis
>
>
> --------------------
> Darren Weber wrote:
>
> A source build and binary install for cswig fails with:
>
> [ dweber at X ~/ports ]$ cswig
> Cannot find SWIG Lib directory.  Checked:
>  /opt/local/var/macports/build/_Users_dweber_ports_devel_cableswig/ 
> work/cableswig-20090514/SWIG/Lib
> [ dweber at X ~/ports ]$
> [ dweber at X ~/ports ]$ otool -L /opt/local/bin/cswig
> /opt/local/bin/cswig:
>    /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current  
> version 7.4.0)
>    /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current  
> version 1.0.0)
>    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current  
> version 111.1.3)
>
>
> This build of cableswig must use a DESTDIR on the install and the  
> final installation is actually moved from that DESTDIR into a $ 
> {prefix} location (actually /opt/local in this case).  The final  
> location for the SWIG Lib is actually /opt/local/lib/CableSwig/ 
> SWIGLib/.
>
> How can we specify this SWIG Lib directory during the build  
> configuration?  Is it a cmake variable or is it a CMakeList.txt  
> setting?
>
> Thanks in advance,
> Darren
>
>
> ------------------------------------------------------------------------
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ITK FAQ at: http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ITK FAQ at: http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users

-- 
Gaëtan Lehmann
Biologie du Développement et de la Reproduction
INRA de Jouy-en-Josas (France)
tel: +33 1 34 65 29 66    fax: 01 34 65 29 09
http://voxel.jouy.inra.fr  http://www.mandriva.org
http://www.itk.org  http://www.clavier-dvorak.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 203 bytes
Desc: Ceci est une signature ?lectronique PGP
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090517/566c881a/attachment.pgp>


More information about the Insight-users mailing list