Changes between Version 20 and Version 21 of Processing/lagdevelopersfaq


Ignore:
Timestamp:
Sep 4, 2013 5:04:08 PM (6 years ago)
Author:
besm
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Processing/lagdevelopersfaq

    v20 v21  
    165165=== 2.5 How do I make laslib a shared library? [=#q2.5] ===
    166166
    167 It seems that laslib is mainly developed for Windows users so there are no targets for shared libraries in the Makefiles by default. At the same time shared libraries are needed by LAG to work correctly. To fix this you're going to need to modify the Makefiles and add {{{-fPIC}}} option to the compiler. You'll also have to change the name of the library from laslib to //liblaslib// for the linker to detect it. \\ \\
    168 You'll normally find modified Makefiles somewhere around, so you can copy them after downloading a new version of laslib and hopefully they will work. If this is not the case, below is the part that needs to be added to the Makefile inside laslib/src folder.
    169 
    170 {{{
    171 #!div style="font-size: 100%"
    172   {{{#!sh
    173 all: static shared
    174 
    175 # these targets set the output directory for the object
    176 # files and then call make again with the appropriate library targets. 
    177 # This is done so that the fpic flag is set correctly for the library
    178 # we're building.
    179 static:
    180         test -d static || mkdir static
    181         $(MAKE) liblaslib.a OBJDIR=static
    182 
    183 shared:
    184         test -d shared || mkdir shared
    185         $(MAKE) liblaslib.so.${VERSION} OBJDIR=shared EXTRA_COPTS=-fPIC
    186 
    187 liblaslib.a: ${TARGET_OBJS}
    188         $(AR) $@ ${TARGET_OBJS}
    189         cp -p $@ ../lib
    190 
    191 liblaslib.so.${VERSION}: ${TARGET_OBJS}
    192         ${COMPILER} -shared -Wl,-soname,liblaslib.so.1 -o \
    193         liblaslib.so.${VERSION} ${TARGET_OBJS}
    194         cp -p $@ ../lib
    195 
    196 ${TARGET_OBJS}: ${OBJDIR}/%.o: %.cpp
    197         ${COMPILER} ${BITS} -c ${COPTS} ${EXTRA_COPTS} ${INCLUDE} $< -o $@
    198 
    199   }}}
    200 }}}
    201 
    202 You're not likely to have to alter this part and if a newly downloaded version of laslib fails to build with modified Makefiles, the first thing to check is if {{{OBJ_LAS}}} (the list of object files) hasn't changed since the previous release.
     167As of 2012, automatic installers should be deployed on all Fedora17+ machines within RSG, so hopefully you will not need to install it on your machine yourself. Somebody within the department ought to be keeping a relatively current version maintained in svn under tools/laslib/lastools-patched. If you are the LAG maintainer then this job may fall to you, for which you will need to learn about compiling dynamically linked libraries and Makefiles in Linux.
     168
     169If you need to install laslib locally on your machine as a shared library, you should use the patched version maintained by RSG to maintain a relatively even installation across all desktop machines. Check out the patched lastools package and enter the laslib subdirectory, and build and install using the makefile provided.
     170
     171{{{
     172svn checkout http://rsg.pml.ac.uk/intranet/svnroots/arsf-internal/trunk/tools/laslib
     173cd laslib/lastools-patched/laslib
     174make
     175make install
     176ldconfig
     177}}}
     178
     179
     180For maintaining lastools, check back on the official release every now and then and figure out whether it has been updated (there is no version numbering). You will need to download this and (try to) apply the latest patch from the top laslib directory (lastools20120829.patch or something like that). This may fail, and you will need to try to resolve any issues preventing the patch from working. Then change the version in the makefile to the current date as a rudimentary versioning system for internal use. Next you will need to test the compilation, install it to your machine locally, and make sure it works, and debug any problems that arise. Once you've done that, move your patched version to lastools-patched, and the latest unpatched version to lastools. Derive a new patch from lastools-patched taking lastools as your reference, and label it accordingly. Package lastools-patched as laslib-YYYYMMDD.zip (set date as appropriate) as a tool for archiving, and you should be all set.
    203181
    204182----