PDB-REDO / libcifpp

Library containing code to manipulate mmCIF and PDB files
https://pdb-redo.github.io/libcifpp/
BSD 2-Clause "Simplified" License
29 stars 10 forks source link

build failing on Ubuntu 20.04 #31

Closed DaniBodor closed 1 year ago

DaniBodor commented 1 year ago

I am trying to build this package, using the provided instructions on Ubuntu 20.04 via WSL2.

I am getting an error on the cmake --build . --config Release step:

Scanning dependencies of target COMPONENTS
[  4%] Generating ../data/components.cif

gzip: /home/dbodor/DSSP/libcifpp/data/components.cif.gz: unexpected end of file
make[2]: *** [CMakeFiles/COMPONENTS.dir/build.make:61: ../data/components.cif] Error 1
make[1]: *** [CMakeFiles/Makefile2:97: CMakeFiles/COMPONENTS.dir/all] Error 2
make: *** [Makefile:152: all] Error 2

Any idea what is going wrong?

DaniBodor commented 1 year ago

I've also tested the instructions from #29 but am getting the same problem when running cmake --build build

MartinSalinas98 commented 1 year ago

The commands I posted on my PR were tested for 22.04, but I just tried them out on a 20.04 machine and got some problems too, not yours exactly, but mine were gcc/g++ versions related (needed 9+). After solving that, I had no further issues and the installation completed successfully. Using my commands that error could be caused by not writing the proper path in the cmake -S . -B build -DCMAKE_INSTALL_PREFIX=$HOME/path/to/libcifpp/ -DCMAKE_BUILD_TYPE=Release command.

The specific commands you would need to run (starting from scatch with rm -rf /home/dbodor/DSSP/libcifpp) would be:

cd /home/dbodor/DSSP
git clone https://github.com/PDB-REDO/libcifpp.git
cd libcifpp
cmake -S . -B build -DCMAKE_INSTALL_PREFIX=$HOME/DSSP/libcifpp/ -DCMAKE_BUILD_TYPE=Release
cmake --build build
cmake --install build 

I'm not sure if this will solve your problem, but I had no issues whatsoever once my gcc/g++ versions were correct, so I guess it's worth a try. PS: Make sure you have a stable internet connection while running the commands, as some files are downloaded in the process.

DaniBodor commented 1 year ago

Seems to have worked! Is there a test command or something I can run to be sure?

MartinSalinas98 commented 1 year ago

Yes, try this:

cd /home/dbodor/DSSP/libcifpp/examples
make
./example

When running make, you might encounter the error I fixed in #30, but if you apply the change stated in that PR, the example run should work fine and read the sample cif file included.

DaniBodor commented 1 year ago

unfortunately didn't work.

image

MartinSalinas98 commented 1 year ago

Do you have pkg-config installed? I'm asking because I see make: pkg-config: Command not found. If you take a look inside the makefile, pkg-config is being used to extract the installation location of your libraries, in this case, libcifpp, but if that package is not installed, the command won't run and the library won't be linked to the test, resulting in that include error. Try running sudo apt-get install pkg-config, and then compile again.

PS: you could also manually write in the makefile the path to the library instead of using pkg-config. The resulting command should be c++ -std=c++17 -o example example.cpp -pthread -I/usr/local/include -L/usr/local/lib -lcifpp -lz, which you could run directly in the terminal from /git/DSSP/libcifpp/examples folder.

DaniBodor commented 1 year ago

Do you have pkg-config installed? I'm asking because I see make: pkg-config: Command not found. If you take a look inside the makefile, pkg-config is being used to extract the installation location of your libraries, in this case, libcifpp, but if that package is not installed, the command won't run and the library won't be linked to the test, resulting in that include error. Try running sudo apt-get install pkg-config, and then compile again.

Indeed, I didn't. I now installed pkg-config and re-installed libcffpp using the instructions in this issue. It then asked me to add the folder containing libcifpp.pc to the PKG_CONFIG_PATH directory, which I also did. I now get the following error when running make (irrespective of -lz flag):

