Skip to content
This repository was archived by the owner on Mar 8, 2023. It is now read-only.
This repository was archived by the owner on Mar 8, 2023. It is now read-only.

static linking with cmake (MacOS) #72

Description

@yesitsme007

Hi,
is it possible to build the binary tin-terrain with static linking? I would like to easily share this program between machines. Currently this requires installing all the dependencies. It would be very helpful if one could just copy the executable. I work in MacOS but I guess this is not OS dependent. Can this be done with some tweakings of cmake flags?

Note If others run into the same issue: There is a workaround possible which I currently use:
copy all dependencies to some new dir on the build machine:

mkdir <somedir>
cd <somedir>
cp /usr/local/opt/gdal/lib/libgdal.20.dylib .
cp /usr/local/opt/openssl@1.1/lib/libcrypto.1.1.dylib .
cp /usr/local/opt/proj/lib/libproj.15.dylib .
cp /usr/local/opt/json-c/lib/libjson-c.4.dylib .
cp /usr/local/opt/freexl/lib/libfreexl.1.dylib .
cp /usr/local/opt/geos/lib/libgeos_c.1.dylib .
cp /usr/local/opt/webp/lib/libwebp.7.dylib .
cp /usr/local/opt/epsilon/lib/libepsilon.1.dylib .
cp /usr/local/opt/sqlite/lib/libsqlite3.0.dylib .
cp /usr/local/opt/unixodbc/lib/libodbc.2.dylib .
cp /usr/local/opt/unixodbc/lib/libodbcinst.2.dylib .
cp /usr/local/opt/expat/lib/libexpat.1.dylib .
cp /usr/local/opt/xerces-c/lib/libxerces-c-3.2.dylib .
cp /usr/local/opt/jasper/lib/libjasper.4.dylib .
cp /usr/local/opt/netcdf/lib/libnetcdf.15.dylib .
cp /usr/local/opt/hdf5/lib/libhdf5.103.dylib .
cp /usr/local/opt/giflib/lib/libgif.dylib .
cp /usr/local/opt/jpeg/lib/libjpeg.9.dylib .
cp /usr/local/opt/libgeotiff/lib/libgeotiff.5.dylib .
cp /usr/local/opt/libtiff/lib/libtiff.5.dylib .
cp /usr/local/opt/libpng/lib/libpng16.16.dylib .
cp /usr/local/opt/cfitsio/lib/libcfitsio.8.dylib .
cp /usr/local/opt/libpq/lib/libpq.5.dylib .
cp /usr/local/opt/zstd/lib/libzstd.1.dylib .
cp /usr/local/opt/xz/lib/liblzma.5.dylib .
cp /usr/local/opt/libdap/lib/libdap.25.dylib .
cp /usr/local/opt/libdap/lib/libdapserver.7.dylib .
cp /usr/local/opt/libdap/lib/libdapclient.6.dylib .
cp /usr/local/opt/libspatialite/lib/libspatialite.7.dylib .
cp /usr/local/opt/pcre/lib/libpcre.1.dylib .
cp /usr/local/opt/libxml2/lib/libxml2.2.dylib .

Transfer somedir to the new machine. And then use the following the script:

export DYLD_FALLBACK_LIBRARY_PATH=<somedir>
./tin-terrain $*

This is only for Mac and of course it is really ugly. It will break with any change in the dependency chain.

P.S. This is really a great tool! Thanks for sharing it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions