Including STXXL library in the MakeFile

220 views Asked by At

I was trying to install STXXL library to a custom path following this answer supplying prefix to cmake this way:

cmake -DCMAKE_INSTALL_PREFIX=/usr . && make all install

When I run the tests, they seems to be working fine. But I want to include STXXL in a different MakeFile and compile that project. In that MakeFile there a line

STXXL_CONFIG = /opt/stxxl/stxxl.mk

I believe the configuration file stxxl.mk comes from the old make based installation (I couldn't locate it in my system either). I was wondering how I can modify this file to include STXXL library and get the custom project compiled.

Without modifying the above statement in MakeFile, I am getting the error:

undefined reference to 'stxxl::get_next_seed()' collect2: error: ld returned 1 exit status

It goes without saying that I don't have root access and unfortunately, neither a good background with MakeFiles. This is not a duplicate of Makefile with STXXL

1

There are 1 answers

0
Maxim Egorushkin On BEST ANSWER

To use a third party C++ library from a non-standard location in GNU Make the regular steps are:

  1. Add the path to 3rd-party library headers to your C++ preprocessor flags. E.g.

    CPPFLAGS += -I/3rd-party/include
    
  2. Add the path to 3rd-party shared/staric library to your linker flags and the library itself. Assuming the library is named lib3rd-party.so or lib3rd-party.a, e.g.

    LDFLAGS += -L/3rd-party/lib -Wl,-rpath=/3rd-party/lib -l3d-party