Anchit Jain
Anchit Jain

Reputation: 179

math.h not being included even when it is included in makefile

I am trying to build SPRO from http://www.irisa.fr/metiss/guig/spro

They use Automake 1.6.2 to generate the makefile.

My issue is that when I am trying to make the project I am getting the error

"undefined reference to 'sin' " etc.

Here is the error image

enter image description here

This error is due to the fact that math library is not being included with -lm flag but -lm is present in makefile.am

Here is my makefile.am

AUTOMAKE_OPTIONS = 1.4 foreign

ACLOCAL_AMFLAGS = -I auxdir

LDADD    = -lm -L. -lspro @sphere_lib@
INCLUDES = @sphere_include@

include_HEADERS = spro.h
lib_LIBRARIES = libspro.a
noinst_HEADERS = getopt.h

libspro_a_SOURCES = system.h spro.h sig.c spf.c header.c misc.c lpc.c   convert.c fft.c

bin_PROGRAMS = scopy slpc slpcep sfbank sfbcep
noinst_PROGRAMS = scompare

scopy_SOURCES = scopy.c getopt.c getopt1.c
scopy_DEPENDENCIES = libspro.a

slpc_SOURCES = slpc.c getopt.c getopt1.c
slpc_DEPENDENCIES = libspro.a

slpcep_SOURCES = slpcep.c getopt.c getopt1.c
slpcep_DEPENDENCIES = libspro.a

sfbank_SOURCES = sfbank.c getopt.c getopt1.c
sfbank_DEPENDENCIES = libspro.a

sfbcep_SOURCES = sfbcep.c getopt.c getopt1.c
sfbcep_DEPENDENCIES = libspro.a

scompare_SOURCES = scompare.c getopt.c getopt1.c
scompare_DEPENDENCIES = libspro.a

SUBDIRS = doc auxdir test
EXTRA_DIST = README INSTALL COPYING CHANGES

Can anyone guide me how to fix this issue?

Upvotes: 3

Views: 337

Answers (1)

Erik Man
Erik Man

Reputation: 844

Change the order of the dependencies (if libA needs symbols from libB then the order should be -lA -lB). So it should be:

LDADD    = -L. -lspro @sphere_lib@ -lm

Upvotes: 6

Related Questions