Static library linking - undefined reference to `gzstreambuf`


I’m attempting to link the META static libraries to some test code that I have written.

I added a simple function to the meta-sequence library that prints some text. The file is called lib_wrapper.h:

namespace meta {
  namespace sequence {
    void posMETA_test() {
      std::cout << "INFO: META: Running posMETA_test function" << std::endl;

I added the new file to the cmake implementation and META compiles as usual without any problems. I have used this test function previously from a shared library of META. So the function itself, and the way it is included in META is not the problem.

The problem appears when trying to use this test function from code external to META that is linked to META static libraries. The file main.cpp is as follows:

#include "meta/sequence/crf/lib_wrapper.h"
int main()
  //call the test function from the static lib

Within my project I include the META headers and all the META libs.The (shortened) compiler commands are:

g++.exe -Wall -std=c++14 -m64 -fexceptions -O2 -Ideps\meta\include -ID:\msys64\mingw64\include -ID:\msys64\mingw64\lib -c main.cpp -o main.o

g++.exe -LD:\msys64\mingw64\include -LD:\msys64\mingw64\lib -Ldeps\meta\lib -o read_library_test.exe main.o  -m64 -s deps\meta\lib\libmeta-analyzers.a <ALL THE META STATIC LIBS> D:\msys64\mingw64\lib\liblzma.dll.a D:\msys64\mingw64\lib\liblzma.a D:\msys64\mingw64\lib\libz.dll.a D:\msys64\mingw64\lib\libz.a

I get the following errors from the second (linking) command:

sequence-analyzer.cpp: undefined reference to meta::io::gzstreambuf::gzstreambuf(char const*, char const*, unsigned long long)
sequence-analyzer.cpp: undefined reference to meta::io::gzstreambuf::is_open()
sequence-analyzer.cpp: undefined reference to meta::io::gzstreambuf::~gzstreambuf()

Does anyone have an idea of what the problem might be?

My system isn’t using the experimental file system stuff, but it does use ZLIB and LIBLZMA. I tried adding those libraries to the linker command (see above), but it didn’t solve the problem. My understanding is that they shouldn’t need to be added anyway. The gzstreambuf class is present in the meta-io static library, so I don’t know why it isn’t found.

Any help or suggestions are much appreciated.


Actually the above test function works. It can be read from the META static library and it runs fine. The real problem is when META classes are used within my external code

#include "meta/sequence/crf/crf.h"
int main()
  meta::sequence::crf mycrf{""};

I get a large number of errors when compiling the external code.

undefined reference to `munmap`
undefined reference to `meta::sequence::sequence::begin()`
undefined reference to `meta::printing::progress::operator()`
undefined reference to `meta::filesystem::file_exists()`
undefined reference to `meta::utf::foldcase()`

It seems like the necessary functions are not being found in the static libraries. How should meta-utf be included when linking to the META static libraries? It is compiled as a shared library, so it shouldn’t be needed until runtime. But I still get errors about it when running the linker.