dbodor@DESKTOP-QCBKDU1:~/git/DSSP/libcifpp/examples$ make
c++ -std=c++17 -o example example.cpp -pthread -I/home/dbodor/DSSP/libcifpp/include -L/home/dbodor/DSSP/libcifpp/lib -lcifpp
/usr/bin/ld: /home/dbodor/DSSP/libcifpp/lib/libcifpp.a(file.cpp.o): in function `cif::gzio::basic_igzip_streambuf<char, std::char_traits<char>, 256ul>::underflow()':
file.cpp:(.text._ZN3cif4gzio21basic_igzip_streambufIcSt11char_traitsIcELm256EE9underflowEv[_ZN3cif4gzio21basic_igzip_streambufIcSt11char_traitsIcELm256EE9underflowEv]+0x95): undefined reference to `inflate'
/usr/bin/ld: /home/dbodor/DSSP/libcifpp/lib/libcifpp.a(file.cpp.o): in function `cif::gzio::basic_ogzip_streambuf<char, std::char_traits<char>, 256ul>::overflow(int)':
file.cpp:(.text._ZN3cif4gzio21basic_ogzip_streambufIcSt11char_traitsIcELm256EE8overflowEi[_ZN3cif4gzio21basic_ogzip_streambufIcSt11char_traitsIcELm256EE8overflowEi]+0x80): undefined reference to `deflate'
/usr/bin/ld: file.cpp:(.text._ZN3cif4gzio21basic_ogzip_streambufIcSt11char_traitsIcELm256EE8overflowEi[_ZN3cif4gzio21basic_ogzip_streambufIcSt11char_traitsIcELm256EE8overflowEi]+0x125): undefined reference to `deflate'
/usr/bin/ld: /home/dbodor/DSSP/libcifpp/lib/libcifpp.a(file.cpp.o): in function `cif::gzio::basic_igzip_streambuf<char, std::char_traits<char>, 256ul>::close()':
file.cpp:(.text._ZN3cif4gzio21basic_igzip_streambufIcSt11char_traitsIcELm256EE5closeEv[_ZN3cif4gzio21basic_igzip_streambufIcSt11char_traitsIcELm256EE5closeEv]+0x13): undefined reference to `inflateEnd'
/usr/bin/ld: /home/dbodor/DSSP/libcifpp/lib/libcifpp.a(file.cpp.o): in function `cif::gzio::basic_igzip_streambuf<char, std::char_traits<char>, 256ul>::~basic_igzip_streambuf()':
file.cpp:(.text._ZN3cif4gzio21basic_igzip_streambufIcSt11char_traitsIcELm256EED0Ev[_ZN3cif4gzio21basic_igzip_streambufIcSt11char_traitsIcELm256EED5Ev]+0x20): undefined reference to `inflateEnd'
/usr/bin/ld: /home/dbodor/DSSP/libcifpp/lib/libcifpp.a(file.cpp.o): in function `cif::gzio::basic_igzip_streambuf<char, std::char_traits<char>, 256ul>::~basic_igzip_streambuf()':
file.cpp:(.text._ZN3cif4gzio21basic_igzip_streambufIcSt11char_traitsIcELm256EED2Ev[_ZN3cif4gzio21basic_igzip_streambufIcSt11char_traitsIcELm256EED5Ev]+0x20): undefined reference to `inflateEnd'
/usr/bin/ld: /home/dbodor/DSSP/libcifpp/lib/libcifpp.a(file.cpp.o): in function `cif::gzio::basic_ogzip_streambuf<char, std::char_traits<char>, 256ul>::~basic_ogzip_streambuf()':
file.cpp:(.text._ZN3cif4gzio21basic_ogzip_streambufIcSt11char_traitsIcELm256EED0Ev[_ZN3cif4gzio21basic_ogzip_streambufIcSt11char_traitsIcELm256EED5Ev]+0x77): undefined reference to `deflate'
/usr/bin/ld: file.cpp:(.text._ZN3cif4gzio21basic_ogzip_streambufIcSt11char_traitsIcELm256EED0Ev[_ZN3cif4gzio21basic_ogzip_streambufIcSt11char_traitsIcELm256EED5Ev]+0xc9): undefined reference to `deflateEnd'
/usr/bin/ld: /home/dbodor/DSSP/libcifpp/lib/libcifpp.a(file.cpp.o): in function `cif::gzio::basic_ogzip_streambuf<char, std::char_traits<char>, 256ul>::~basic_ogzip_streambuf()':
file.cpp:(.text._ZN3cif4gzio21basic_ogzip_streambufIcSt11char_traitsIcELm256EED2Ev[_ZN3cif4gzio21basic_ogzip_streambufIcSt11char_traitsIcELm256EED5Ev]+0x7f): undefined reference to `deflate'
/usr/bin/ld: file.cpp:(.text._ZN3cif4gzio21basic_ogzip_streambufIcSt11char_traitsIcELm256EED2Ev[_ZN3cif4gzio21basic_ogzip_streambufIcSt11char_traitsIcELm256EED5Ev]+0xd1): undefined reference to `deflateEnd'
/usr/bin/ld: /home/dbodor/DSSP/libcifpp/lib/libcifpp.a(file.cpp.o): in function `cif::gzio::basic_igzip_streambuf<char, std::char_traits<char>, 256ul>::init(std::basic_streambuf<char, std::char_traits<char> >*)':
file.cpp:(.text._ZN3cif4gzio21basic_igzip_streambufIcSt11char_traitsIcELm256EE4initEPSt15basic_streambufIcS3_E[_ZN3cif4gzio21basic_igzip_streambufIcSt11char_traitsIcELm256EE4initEPSt15basic_streambufIcS3_E]+0x2d): undefined reference to `inflateEnd'
/usr/bin/ld: file.cpp:(.text._ZN3cif4gzio21basic_igzip_streambufIcSt11char_traitsIcELm256EE4initEPSt15basic_streambufIcS3_E[_ZN3cif4gzio21basic_igzip_streambufIcSt11char_traitsIcELm256EE4initEPSt15basic_streambufIcS3_E]+0x104): undefined reference to `inflateInit2_'
/usr/bin/ld: file.cpp:(.text._ZN3cif4gzio21basic_igzip_streambufIcSt11char_traitsIcELm256EE4initEPSt15basic_streambufIcS3_E[_ZN3cif4gzio21basic_igzip_streambufIcSt11char_traitsIcELm256EE4initEPSt15basic_streambufIcS3_E]+0x12d): undefined reference to `inflateGetHeader'
/usr/bin/ld: file.cpp:(.text._ZN3cif4gzio21basic_igzip_streambufIcSt11char_traitsIcELm256EE4initEPSt15basic_streambufIcS3_E[_ZN3cif4gzio21basic_igzip_streambufIcSt11char_traitsIcELm256EE4initEPSt15basic_streambufIcS3_E]+0x14c): undefined reference to `inflateEnd'
/usr/bin/ld: /home/dbodor/DSSP/libcifpp/lib/libcifpp.a(file.cpp.o): in function `cif::gzio::basic_ogzip_streambuf<char, std::char_traits<char>, 256ul>::close()':
file.cpp:(.text._ZN3cif4gzio21basic_ogzip_streambufIcSt11char_traitsIcELm256EE5closeEv[_ZN3cif4gzio21basic_ogzip_streambufIcSt11char_traitsIcELm256EE5closeEv]+0x88): undefined reference to `deflate'
/usr/bin/ld: file.cpp:(.text._ZN3cif4gzio21basic_ogzip_streambufIcSt11char_traitsIcELm256EE5closeEv[_ZN3cif4gzio21basic_ogzip_streambufIcSt11char_traitsIcELm256EE5closeEv]+0xe1): undefined reference to `deflateEnd'
/usr/bin/ld: /home/dbodor/DSSP/libcifpp/lib/libcifpp.a(file.cpp.o): in function `cif::gzio::basic_ogzip_streambuf<char, std::char_traits<char>, 256ul>::init(std::basic_streambuf<char, std::char_traits<char> >*)':
file.cpp:(.text._ZN3cif4gzio21basic_ogzip_streambufIcSt11char_traitsIcELm256EE4initEPSt15basic_streambufIcS3_E[_ZN3cif4gzio21basic_ogzip_streambufIcSt11char_traitsIcELm256EE4initEPSt15basic_streambufIcS3_E]+0x97): undefined reference to `deflate'
/usr/bin/ld: file.cpp:(.text._ZN3cif4gzio21basic_ogzip_streambufIcSt11char_traitsIcELm256EE4initEPSt15basic_streambufIcS3_E[_ZN3cif4gzio21basic_ogzip_streambufIcSt11char_traitsIcELm256EE4initEPSt15basic_streambufIcS3_E]+0xe9): undefined reference to `deflateEnd'
/usr/bin/ld: file.cpp:(.text._ZN3cif4gzio21basic_ogzip_streambufIcSt11char_traitsIcELm256EE4initEPSt15basic_streambufIcS3_E[_ZN3cif4gzio21basic_ogzip_streambufIcSt11char_traitsIcELm256EE4initEPSt15basic_streambufIcS3_E]+0x1c8): undefined reference to `deflateInit2_'
/usr/bin/ld: file.cpp:(.text._ZN3cif4gzio21basic_ogzip_streambufIcSt11char_traitsIcELm256EE4initEPSt15basic_streambufIcS3_E[_ZN3cif4gzio21basic_ogzip_streambufIcSt11char_traitsIcELm256EE4initEPSt15basic_streambufIcS3_E]+0x20f): undefined reference to `deflateSetHeader'
/usr/bin/ld: /home/dbodor/DSSP/libcifpp/lib/libcifpp.a(validate.cpp.o): in function `cif::validator_factory::operator[](std::basic_string_view<char, std::char_traits<char> >)':
validate.cpp:(.text+0x31e4): undefined reference to `inflateEnd'
/usr/bin/ld: validate.cpp:(.text+0x32dc): undefined reference to `inflateEnd'
/usr/bin/ld: /home/dbodor/DSSP/libcifpp/lib/libcifpp.a(validate.cpp.o): in function `cif::gzio::basic_istream<char, std::char_traits<char> >::~basic_istream()':
validate.cpp:(.text._ZN3cif4gzio13basic_istreamIcSt11char_traitsIcEED2Ev[_ZN3cif4gzio13basic_istreamIcSt11char_traitsIcEED2Ev]+0x5b): undefined reference to `inflateEnd'
/usr/bin/ld: /home/dbodor/DSSP/libcifpp/lib/libcifpp.a(validate.cpp.o): in function `cif::gzio::basic_ifstream<char, std::char_traits<char> >::open(std::filesystem::__cxx11::path const&, std::_Ios_Openmode)':
validate.cpp:(.text._ZN3cif4gzio14basic_ifstreamIcSt11char_traitsIcEE4openERKNSt10filesystem7__cxx114pathESt13_Ios_Openmode[_ZN3cif4gzio14basic_ifstreamIcSt11char_traitsIcEE4openERKNSt10filesystem7__cxx114pathESt13_Ios_Openmode]+0x226): undefined reference to `inflateEnd'
/usr/bin/ld: validate.cpp:(.text._ZN3cif4gzio14basic_ifstreamIcSt11char_traitsIcEE4openERKNSt10filesystem7__cxx114pathESt13_Ios_Openmode[_ZN3cif4gzio14basic_ifstreamIcSt11char_traitsIcEE4openERKNSt10filesystem7__cxx114pathESt13_Ios_Openmode]+0x2f9): undefined reference to `inflateInit2_'
/usr/bin/ld: validate.cpp:(.text._ZN3cif4gzio14basic_ifstreamIcSt11char_traitsIcEE4openERKNSt10filesystem7__cxx114pathESt13_Ios_Openmode[_ZN3cif4gzio14basic_ifstreamIcSt11char_traitsIcEE4openERKNSt10filesystem7__cxx114pathESt13_Ios_Openmode]+0x328): undefined reference to `inflateGetHeader'
/usr/bin/ld: validate.cpp:(.text._ZN3cif4gzio14basic_ifstreamIcSt11char_traitsIcEE4openERKNSt10filesystem7__cxx114pathESt13_Ios_Openmode[_ZN3cif4gzio14basic_ifstreamIcSt11char_traitsIcEE4openERKNSt10filesystem7__cxx114pathESt13_Ios_Openmode]+0x384): undefined reference to `inflateEnd'
/usr/bin/ld: validate.cpp:(.text._ZN3cif4gzio14basic_ifstreamIcSt11char_traitsIcEE4openERKNSt10filesystem7__cxx114pathESt13_Ios_Openmode[_ZN3cif4gzio14basic_ifstreamIcSt11char_traitsIcEE4openERKNSt10filesystem7__cxx114pathESt13_Ios_Openmode]+0x458): undefined reference to `inflateEnd'
/usr/bin/ld: /home/dbodor/DSSP/libcifpp/lib/libcifpp.a(cif2pdb.cpp.o): in function `cif::pdb::write(std::filesystem::__cxx11::path const&, cif::datablock const&)':
cif2pdb.cpp:(.text+0x67cdb): undefined reference to `deflate'
/usr/bin/ld: cif2pdb.cpp:(.text+0x67d36): undefined reference to `deflateEnd'
/usr/bin/ld: cif2pdb.cpp:(.text+0x67e8e): undefined reference to `deflate'
/usr/bin/ld: cif2pdb.cpp:(.text+0x67f0d): undefined reference to `deflateEnd'
/usr/bin/ld: cif2pdb.cpp:(.text+0x6802d): undefined reference to `deflateInit2_'
/usr/bin/ld: cif2pdb.cpp:(.text+0x6879b): undefined reference to `deflate'
/usr/bin/ld: cif2pdb.cpp:(.text+0x687f6): undefined reference to `deflateEnd'
/usr/bin/ld: cif2pdb.cpp:(.text+0x68947): undefined reference to `deflateSetHeader'
/usr/bin/ld: /home/dbodor/DSSP/libcifpp/lib/libcifpp.a(cif2pdb.cpp.o): in function `cif::gzio::basic_ostream<char, std::char_traits<char> >::~basic_ostream()':
cif2pdb.cpp:(.text._ZN3cif4gzio13basic_ostreamIcSt11char_traitsIcEED2Ev[_ZN3cif4gzio13basic_ostreamIcSt11char_traitsIcEED2Ev]+0xb5): undefined reference to `deflate'
/usr/bin/ld: cif2pdb.cpp:(.text._ZN3cif4gzio13basic_ostreamIcSt11char_traitsIcEED2Ev[_ZN3cif4gzio13basic_ostreamIcSt11char_traitsIcEED2Ev]+0x118): undefined reference to `deflateEnd'
collect2: error: ld returned 1 exit status
make: *** [makefile:8: example] Error 1
MartinSalinas98 commented 1 year ago

I only had those issues you are mentioning when not linking zlib appending the -lz flag at the end of the command. To test that, if you run pkg-config --libs zlib, it should return -lz. If that doesn't happen then you will need to install zlib. You should be fine following this instructions, for example.

DaniBodor commented 1 year ago

To test that, if you run pkg-config --libs zlib, it should return -lz.

It does.

MartinSalinas98 commented 1 year ago

Then I'm not sure what's the problem with your installation. First, if you can, run this command just to make sure: c++ -std=c++17 -o example example.cpp -pthread -I/home/dbodor/DSSP/libcifpp/include -L/home/dbodor/DSSP/libcifpp/lib -lcifpp Please also post the output of that. If it ddn't work, the only other thing that occurs to me is that there is something wrong with your gcc/c++ version. To test that, run both gcc -v and g++ -v and post the result of those commands.

DaniBodor commented 1 year ago

First, if you can, run this command just to make sure:

dbodor@DESKTOP-QCBKDU1:~/git/DSSP/libcifpp/examples$ c++ -std=c++17 -o example example.cpp -pthread -I/home/dbodor/DSSP/libcifpp/include -L/home/dbodor/DSSP/libcifpp/lib -lcifpp
/usr/bin/ld: /home/dbodor/DSSP/libcifpp/lib/libcifpp.a(file.cpp.o): in function `cif::gzio::basic_igzip_streambuf<char, std::char_traits<char>, 256ul>::underflow()':
file.cpp:(.text._ZN3cif4gzio21basic_igzip_streambufIcSt11char_traitsIcELm256EE9underflowEv[_ZN3cif4gzio21basic_igzip_streambufIcSt11char_traitsIcELm256EE9underflowEv]+0x95): undefined reference to `inflate'
/usr/bin/ld: /home/dbodor/DSSP/libcifpp/lib/libcifpp.a(file.cpp.o): in function `cif::gzio::basic_ogzip_streambuf<char, std::char_traits<char>, 256ul>::overflow(int)':
file.cpp:(.text._ZN3cif4gzio21basic_ogzip_streambufIcSt11char_traitsIcELm256EE8overflowEi[_ZN3cif4gzio21basic_ogzip_streambufIcSt11char_traitsIcELm256EE8overflowEi]+0x80): undefined reference to `deflate'
/usr/bin/ld: file.cpp:(.text._ZN3cif4gzio21basic_ogzip_streambufIcSt11char_traitsIcELm256EE8overflowEi[_ZN3cif4gzio21basic_ogzip_streambufIcSt11char_traitsIcELm256EE8overflowEi]+0x125): undefined reference to `deflate'
/usr/bin/ld: /home/dbodor/DSSP/libcifpp/lib/libcifpp.a(file.cpp.o): in function `cif::gzio::basic_igzip_streambuf<char, std::char_traits<char>, 256ul>::close()':
file.cpp:(.text._ZN3cif4gzio21basic_igzip_streambufIcSt11char_traitsIcELm256EE5closeEv[_ZN3cif4gzio21basic_igzip_streambufIcSt11char_traitsIcELm256EE5closeEv]+0x13): undefined reference to `inflateEnd'
/usr/bin/ld: /home/dbodor/DSSP/libcifpp/lib/libcifpp.a(file.cpp.o): in function `cif::gzio::basic_igzip_streambuf<char, std::char_traits<char>, 256ul>::~basic_igzip_streambuf()':
file.cpp:(.text._ZN3cif4gzio21basic_igzip_streambufIcSt11char_traitsIcELm256EED0Ev[_ZN3cif4gzio21basic_igzip_streambufIcSt11char_traitsIcELm256EED5Ev]+0x20): undefined reference to `inflateEnd'
/usr/bin/ld: /home/dbodor/DSSP/libcifpp/lib/libcifpp.a(file.cpp.o): in function `cif::gzio::basic_igzip_streambuf<char, std::char_traits<char>, 256ul>::~basic_igzip_streambuf()':
file.cpp:(.text._ZN3cif4gzio21basic_igzip_streambufIcSt11char_traitsIcELm256EED2Ev[_ZN3cif4gzio21basic_igzip_streambufIcSt11char_traitsIcELm256EED5Ev]+0x20): undefined reference to `inflateEnd'
/usr/bin/ld: /home/dbodor/DSSP/libcifpp/lib/libcifpp.a(file.cpp.o): in function `cif::gzio::basic_ogzip_streambuf<char, std::char_traits<char>, 256ul>::~basic_ogzip_streambuf()':
file.cpp:(.text._ZN3cif4gzio21basic_ogzip_streambufIcSt11char_traitsIcELm256EED0Ev[_ZN3cif4gzio21basic_ogzip_streambufIcSt11char_traitsIcELm256EED5Ev]+0x77): undefined reference to `deflate'
/usr/bin/ld: file.cpp:(.text._ZN3cif4gzio21basic_ogzip_streambufIcSt11char_traitsIcELm256EED0Ev[_ZN3cif4gzio21basic_ogzip_streambufIcSt11char_traitsIcELm256EED5Ev]+0xc9): undefined reference to `deflateEnd'
/usr/bin/ld: /home/dbodor/DSSP/libcifpp/lib/libcifpp.a(file.cpp.o): in function `cif::gzio::basic_ogzip_streambuf<char, std::char_traits<char>, 256ul>::~basic_ogzip_streambuf()':
file.cpp:(.text._ZN3cif4gzio21basic_ogzip_streambufIcSt11char_traitsIcELm256EED2Ev[_ZN3cif4gzio21basic_ogzip_streambufIcSt11char_traitsIcELm256EED5Ev]+0x7f): undefined reference to `deflate'
/usr/bin/ld: file.cpp:(.text._ZN3cif4gzio21basic_ogzip_streambufIcSt11char_traitsIcELm256EED2Ev[_ZN3cif4gzio21basic_ogzip_streambufIcSt11char_traitsIcELm256EED5Ev]+0xd1): undefined reference to `deflateEnd'
/usr/bin/ld: /home/dbodor/DSSP/libcifpp/lib/libcifpp.a(file.cpp.o): in function `cif::gzio::basic_igzip_streambuf<char, std::char_traits<char>, 256ul>::init(std::basic_streambuf<char, std::char_traits<char> >\*)':
file.cpp:(.text._ZN3cif4gzio21basic_igzip_streambufIcSt11char_traitsIcELm256EE4initEPSt15basic_streambufIcS3_E[_ZN3cif4gzio21basic_igzip_streambufIcSt11char_traitsIcELm256EE4initEPSt15basic_streambufIcS3_E]+0x2d): undefined reference to `inflateEnd'
/usr/bin/ld: file.cpp:(.text._ZN3cif4gzio21basic_igzip_streambufIcSt11char_traitsIcELm256EE4initEPSt15basic_streambufIcS3_E[_ZN3cif4gzio21basic_igzip_streambufIcSt11char_traitsIcELm256EE4initEPSt15basic_streambufIcS3_E]+0x104): undefined reference to `inflateInit2_'
/usr/bin/ld: file.cpp:(.text._ZN3cif4gzio21basic_igzip_streambufIcSt11char_traitsIcELm256EE4initEPSt15basic_streambufIcS3_E[_ZN3cif4gzio21basic_igzip_streambufIcSt11char_traitsIcELm256EE4initEPSt15basic_streambufIcS3_E]+0x12d): undefined reference to `inflateGetHeader'
/usr/bin/ld: file.cpp:(.text._ZN3cif4gzio21basic_igzip_streambufIcSt11char_traitsIcELm256EE4initEPSt15basic_streambufIcS3_E[_ZN3cif4gzio21basic_igzip_streambufIcSt11char_traitsIcELm256EE4initEPSt15basic_streambufIcS3_E]+0x14c): undefined reference to `inflateEnd'
/usr/bin/ld: /home/dbodor/DSSP/libcifpp/lib/libcifpp.a(file.cpp.o): in function `cif::gzio::basic_ogzip_streambuf<char, std::char_traits<char>, 256ul>::close()':
file.cpp:(.text._ZN3cif4gzio21basic_ogzip_streambufIcSt11char_traitsIcELm256EE5closeEv[_ZN3cif4gzio21basic_ogzip_streambufIcSt11char_traitsIcELm256EE5closeEv]+0x88): undefined reference to `deflate'
/usr/bin/ld: file.cpp:(.text._ZN3cif4gzio21basic_ogzip_streambufIcSt11char_traitsIcELm256EE5closeEv[_ZN3cif4gzio21basic_ogzip_streambufIcSt11char_traitsIcELm256EE5closeEv]+0xe1): undefined reference to `deflateEnd'
/usr/bin/ld: /home/dbodor/DSSP/libcifpp/lib/libcifpp.a(file.cpp.o): in function `cif::gzio::basic_ogzip_streambuf<char, std::char_traits<char>, 256ul>::init(std::basic_streambuf<char, std::char_traits<char> >\*)':
file.cpp:(.text._ZN3cif4gzio21basic_ogzip_streambufIcSt11char_traitsIcELm256EE4initEPSt15basic_streambufIcS3_E[_ZN3cif4gzio21basic_ogzip_streambufIcSt11char_traitsIcELm256EE4initEPSt15basic_streambufIcS3_E]+0x97): undefined reference to `deflate'
/usr/bin/ld: file.cpp:(.text._ZN3cif4gzio21basic_ogzip_streambufIcSt11char_traitsIcELm256EE4initEPSt15basic_streambufIcS3_E[_ZN3cif4gzio21basic_ogzip_streambufIcSt11char_traitsIcELm256EE4initEPSt15basic_streambufIcS3_E]+0xe9): undefined reference to `deflateEnd'
/usr/bin/ld: file.cpp:(.text._ZN3cif4gzio21basic_ogzip_streambufIcSt11char_traitsIcELm256EE4initEPSt15basic_streambufIcS3_E[_ZN3cif4gzio21basic_ogzip_streambufIcSt11char_traitsIcELm256EE4initEPSt15basic_streambufIcS3_E]+0x1c8): undefined reference to `deflateInit2_'
/usr/bin/ld: file.cpp:(.text._ZN3cif4gzio21basic_ogzip_streambufIcSt11char_traitsIcELm256EE4initEPSt15basic_streambufIcS3_E[_ZN3cif4gzio21basic_ogzip_streambufIcSt11char_traitsIcELm256EE4initEPSt15basic_streambufIcS3_E]+0x20f): undefined reference to `deflateSetHeader'
/usr/bin/ld: /home/dbodor/DSSP/libcifpp/lib/libcifpp.a(validate.cpp.o): in function `cif::validator_factory::operator[](std::basic_string_view<char, std::char_traits<char> >)':
validate.cpp:(.text+0x31e4): undefined reference to `inflateEnd'
/usr/bin/ld: validate.cpp:(.text+0x32dc): undefined reference to `inflateEnd'
/usr/bin/ld: /home/dbodor/DSSP/libcifpp/lib/libcifpp.a(validate.cpp.o): in function `cif::gzio::basic_istream<char, std::char_traits<char> >::~basic_istream()':
validate.cpp:(.text._ZN3cif4gzio13basic_istreamIcSt11char_traitsIcEED2Ev[_ZN3cif4gzio13basic_istreamIcSt11char_traitsIcEED2Ev]+0x5b): undefined reference to `inflateEnd'
/usr/bin/ld: /home/dbodor/DSSP/libcifpp/lib/libcifpp.a(validate.cpp.o): in function `cif::gzio::basic_ifstream<char, std::char_traits<char> >::open(std::filesystem::__cxx11::path const&, std::_Ios_Openmode)':
validate.cpp:(.text._ZN3cif4gzio14basic_ifstreamIcSt11char_traitsIcEE4openERKNSt10filesystem7__cxx114pathESt13_Ios_Openmode[_ZN3cif4gzio14basic_ifstreamIcSt11char_traitsIcEE4openERKNSt10filesystem7__cxx114pathESt13_Ios_Openmode]+0x226): undefined reference to `inflateEnd'
/usr/bin/ld: validate.cpp:(.text._ZN3cif4gzio14basic_ifstreamIcSt11char_traitsIcEE4openERKNSt10filesystem7__cxx114pathESt13_Ios_Openmode[_ZN3cif4gzio14basic_ifstreamIcSt11char_traitsIcEE4openERKNSt10filesystem7__cxx114pathESt13_Ios_Openmode]+0x2f9): undefined reference to `inflateInit2_'
/usr/bin/ld: validate.cpp:(.text._ZN3cif4gzio14basic_ifstreamIcSt11char_traitsIcEE4openERKNSt10filesystem7__cxx114pathESt13_Ios_Openmode[_ZN3cif4gzio14basic_ifstreamIcSt11char_traitsIcEE4openERKNSt10filesystem7__cxx114pathESt13_Ios_Openmode]+0x328): undefined reference to `inflateGetHeader'
/usr/bin/ld: validate.cpp:(.text._ZN3cif4gzio14basic_ifstreamIcSt11char_traitsIcEE4openERKNSt10filesystem7__cxx114pathESt13_Ios_Openmode[_ZN3cif4gzio14basic_ifstreamIcSt11char_traitsIcEE4openERKNSt10filesystem7__cxx114pathESt13_Ios_Openmode]+0x384): undefined reference to `inflateEnd'
/usr/bin/ld: validate.cpp:(.text._ZN3cif4gzio14basic_ifstreamIcSt11char_traitsIcEE4openERKNSt10filesystem7__cxx114pathESt13_Ios_Openmode[_ZN3cif4gzio14basic_ifstreamIcSt11char_traitsIcEE4openERKNSt10filesystem7__cxx114pathESt13_Ios_Openmode]+0x458): undefined reference to `inflateEnd'
/usr/bin/ld: /home/dbodor/DSSP/libcifpp/lib/libcifpp.a(cif2pdb.cpp.o): in function `cif::pdb::write(std::filesystem::__cxx11::path const&, cif::datablock const&)':
cif2pdb.cpp:(.text+0x67cdb): undefined reference to `deflate'
/usr/bin/ld: cif2pdb.cpp:(.text+0x67d36): undefined reference to `deflateEnd'
/usr/bin/ld: cif2pdb.cpp:(.text+0x67e8e): undefined reference to `deflate'
/usr/bin/ld: cif2pdb.cpp:(.text+0x67f0d): undefined reference to `deflateEnd'
/usr/bin/ld: cif2pdb.cpp:(.text+0x6802d): undefined reference to `deflateInit2_'
/usr/bin/ld: cif2pdb.cpp:(.text+0x6879b): undefined reference to `deflate'
/usr/bin/ld: cif2pdb.cpp:(.text+0x687f6): undefined reference to `deflateEnd'
/usr/bin/ld: cif2pdb.cpp:(.text+0x68947): undefined reference to `deflateSetHeader'
/usr/bin/ld: /home/dbodor/DSSP/libcifpp/lib/libcifpp.a(cif2pdb.cpp.o): in function `cif::gzio::basic_ostream<char, std::char_traits<char> >::~basic_ostream()':
cif2pdb.cpp:(.text._ZN3cif4gzio13basic_ostreamIcSt11char_traitsIcEED2Ev[_ZN3cif4gzio13basic_ostreamIcSt11char_traitsIcEED2Ev]+0xb5): undefined reference to `deflate'
/usr/bin/ld: cif2pdb.cpp:(.text._ZN3cif4gzio13basic_ostreamIcSt11char_traitsIcEED2Ev[_ZN3cif4gzio13basic_ostreamIcSt11char_traitsIcEED2Ev]+0x118): undefined reference to `deflateEnd'
collect2: error: ld returned 1 exit status

