Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't complete Make on Ubuntu 14.04: #2

Open
waywardsyintist opened this issue Feb 8, 2017 · 8 comments
Open

Can't complete Make on Ubuntu 14.04: #2

waywardsyintist opened this issue Feb 8, 2017 · 8 comments

Comments

@waywardsyintist
Copy link

Hello,

I am trying to install and compile Karp on an Intel NUC running Ubuntu 14.04. I have cmake version 2.8.12.2

I can successfully run 'cmake ..', but when I run 'make', I get the error pasted below, and no executable in /src. It appears to refer to my zlib installation. I installed zlib using apt-get (sudo apt-get install zlib1g-dev).
I've seen other posts online referring to this error requiring a -lz flag at the end of the make file, (e.g., najoshi/sabre#1)?

Any help solving this is much appreciated! Thanks!

Make error below...

$ make
[ 93%] Built target karp_core
Linking CXX executable karp
libkarp_core.a(ProcessReads.cpp.o): In function ks_getuntil2(__kstream_t*, int, __kstring_t*, int*, int) [clone .constprop.456]': ProcessReads.cpp:(.text+0x4e): undefined reference to gzread'
libkarp_core.a(ProcessReads.cpp.o): In function kseq_read(kseq_t*)': ProcessReads.cpp:(.text+0x2ff): undefined reference to gzread'
ProcessReads.cpp:(.text+0x377): undefined reference to gzread' ProcessReads.cpp:(.text+0x548): undefined reference to gzread'
ProcessReads.cpp:(.text+0x693): undefined reference to gzread' libkarp_core.a(ProcessReads.cpp.o): In function SequenceReader::~SequenceReader()':
ProcessReads.cpp:(.text+0x1070): undefined reference to gzclose' ProcessReads.cpp:(.text+0x1084): undefined reference to gzclose'
libkarp_core.a(ProcessReads.cpp.o): In function ReadProcessor::WriteInt(std::vector<std::unordered_map<double, std::vector<unsigned int, std::allocator<unsigned int> >, std::hash<double>, std::equal_to<double>, std::allocator<std::pair<double const, std::vector<unsigned int, std::allocator<unsigned int> > > > >, std::allocator<std::unordered_map<double, std::vector<unsigned int, std::allocator<unsigned int> >, std::hash<double>, std::equal_to<double>, std::allocator<std::pair<double const, std::vector<unsigned int, std::allocator<unsigned int> > > > > > >&, gzFile_s*&, gzFile_s*&, std::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >&, LKFilter&, std::unordered_map<unsigned int, bool, std::hash<unsigned int>, std::equal_to<unsigned int>, std::allocator<std::pair<unsigned int const, bool> > >&, gzFile_s*&, std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>, std::allocator<std::pair<int const, std::string> > >&, gzFile_s*&)': ProcessReads.cpp:(.text+0x1619): undefined reference to gzwrite'
ProcessReads.cpp:(.text+0x169e): undefined reference to gzwrite' ProcessReads.cpp:(.text+0x1bc4): undefined reference to gzwrite'
ProcessReads.cpp:(.text+0x1c4e): undefined reference to gzwrite' ProcessReads.cpp:(.text+0x1ccd): undefined reference to gzwrite'
libkarp_core.a(ProcessReads.cpp.o):ProcessReads.cpp:(.text+0x1d66): more undefined references to gzwrite' follow libkarp_core.a(ProcessReads.cpp.o): In function SequenceReader::fetchSequences(char*, int, std::vector<std::pair<char const*, int>, std::allocator<std::pair<char const*, int> > >&, std::vector<std::pair<char const*, int>, std::allocator<std::pair<char const*, int> > >&, std::vector<std::pair<char const*, int>, std::allocator<std::pair<char const*, int> > >&)':
ProcessReads.cpp:(.text+0x282a): undefined reference to gzclose' ProcessReads.cpp:(.text+0x283f): undefined reference to gzclose'
ProcessReads.cpp:(.text+0x2858): undefined reference to gzopen' ProcessReads.cpp:(.text+0x2b7e): undefined reference to gzopen'
libkarp_core.a(ProcessReads.cpp.o): In function ProcessReads(KmerIndex&, ProgramOptions const&, MinCollector&, fastaIndex&, std::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >&, LKFilter&, EarlyTaxonomy&, HLK&)': ProcessReads.cpp:(.text+0x38be): undefined reference to gzopen'
ProcessReads.cpp:(.text+0x3917): undefined reference to gzwrite' ProcessReads.cpp:(.text+0x39b8): undefined reference to gzopen'
ProcessReads.cpp:(.text+0x3a17): undefined reference to gzwrite' ProcessReads.cpp:(.text+0x3a59): undefined reference to gzread'
ProcessReads.cpp:(.text+0x3a6c): undefined reference to gzclose' ProcessReads.cpp:(.text+0x3ae4): undefined reference to gzwrite'
ProcessReads.cpp:(.text+0x3b76): undefined reference to gzopen' ProcessReads.cpp:(.text+0x3bd7): undefined reference to gzwrite'
ProcessReads.cpp:(.text+0x3c19): undefined reference to gzread' ProcessReads.cpp:(.text+0x3c2c): undefined reference to gzclose'
ProcessReads.cpp:(.text+0x3cea): undefined reference to gzclose' ProcessReads.cpp:(.text+0x4782): undefined reference to gzopen'
ProcessReads.cpp:(.text+0x4831): undefined reference to gzopen' ProcessReads.cpp:(.text+0x48a1): undefined reference to gzwrite'
ProcessReads.cpp:(.text+0x48e3): undefined reference to gzread' ProcessReads.cpp:(.text+0x48f5): undefined reference to gzclose'
ProcessReads.cpp:(.text+0x496b): undefined reference to gzclose' libkarp_core.a(ProcessReads.cpp.o): In function ReadProcessor::operator()()':
ProcessReads.cpp:(.text+0x8712): undefined reference to gzopen' ProcessReads.cpp:(.text+0x879f): undefined reference to gzopen'
ProcessReads.cpp:(.text+0x8879): undefined reference to gzopen' ProcessReads.cpp:(.text+0x88bf): undefined reference to gzopen'
ProcessReads.cpp:(.text+0x8958): undefined reference to gzopen' ProcessReads.cpp:(.text+0x8b7a): undefined reference to gzwrite'
ProcessReads.cpp:(.text+0x8c44): undefined reference to gzclose' ProcessReads.cpp:(.text+0x8c4e): undefined reference to gzclose'
ProcessReads.cpp:(.text+0x8c58): undefined reference to gzclose' ProcessReads.cpp:(.text+0x8c65): undefined reference to gzclose'
ProcessReads.cpp:(.text+0x8c72): undefined reference to gzclose' libkarp_core.a(karp_like_multi.cpp.o): In function GetAbundance(LikelihoodProcessor*, int, std::unordered_map<unsigned int, double, std::hash, std::equal_to, std::allocator<std::pair<unsigned int const, double> > >, double, std::string, double)':
karp_like_multi.cpp:(.text+0xe4f): undefined reference to gzopen' karp_like_multi.cpp:(.text+0xede): undefined reference to gzread'
karp_like_multi.cpp:(.text+0x2174): undefined reference to gzclose' libkarp_core.a(karp_like_multi.cpp.o): In function HLK::GetPriors(std::basic_stringstream<char, std::char_traits, std::allocator >&)':
karp_like_multi.cpp:(.text+0x2a57): undefined reference to gzopen' karp_like_multi.cpp:(.text+0x2aa9): undefined reference to gzread'
libkarp_core.a(KmerIndex.cpp.o): In function ks_getuntil2(__kstream_t*, int, __kstring_t*, int*, int) [clone .constprop.363]': KmerIndex.cpp:(.text+0x2be): undefined reference to gzread'
libkarp_core.a(KmerIndex.cpp.o): In function KmerIndex::BuildTranscripts(ProgramOptions const&)': KmerIndex.cpp:(.text+0x8017): undefined reference to gzopen'
KmerIndex.cpp:(.text+0x80d5): undefined reference to gzread' KmerIndex.cpp:(.text+0x8216): undefined reference to gzread'
KmerIndex.cpp:(.text+0x8401): undefined reference to gzread' KmerIndex.cpp:(.text+0x8a7e): undefined reference to gzread'
KmerIndex.cpp:(.text+0x8aea): undefined reference to `gzclose'
collect2: error: ld returned 1 exit status
make[2]: *** [src/karp] Error 1
make[1]: *** [src/CMakeFiles/karp.dir/all] Error 2
make: *** [all] Error 2

@mreppell
Copy link
Owner

mreppell commented Feb 9, 2017

If you run the command 'ld -lz --verbose' does yours system find a working copy of libz? If not try running 'ldconfig' or restarting your machine. In the Karp directories, after you run cmake does the file /build/karp/karp.dir/link.txt contain a link to a libz library?

@waywardsyintist
Copy link
Author

hello,

Thanks for the quick reply! The answer to your first question appears to be no, despite what looked like a successful install. When I run 'ld -lz --verbose', here is the output...

==================================================
attempt to open /usr/x86_64-linux-gnu/lib64/libz.so failed
attempt to open /usr/x86_64-linux-gnu/lib64/libz.a failed
attempt to open //usr/local/lib/x86_64-linux-gnu/libz.so failed
attempt to open //usr/local/lib/x86_64-linux-gnu/libz.a failed
attempt to open //usr/local/lib64/libz.so failed
attempt to open //usr/local/lib64/libz.a failed
attempt to open //lib/x86_64-linux-gnu/libz.so failed
attempt to open //lib/x86_64-linux-gnu/libz.a failed
attempt to open //lib64/libz.so failed
attempt to open //lib64/libz.a failed
attempt to open //usr/lib/x86_64-linux-gnu/libz.so succeeded
-lz (//usr/lib/x86_64-linux-gnu/libz.so)
libc.so.6 needed by //usr/lib/x86_64-linux-gnu/libz.so
found libc.so.6 at //lib/x86_64-linux-gnu/libc.so.6
ld-linux-x86-64.so.2 needed by //lib/x86_64-linux-gnu/libc.so.6
found ld-linux-x86-64.so.2 at //lib/x86_64-linux-gnu/ld-linux-x86-64.so.2
ld: warning: cannot find entry symbol _start; not setting start address

I ran 'ldconfig' and also re-started my machine. When I run 'ld -lz --verbose', I still get the same output.

I have pasted what the current link.txt file, located at /build/src/CMakeFiles/karp.dir, looks like below...

$ cat link.txt
/usr/bin/c++ CMakeFiles/karp.dir/new_main.cpp.o -o karp -rdynamic libkarp_core.a -Wl,--no-as-needed -lpthread /usr/local/hdf5/lib/libhdf5.so -ldl -lm -lrt -Wl,-rpath,/usr/local/hdf5/lib:

...So it appears I am not set-up correctly. But, I am not sure what needs fixing or re-setting. From what I can tell so far, this may be related to setting the environment variable for my LD_LIBRARY_PATH, however suggested fixes on forums have not yet done the trick. I will keep googling around, but if any of the above looks familiar / points in an obvious direction, please let me know.

Thanks!

@mreppell
Copy link
Owner

From the verbose output it looks like your system is successfully finding libz at /usr/lib/x86_64-linux-gnu/libz.so, so it is a matter of CMAKE not finding it. Try deleting the build folder and restarting the entire install process. If that doesn't work when try running the cmake command as 'cmake -DCMAKE_PREFIX_PATH=/usr/lib/x86_64-linux-gnu/ ..'

@waywardsyintist
Copy link
Author

Keep trying and keep failing. Couldn't get it to work with Ubuntu 14.04, so I installed Ubuntu 16.04 and tried again. No luck, similar errors.

Now trying on my late-2015 macbook pro running OSX Yosemite with updated gcc compiler (4.9, via homebrew). I've listed the outputs of my attempt from the beginning below. It seems no matter what I do, I cannot push this rock up the hill. Three OS's, three strikes. Any insight on the outputs below would be very helpful. Thanks.

jrussellmac:src jrussell$ git clone https://github.com/mreppell/Karp.git
Cloning into 'Karp'...
remote: Counting objects: 1584, done.
remote: Total 1584 (delta 0), reused 0 (delta 0), pack-reused 1584
Receiving objects: 100% (1584/1584), 4.61 MiB | 3.76 MiB/s, done.
Resolving deltas: 100% (327/327), done.
Checking connectivity... done.
jrussellmac:src jrussell$ cd Karp
jrussellmac:Karp jrussell$ mkdir build
jrussellmac:Karp jrussell$ cd build
jrussellmac:build jrussell$ cmake -DCMAKE_CXX_COMPILER=/usr/local/bin/gcc-4.9 -DCMAKE_C_COMPILER=/usr/local/bin/gcc-4.9 -DCMAKE_PREFIX_PATH=/usr/lib/x86_64-linux-gnu/ ..
-- The C compiler identification is GNU 4.9.3
-- The CXX compiler identification is GNU 4.9.3
-- Checking whether C compiler has -isysroot
-- Checking whether C compiler has -isysroot - yes
-- Checking whether C compiler supports OSX deployment target flag
-- Checking whether C compiler supports OSX deployment target flag - yes
-- Check for working C compiler: /usr/local/bin/gcc-4.9
-- Check for working C compiler: /usr/local/bin/gcc-4.9 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Checking whether CXX compiler has -isysroot
-- Checking whether CXX compiler has -isysroot - yes
-- Checking whether CXX compiler supports OSX deployment target flag
-- Checking whether CXX compiler supports OSX deployment target flag - yes
-- Check for working CXX compiler: /usr/local/bin/gcc-4.9
-- Check for working CXX compiler: /usr/local/bin/gcc-4.9 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
shared build
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE
-- HDF5: Using hdf5 compiler wrapper to determine C configuration
-- Found HDF5: /Users/jrussell/anaconda/lib/libhdf5.dylib;/usr/lib/libpthread.dylib;/usr/lib/libz.dylib;/usr/lib/libdl.dylib;/usr/lib/libm.dylib (found version "1.8.17")
-- Found ZLIB: /usr/lib/libz.dylib (found version "1.2.5")
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/jrussell/src/Karp/build

Then, run 'make'....

jrussellmac:build jrussell$ make
Scanning dependencies of target karp_core
[ 5%] Building CXX object src/CMakeFiles/karp_core.dir/Kmer.cpp.o
[ 11%] Building CXX object src/CMakeFiles/karp_core.dir/KmerIndex.cpp.o
[ 16%] Building CXX object src/CMakeFiles/karp_core.dir/KmerIterator.cpp.o
[ 22%] Building CXX object src/CMakeFiles/karp_core.dir/MinCollector.cpp.o
[ 27%] Building CXX object src/CMakeFiles/karp_core.dir/ProcessReads.cpp.o
[ 33%] Building CXX object src/CMakeFiles/karp_core.dir/common_k.cpp.o
[ 38%] Building CXX object src/CMakeFiles/karp_core.dir/fastaIndex.cpp.o
[ 44%] Building CXX object src/CMakeFiles/karp_core.dir/hash.cpp.o
[ 50%] Building CXX object src/CMakeFiles/karp_core.dir/karp_like_multi.cpp.o
[ 55%] Building CXX object src/CMakeFiles/karp_core.dir/likelihood_filter.cpp.o
[ 61%] Building CXX object src/CMakeFiles/karp_core.dir/new_main.cpp.o
[ 66%] Building CXX object src/CMakeFiles/karp_core.dir/ssw_cpp.cpp.o
[ 72%] Building CXX object src/CMakeFiles/karp_core.dir/tabulate.cpp.o
[ 77%] Building CXX object src/CMakeFiles/karp_core.dir/taxonomy.cpp.o
[ 83%] Building C object src/CMakeFiles/karp_core.dir/ssw.c.o
cc1: warning: command line option '-std=c++11' is valid for C++/ObjC++ but not for C
[ 88%] Linking CXX static library libkarp_core.a
[ 88%] Built target karp_core
Scanning dependencies of target karp
[ 94%] Building CXX object src/CMakeFiles/karp.dir/new_main.cpp.o
[100%] Linking CXX executable karp
Undefined symbols for architecture x86_64:

then a LARGE amount of text and then...

ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make[2]: *** [src/karp] Error 1
make[1]: *** [src/CMakeFiles/karp.dir/all] Error 2
make: *** [all] Error 2

@waywardsyintist
Copy link
Author

For what it's worth (anyone who may end up here with similar issues), I solved this by installing Anaconda3-2.5.0 on my NUC running Ubuntu 16.04. I guess it remedied whatever /lib/x86_64-linux-gnu issues I was having...I'm presuming by installing something I was missing, or putting them in an easier place to find/access? Either way, I successfully made it through 'cmake..' and 'make'.

Thanks.

@mreppell
Copy link
Owner

I'm glad you were able to get the program to install, thanks for reporting back what worked for you!

@waywardsyintist
Copy link
Author

waywardsyintist commented Mar 2, 2017 via email

@mreppell
Copy link
Owner

mreppell commented Mar 7, 2017

Currently there is not a way to use multiple indices with Karp, and as I have not constructed indices for metagenomic databases I am unable to distribute pre-computed databases. Adding a feature to allow multiple indices (so that a big database can be split during index creation) is a good suggestion for a program update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants