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

sonLib cannot find pthread_create #33

Open
bredeson opened this issue Feb 23, 2018 · 1 comment
Open

sonLib cannot find pthread_create #33

bredeson opened this issue Feb 23, 2018 · 1 comment

Comments

@bredeson
Copy link

bredeson commented Feb 23, 2018

Hey @benedictpaten,

I'm trying to compile cactus with PhyloP support and am encountering the following error:

$ make
Building dependency sonLib
Building dependency pinchesAndCacti
Building dependency matchingAndOrdering
Building dependency cPecan
Building dependency hal
cd api && make all
make[1]: Entering directory '/cactus-github/api'
cp inc/cactus*.h ../lib//
gcc -std=c99 -O3 -g -Wall --pedantic -funroll-loops -DNDEBUG  -I /cactus-github/submodules/sonLib/lib -I inc -I ../lib// -c impl/cactus*.c
ar rc cactusLib.a *.o
ranlib cactusLib.a 
rm *.o
mv cactusLib.a ../lib//
gcc -std=c99 -O3 -g -Wall --pedantic -funroll-loops -DNDEBUG  -I /cactus-github/submodules/sonLib/lib -I inc -I ../lib/ -I impl -I tests -o ../bin//cactusAPITests tests/allTests.c tests/cactus*.c ../lib//cactusLib.a /cactus-github/submodules/sonLib/lib/sonLib.a /cactus-github/submodules/sonLib/lib/cuTest.a    -lz -lm
make[1]: Leaving directory '/cactus-github/api'
cd setup && make all
make[1]: Entering directory '/cactus-github/setup'
gcc -std=c99 -O3 -g -Wall --pedantic -funroll-loops -DNDEBUG  -I /cactus-github/submodules/sonLib/lib  -I../lib/ -o ../bin//cactus_setup cactus_setup.c ../lib//cactusLib.a /cactus-github/submodules/sonLib/lib/sonLib.a /cactus-github/submodules/sonLib/lib/cuTest.a    -lz -lm
make[1]: Leaving directory '/cactus-github/setup'
cd blastLib && make all
make[1]: Entering directory '/cactus-github/blastLib'
gcc -std=c99 -O3 -g -Wall --pedantic -funroll-loops -DNDEBUG  -I /cactus-github/submodules/sonLib/lib  -I inc -I ../lib// -c blastAlignmentLib.c
ar rc cactusBlastAlignment.a *.o
ranlib cactusBlastAlignment.a 
rm *.o
mv cactusBlastAlignment.a ../lib//
cp blastAlignmentLib.h ../lib//
make[1]: Leaving directory '/cactus-github/blastLib'
cd caf && make all
make[1]: Entering directory '/cactus-github/caf'
gcc -std=c99 -O3 -g -Wall --pedantic -funroll-loops -DNDEBUG  -I /cactus-github/submodules/sonLib/lib -I inc -I ../lib// -c impl/*.c
impl/giantComponent.c: In function 'stCaf_breakupComponentGreedily':
impl/giantComponent.c:38:13: warning: variable 'edgeScore' set but not used [-Wunused-but-set-variable]
     int64_t edgeScore = INT64_MAX;
             ^
ar rc stCaf.a *.o
ranlib stCaf.a 
rm *.o
mv stCaf.a ../lib//
cp inc/*.h ../lib//
gcc -std=c99 -O3 -g -Wall --pedantic -funroll-loops -DNDEBUG  -I /cactus-github/submodules/sonLib/lib -I inc -I impl -I../lib/ -o ../bin//stCafTests tests/*.c impl/*.c ../lib//stCaf.a ../lib//cactusBlastAlignment.a /cactus-github/submodules/sonLib/lib/stPinchesAndCacti.a /cactus-github/submodules/sonLib/lib/3EdgeConnected.a ../lib//cactusLib.a /cactus-github/submodules/sonLib/lib/sonLib.a /cactus-github/submodules/sonLib/lib/cuTest.a    -lz -lm
impl/giantComponent.c: In function 'stCaf_breakupComponentGreedily':
impl/giantComponent.c:38:13: warning: variable 'edgeScore' set but not used [-Wunused-but-set-variable]
     int64_t edgeScore = INT64_MAX;
             ^
/cactus-github/submodules/sonLib/lib/sonLib.a(stThreadPool.o): In function `stThreadPool_construct':
/cactus-github/submodules/sonLib/C/impl/stThreadPool.c:144: undefined reference to `pthread_create'
/cactus-github/submodules/sonLib/C/impl/stThreadPool.c:144: undefined reference to `pthread_create'
/cactus-github/submodules/sonLib/C/impl/stThreadPool.c:144: undefined reference to `pthread_create'
/cactus-github/submodules/sonLib/C/impl/stThreadPool.c:144: undefined reference to `pthread_create'
/cactus-github/submodules/sonLib/C/impl/stThreadPool.c:144: undefined reference to `pthread_create'
/cactus-github/submodules/sonLib/lib/sonLib.a(stThreadPool.o):/cactus-github/submodules/sonLib/C/impl/stThreadPool.c:144: more undefined references to `pthread_create' follow
/cactus-github/submodules/sonLib/lib/sonLib.a(stThreadPool.o): In function `stThreadPool_destruct':
/cactus-github/submodules/sonLib/C/impl/stThreadPool.c:195: undefined reference to `pthread_join'
collect2: error: ld returned 1 exit status
Makefile:23: recipe for target '../bin//stCafTests' failed
make[1]: *** [../bin//stCafTests] Error 1
make[1]: Leaving directory '/cactus-github/caf'
Makefile:25: recipe for target 'all.caf' failed
make: *** [all.caf] Error 2

I'm following the PhyloP support instructions described in the HAL repo, trying to compile Cactus via the Cactus Makefile. I'm using gcc v4.9.2 on a custom Ubuntu-derived OS.

@joelarmstrong
Copy link
Collaborator

Hi Jessen,

You may want to make sure your Kyoto Tycoon / Tokyo Cabinet installation is being detected properly by sonLib (the detection is super naive, so if it's not installed via apt-get/brew it likely won't work without some fiddling). The -lpthread flag wasn't included in that Cactus makefile because it should be included as part of the KT/TC CFLAGS.

I fixed the missing -lpthread flag in the Cactus makefile, but if you try to run it without Kyoto installed, it'll stop partway through and whine about sonLib not being compiled with Kyoto support.

To try to force sonLib to detect your Kyoto install, you can set these gross env variables and recompile sonLib:

ttPrefix=<path of the PREFIX where you installed Kyoto>
export kyotoTycoonIncl=-I${ttPrefix}/include -DHAVE_KYOTO_TYCOON=1
export kyotoTycoonLib=-L${ttPrefix}/lib -Wl,-rpath,${ttPrefix}/lib -lkyototycoon -lkyotocabinet -lz -lbz2 -lpthread -lm -lstdc++

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