gcc -v:

dbodor@DESKTOP-QCBKDU1:~/git/DSSP/libcifpp/examples$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.4.0-1ubuntu1~20.04.1' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-Av3uEd/gcc-9-9.4.0/debian/tmp-nvptx/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1)

g++ -v:

bodor@DESKTOP-QCBKDU1:~/git/DSSP/libcifpp/examples$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.4.0-1ubuntu1~20.04.1' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-Av3uEd/gcc-9-9.4.0/debian/tmp-nvptx/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
mhekkel commented 1 year ago

Problem is, the pkgconfig file for libcifpp is not including zlib correctly. You can hack the libcifpp.pc file in your pkgconfig dir and add the -lz after the -lcifpp in the libs section.

I will try to fix this in a next release.

mhekkel commented 1 year ago

I've patched the trunk of libcifpp on github to include a fix for this issue.

MartinSalinas98 commented 1 year ago

Hey @mhekkel, thanks for the fix for zlib, but the installation commands still fail unless you use the ones I provided. Have you taken a look a that?

mhekkel commented 1 year ago

Hey @mhekkel, thanks for the fix for zlib, but the installation commands still fail unless you use the ones I provided. Have you taken a look a that?

Yup, accepted with a minor edit.

DaniBodor commented 1 year ago

Thanks! It works now with the setup instructions as on the main page.

