Undefined references

22 views
Skip to first unread message

Derek Olson

unread,
Sep 26, 2018, 6:53:03 PM9/26/18
to libflame-discuss
During the linking stage, I get the following errors (below) - I'm using the static library. I ran nm on libflame.a, and it confirms that these symbols are exported. I've copied the relevant lines from my makefile below. I suspect this is user error and I'm not linking properly or something. I am using gcc 7.2.0. The admins at my institution's HPC have also taken a crack at this, and have run into the same issues when trying to build libflame's example codes.

Thanks,
Derek

linker errors:

$HOME/src/bem2d/bem2dImpedanceBroadbandApproxFLAME.c:1714: undefined reference to `FLA_Init'
$HOME/bem2d/bem2dImpedanceBroadbandApproxFLAME.c:1733: undefined reference to `FLA_Obj_create_without_buffer'
$HOME/src/bem2d/bem2dImpedanceBroadbandApproxFLAME.c:1736: undefined reference to `FLA_Obj_attach_buffer'
$HOME/src/bem2d/bem2dImpedanceBroadbandApproxFLAME.c:1750: undefined reference to `FLA_LU_piv'
$HOME/src/bem2d/bem2dImpedanceBroadbandApproxFLAME.c:1756: undefined reference to `FLA_LU_piv_solve’

lines from Makefile

CC=gcc
CCFLAGS= -v -Wall \
-I /usr/include \
-I $HOME/src/hdf5/include \


LDFLAGSAMD = -L /usr/lib64 \
-L $HOME/src/hdf5/lib/ \
-Wl,-Bdynamic -lhdf5 \
-Wl,-Bdynamic -lhdf5_hl \
-Wl,-Bdynamic -lm \
-Wl,-Bstatic -lflame


cibbaf:
$(CC) $(CCFLAGS) -g -Wno-unused-function $(LDFLAGSAMD) bem2dImpedanceBroadbandApproxFLAME.c -o bem2d_i_bbaf.bin
chmod +x bem2d_i_bbaf.bin

Field G. Van Zee

unread,
Sep 26, 2018, 7:06:12 PM9/26/18
to libflame...@googlegroups.com
Derek,

Sorry about your linking issues. I don't normally recommend compiling
and linking as part of the same command, though it usually works for
simple programs. Moving your linker flags after your .c file on the
compile/link command *may* fix things. If not, try replacing your entire
cibbaf rule with two rules--one for compiling and one for linking:

cibbaf.o: bem2dImpedanceBroadbandApproxFLAME.c
$(CC) $(CCFLAGS) -g -Wno-unused-function \
-c bem2dImpedanceBroadbandApproxFLAME.c \
-o bem2dImpedanceBroadbandApproxFLAME.o

cibbaf: cibbaf.o
$(CC) bem2dImpedanceBroadbandApproxFLAME.o \
$(LDFLAGSAMD) \
-o bem2d_i_bbaf.bin

Remember to use tabs for the first lines of each rule after the initial
line that specifies the target and prerequisites. (Tabs have special
meaning in make syntax.)

Field

Derek Olson

unread,
Sep 27, 2018, 1:04:22 AM9/27/18
to libflame-discuss
Field,

Thanks for the help. I split the rule into two as you suggested and that did the trick.

Derek
Reply all
Reply to author
Forward
0 new messages