[mlpack] Generating archive/static mllib.a on ubuntu linux

Ryan Curtin ryan at ratml.org
Mon Aug 3 13:04:32 EDT 2015


On Mon, Aug 03, 2015 at 12:50:42PM -0400, Steven Varga wrote:
> Hi,
> 
> for some reasons only shared objects are generated; which makes it
> cumbersome to use the library on a cluster; where static linking is
> preferred.
> 
> Is there any way to produce static library (archive) ?
> 
> best,
> steve

Hi Steve,

At the moment a static library is produced on Windows but not on Linux.
I didn't know that dynamic linking made things difficult on a cluster.
I'm happy to help through the process (and integrate our results into
the master branch), but there may be a little back-and-forth here as we
center in on getting the process right.

My first suggestion would be to change the line 

  add_library(mlpack SHARED ${MLPACK_SRCS})

to

  add_library(mlpack ${MLPACK_SRCS})

in src/mlpack/CMakeLists.txt (line 25 in the master branch, line 24 in
mlpack-1.0.12).

That should generate a statically-linked libmlpack.a, but I am not sure
if that will be enough for your purposes.  Can you try that and let me
know if that is sufficient?  If so, I'll add and document a new CMake
configuration flag.

Thanks,

Ryan

-- 
Ryan Curtin    | "Give a man a gun and he thinks he's Superman.
ryan at ratml.org | Give him two and he thinks he's God."  - Pang


More information about the mlpack mailing list