I would recommend adding this test to the setup instructions to check if the user's setup went as intended.

cd /home/dbodor/DSSP/libcifpp/examples make ./example

One weird thing is that when I run this command, I get the following error:

Package libcifpp was not found in the pkg-config search path.
Perhaps you should add the directory containing `libcifpp.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libcifpp' found
Package libcifpp was not found in the pkg-config search path.
Perhaps you should add the directory containing `libcifpp.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libcifpp' found
c++ -std=c++17 -o example example.cpp
example.cpp:4:10: fatal error: cif++.hpp: No such file or directory
    4 | #include <cif++.hpp>
      |          ^~~~~~~~~~~
compilation terminated.
make: *** [makefile:8: example] Error 1

I can solve this for the current session by running: export PKG_CONFIG_PATH="/home/dbodor/git/DSSP/libcifpp/build:$PKG_CONFIG_PATH". However, if I restart Ubuntu (WSL), it has forgotten that the path was added. Adding that command to my .bashrc does nothing in this respect.

MartinSalinas98 commented 1 year ago

I'm not sure what causes that, but, just to try something out, I noticed that one command that @mhekkel actually merged is not exactly the same I wrote. My command was cmake -S . -B build -DCMAKE_INSTALL_PREFIX=$HOME/path/to/libcifpp/ -DCMAKE_BUILD_TYPE=Release, or in your specific situation cmake -S . -B build -DCMAKE_INSTALL_PREFIX=$HOME/git/DSSP/libcifpp/ -DCMAKE_BUILD_TYPE=Release His command is cmake -S . -B build -DCMAKE_INSTALL_PREFIX=$HOME/.local -DCMAKE_BUILD_TYPE=Release

