What I’m doing
I am using MacOS, and trying to run a test the igraph_edge_betweeness.c
test on the develop branch of C igraph, using the command mentioned in this comment:
https://github.com/igraph/igraph/issues/1851#issuecomment-974604878
I’ve already followed all the steps in the c installation guide, and have the igraph library fully installed. I have also been able to successfully compile and run the example program in the tutorial. My problem occurs when I try to compile the test code.
What’s happening
After removing some -L directories and libraries that I don’t have locally, I’m left with the following command.
gcc igraph_edge_betweenness.c ../../src/centrality/betweenness.c -I ../../src/ -I ../../include/ -I ../../build/include -I ../../build/src/ -ligraph -Wall -Wextra -g
However, when I run it, I get a linker error.
Undefined symbols for architecture x86_64:
"_daxpy_", referenced from:
_igraphdnaitr_ in libigraph.a(dnaitr.c.o)
_igraphdnapps_ in libigraph.a(dnapps.c.o)
_igraphdsapps_ in libigraph.a(dsapps.c.o)
"_dcopy_", referenced from:
_igraphdneupd_ in libigraph.a(dneupd.c.o)
_igraphdseupd_ in libigraph.a(dseupd.c.o)
_igraphdnaup2_ in libigraph.a(dnaup2.c.o)
_igraphdsaup2_ in libigraph.a(dsaup2.c.o)
_igraphdgetv0_ in libigraph.a(dgetv0.c.o)
_igraphdnaitr_ in libigraph.a(dnaitr.c.o)
_igraphdnapps_ in libigraph.a(dnapps.c.o)
...
"_ddot_", referenced from:
_igraphdnaup2_ in libigraph.a(dnaup2.c.o)
_igraphdsaup2_ in libigraph.a(dsaup2.c.o)
_igraphdgetv0_ in libigraph.a(dgetv0.c.o)
_igraphdnaitr_ in libigraph.a(dnaitr.c.o)
_igraphdsaitr_ in libigraph.a(dsaitr.c.o)
"_dgemv_", referenced from:
_igraphdneupd_ in libigraph.a(dneupd.c.o)
_igraphdgetv0_ in libigraph.a(dgetv0.c.o)
_igraphdnaitr_ in libigraph.a(dnaitr.c.o)
_igraphdnapps_ in libigraph.a(dnapps.c.o)
_igraphdneigh_ in libigraph.a(dneigh.c.o)
_igraphdsaitr_ in libigraph.a(dsaitr.c.o)
_igraphdsapps_ in libigraph.a(dsapps.c.o)
...
"_dgeqr2_", referenced from:
_igraphdneupd_ in libigraph.a(dneupd.c.o)
_igraphdseupd_ in libigraph.a(dseupd.c.o)
"_dger_", referenced from:
_igraphdneupd_ in libigraph.a(dneupd.c.o)
_igraphdseupd_ in libigraph.a(dseupd.c.o)
"_dlabad_", referenced from:
_igraphdnaitr_ in libigraph.a(dnaitr.c.o)
_igraphdnapps_ in libigraph.a(dnapps.c.o)
_igraphdlaqrb_ in libigraph.a(dlaqrb.c.o)
"_dlacpy_", referenced from:
_igraphdneupd_ in libigraph.a(dneupd.c.o)
_igraphdseupd_ in libigraph.a(dseupd.c.o)
_igraphdnapps_ in libigraph.a(dnapps.c.o)
_igraphdneigh_ in libigraph.a(dneigh.c.o)
_igraphdsapps_ in libigraph.a(dsapps.c.o)
"_dlaev2_", referenced from:
_igraphdstqrb_ in libigraph.a(dstqrb.c.o)
"_dlahqr_", referenced from:
_igraphdneupd_ in libigraph.a(dneupd.c.o)
"_dlamch_", referenced from:
_igraphdnaupd_ in libigraph.a(dnaupd.c.o)
_igraphdneupd_ in libigraph.a(dneupd.c.o)
_igraphdsaupd_ in libigraph.a(dsaupd.c.o)
_igraphdseupd_ in libigraph.a(dseupd.c.o)
_igraphdnaup2_ in libigraph.a(dnaup2.c.o)
_igraphdsaup2_ in libigraph.a(dsaup2.c.o)
_igraphdnaitr_ in libigraph.a(dnaitr.c.o)
...
"_dlanhs_", referenced from:
_igraphdnaitr_ in libigraph.a(dnaitr.c.o)
_igraphdnapps_ in libigraph.a(dnapps.c.o)
_igraphdlaqrb_ in libigraph.a(dlaqrb.c.o)
"_dlanst_", referenced from:
_igraphdstqrb_ in libigraph.a(dstqrb.c.o)
"_dlanv2_", referenced from:
_igraphdlaqrb_ in libigraph.a(dlaqrb.c.o)
"_dlapy2_", referenced from:
_igraphdneupd_ in libigraph.a(dneupd.c.o)
_igraphdsortc_ in libigraph.a(dsortc.c.o)
_igraphdnaup2_ in libigraph.a(dnaup2.c.o)
_igraphdnapps_ in libigraph.a(dnapps.c.o)
_igraphdnconv_ in libigraph.a(dnconv.c.o)
_igraphdneigh_ in libigraph.a(dneigh.c.o)
_igraphdstqrb_ in libigraph.a(dstqrb.c.o)
...
"_dlarf_", referenced from:
_igraphdnapps_ in libigraph.a(dnapps.c.o)
"_dlarfg_", referenced from:
_igraphdnapps_ in libigraph.a(dnapps.c.o)
_igraphdlaqrb_ in libigraph.a(dlaqrb.c.o)
"_dlarnv_", referenced from:
_igraphdgetv0_ in libigraph.a(dgetv0.c.o)
"_dlartg_", referenced from:
_igraphdnapps_ in libigraph.a(dnapps.c.o)
_igraphdsapps_ in libigraph.a(dsapps.c.o)
_igraphdstqrb_ in libigraph.a(dstqrb.c.o)
"_dlascl_", referenced from:
_igraphdnaitr_ in libigraph.a(dnaitr.c.o)
_igraphdsaitr_ in libigraph.a(dsaitr.c.o)
_igraphdstqrb_ in libigraph.a(dstqrb.c.o)
"_dlaset_", referenced from:
_igraphdneupd_ in libigraph.a(dneupd.c.o)
_igraphdnapps_ in libigraph.a(dnapps.c.o)
_igraphdsapps_ in libigraph.a(dsapps.c.o)
"_dlasr_", referenced from:
_igraphdstqrb_ in libigraph.a(dstqrb.c.o)
"_dnrm2_", referenced from:
_igraphdneupd_ in libigraph.a(dneupd.c.o)
_igraphdseupd_ in libigraph.a(dseupd.c.o)
_igraphdnaup2_ in libigraph.a(dnaup2.c.o)
_igraphdsaup2_ in libigraph.a(dsaup2.c.o)
_igraphdgetv0_ in libigraph.a(dgetv0.c.o)
_igraphdnaitr_ in libigraph.a(dnaitr.c.o)
_igraphdneigh_ in libigraph.a(dneigh.c.o)
...
"_dorm2r_", referenced from:
_igraphdneupd_ in libigraph.a(dneupd.c.o)
_igraphdseupd_ in libigraph.a(dseupd.c.o)
"_drot_", referenced from:
_igraphdlaqrb_ in libigraph.a(dlaqrb.c.o)
"_dscal_", referenced from:
_igraphdneupd_ in libigraph.a(dneupd.c.o)
_igraphdseupd_ in libigraph.a(dseupd.c.o)
_igraphdnaitr_ in libigraph.a(dnaitr.c.o)
_igraphdnapps_ in libigraph.a(dnapps.c.o)
_igraphdneigh_ in libigraph.a(dneigh.c.o)
_igraphdsaitr_ in libigraph.a(dsaitr.c.o)
_igraphdsapps_ in libigraph.a(dsapps.c.o)
...
"_dsteqr_", referenced from:
_igraphdseupd_ in libigraph.a(dseupd.c.o)
"_dswap_", referenced from:
_igraphdsaup2_ in libigraph.a(dsaup2.c.o)
_igraphdsesrt_ in libigraph.a(dsesrt.c.o)
_igraphdsgets_ in libigraph.a(dsgets.c.o)
"_dtrevc_", referenced from:
_igraphdneupd_ in libigraph.a(dneupd.c.o)
_igraphdneigh_ in libigraph.a(dneigh.c.o)
"_dtrmm_", referenced from:
_igraphdneupd_ in libigraph.a(dneupd.c.o)
"_dtrsen_", referenced from:
_igraphdneupd_ in libigraph.a(dneupd.c.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
What I’ve tried
A quick google search of “daxpy”, “dcopy”, etc. tells me that these are functions from the Lapack package. This is strange to me, as Lapack is available by default for MacOS, and even if not, it is listed as one of the packages that igraph bundles.
I’ve tried a number of different things to get this to work. (I’m new to this, so excuse me if some of these attempts are nonsensical)
- Tried including lapack explictly (
-llapack
). This gave the exact same error.
gcc igraph_edge_betweenness.c ../../src/centrality/betweenness.c -I ../../src/ -I ../../include/ -I ../../build/include -I ../../build/src/ -llapack -ligraph -Wall -Wextra -g
- Installed lapack separately via homebrew, and then added the include and library directories directly into gcc. Still same error.
gcc igraph_edge_betweenness.c ../../src/centrality/betweenness.c -I ../../src/ -I ../../include/ -I ../../build/include -I ../../build/src/ -I /usr/local/Cellar/lapack/3.10.0/include -L /usr/local/Cellar/lapack/3.10.0/lib -llapack -ligraph -Wall -Wextra -g
Other notes
Something I’ve noticed is that if I remove the line #include "test_utilities.inc"
from igraph_edge_betweeness.c
, as well as all references to print_vector
and VERIFY_FINALLY_STACK
, then once again the code is able to compile and run.