Just to be sure about this, try reinstalling with my command pointing to the directory of libcifpp instead of .local, and let me know if the results vary.

mhekkel commented 1 year ago

Normally, you should install libcifpp in a system wide location like /usr/local. In that case, the pkgconfig info is picked up automatically.

If you don't want to install in the /usr/ or /usr/local directories, the proposed $HOME/.local is a good alternative. It is quickly becoming a new standard for locally installed software.

BTW. You have an export PKG_CONFIG_PATH="/home/dbodor/git/DSSP/libcifpp/build:$PKG_CONFIG_PATH"

That seems incorrect to me. The PKG_CONFIG_PATH should contain the prefix you specified while installing libcifpp. So if you did e.g.

cmake .. -DCMAKE_INSTALL_PREFIX=/mycifpppath/

Then the PKG_CONFIG_PATH should contain:

/mycifpppath/lib/pkgconfig

So the export in your .bashrc should read:

export PKG_CONFIG_PATH="/mycifpppath/lib/pkgconfig"

DaniBodor commented 1 year ago

So the export in your .bashrc should read:

export PKG_CONFIG_PATH="/mycifpppath/lib/pkgconfig"

Adding this path to .bashrc instead still gives the same issue.


I'm not sure what causes that, but, just to try something out, I noticed that one command that @mhekkel actually merged is not exactly the same I wrote. My command was cmake -S . -B build -DCMAKE_INSTALL_PREFIX=$HOME/path/to/libcifpp/ -DCMAKE_BUILD_TYPE=Release, or in your specific situation cmake -S . -B build -DCMAKE_INSTALL_PREFIX=$HOME/git/DSSP/libcifpp/ -DCMAKE_BUILD_TYPE=Release His command is cmake -S . -B build -DCMAKE_INSTALL_PREFIX=$HOME/.local -DCMAKE_BUILD_TYPE=Release

Just to be sure about this, try reinstalling with my command pointing to the directory of libcifpp instead of .local, and let me know if the results vary.

I had the same problem yesterday when I used your install command.

mhekkel commented 1 year ago

Question:

MartinSalinas98 commented 1 year ago

Normally, you should install libcifpp in a system wide location like /usr/local. In that case, the pkgconfig info is picked up automatically. If you don't want to install in the /usr/ or /usr/local directories, the proposed $HOME/.local is a good alternative. It is quickly becoming a new standard for locally installed software.

Thanks, I didn't know that!

DaniBodor commented 1 year ago

Question:

* Does the path /mycifpppath/lib/pkgconfig actually contain the libcifpp.pc file?

yes

* In a terminal, does echo $PKG_CONFIG_PATH contain this value you tried to set?

no

mhekkel commented 1 year ago

Then your export from .bashrc is not working properly.

DaniBodor commented 1 year ago

Then your export from .bashrc is not working properly.

yep, apparently another file was overriding my bashrc. Fixed it now