Subject: metis-edf: FTBFS - missing link at math Package: metis-edf Severity: normal
metis-edf fails to build on Ubuntu. Bits from my pbuilder: ... io.c: In function 'ReadMesh': io.c:308:9: warning: 'esize' may be used uninitialized in this function [-Wuninitialized] gfortran -Wl,-Bsymbolic-functions -Wl,-z,relro -L. -L.. -o ../pmetis pmetis.o io.o -L.. -lmetis-edf -lm ../libmetis-edf.so: undefined reference to `sqrtf' ../libmetis-edf.so: undefined reference to `log' ../libmetis-edf.so: undefined reference to `pow' collect2: ld returned 1 exit status make[2]: *** [../pmetis] Error 1 It seems that Makefile lacks math linking somewhere. To fix problem, plase add '-lm' at "../libmetis-edf.so" in Libs/Makefile - $(CC) $(LDFLAGS) -shared -o $@ $(OBJS) -Wl,-soname,libmetis-edf.so.4.1 + $(CC) $(LDFLAGS) -shared -o $@ $(OBJS) -Wl,-soname,libmetis-edf.so.4.1 -lm In attachment you can find a update version of Makefile.patch fixing this issue. Thanks a lot! Leo Iannacone. -- System Information: Debian Release: wheezy/sid APT prefers oneiric-updates APT policy: (500, 'oneiric-updates'), (500, 'oneiric'), (100, 'oneiric-backports') Architecture: i386 (i686) Kernel: Linux 3.0.0-13-generic (SMP w/2 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash
--- a/Makefile +++ b/Makefile @@ -5,29 +5,21 @@ SUBDIRS=Lib Programs CONFDIR=./CONFIG -default: Makefile.in onmetis.exe pmetis kmetis tests +default: Makefile.in libs programs -onmetis.exe: Makefile.in - for d in $(SUBDIRS); do \ - (cd $$d && $(MAKE)); \ - done - -pmetis: Makefile.in - for d in $(SUBDIRS); do \ - (cd $$d && $(MAKE)); \ - done +libs: Makefile.in + (cd Lib && $(MAKE)) -kmetis: Makefile.in +programs: Makefile.in for d in $(SUBDIRS); do \ (cd $$d && $(MAKE)); \ done - tests: cd Test ; make -clean: +clean: Makefile.in for d in $(SUBDIRS) Test; do \ (cd $$d && $(MAKE) $@); \ done @@ -42,5 +34,6 @@ # config : define variables depends on platform # Linux, IRIX64, SunOS (SOLARIS/SOLARIS64), OSF1 (TRU64) Makefile.in: + echo "Creating Makefile.in" sh $(CONFDIR)/configure --- a/Lib/Makefile +++ b/Lib/Makefile @@ -2,7 +2,6 @@ INCLUDES = -I. -CFLAGS = $(COPTIONS) $(INCLUDES) LD = $(CC) -L. @@ -17,14 +16,23 @@ mrefine2.o minitpart2.o mbalance2.o mfm2.o \ kvmetis.o kwayvolrefine.o kwayvolfm.o subdomains.o +all: ../libmetis-edf.a ../libmetis-edf.so + + .c.o: - $(CC) $(CFLAGS) -c $*.c + $(CC) $(COPTIONS) $(INCLUDES) -c $*.c -../libmetis.a: $(OBJS) +../libmetis-edf.a: $(OBJS) $(AR) $@ $(OBJS) +../libmetis-edf.so: $(OBJS) + $(CC) $(LDFLAGS) -shared -o $@ $(OBJS) -Wl,-soname,libmetis-edf.so.4.1 -lm + (cd .. && mv libmetis-edf.so libmetis-edf.so.4.1) + (cd .. && ln -s libmetis-edf.so.4.1 libmetis-edf.so.4) + (cd .. && ln -s libmetis-edf.so.4 libmetis-edf.so) + clean: rm -f *.o distclean: - rm -f *.o ; rm -f ../libmetis.a + rm -f *.o ; rm -f ../libmetis.a ../libmetis.so* --- a/Test/Makefile +++ b/Test/Makefile @@ -4,12 +4,12 @@ vers_check: @echo "### Test 2 : test --version option, onmetis returns :" - (../onmetis --version ; exit 0) + (export LD_LIBRARY_PATH=..; ../onmetis.exe --version ; exit 0) @echo " " fort.85 : fort.81 @echo "### Test 1 : data file produced by Code_Aster" - ../onmetis fort.81 + (export LD_LIBRARY_PATH=..; ../onmetis.exe fort.81; exit 0) @echo " " clean: --- a/Programs/Makefile +++ b/Programs/Makefile @@ -3,10 +3,8 @@ BINDIR = .. INCLUDES = -I../Lib -CFLAGS = $(COPTIONS) $(INCLUDES) -FFLAGS = $(FOPTIONS) $(INCLUDES) -LIBS = -lmetis -lm -METISLIB = ../libmetis.a +LIBS = -L.. -lmetis-edf -lm +METISLIB = ONMETISOBJS = onmetis.o io_aster.o smbfactor.o ecri11.o lect11.o lect00.o @@ -16,21 +14,21 @@ .c.o: - $(CC) $(CFLAGS) -c $*.c + $(CC) $(COPTIONS) $(INCLUDES) -c $*.c default: $(BINDIR)/onmetis.exe $(BINDIR)/pmetis $(BINDIR)/kmetis -$(BINDIR)/onmetis.exe: $(ONMETISOBJS) $(METISLIB) +$(BINDIR)/onmetis.exe: $(ONMETISOBJS) $(LD) $(LDOPTIONS) -o $@ $(ONMETISOBJS) $(LIBS) chmod 755 $@ -$(BINDIR)/pmetis: $(PMETISOBJS) $(METISLIB) +$(BINDIR)/pmetis: $(PMETISOBJS) $(LD) $(LDOPTIONS) -o $@ $(PMETISOBJS) $(LIBS) chmod 755 $@ -$(BINDIR)/kmetis: $(KMETISOBJS) $(METISLIB) +$(BINDIR)/kmetis: $(KMETISOBJS) $(LD) $(LDOPTIONS) -o $@ $(KMETISOBJS) $(LIBS) chmod 755 $@ @@ -38,11 +36,11 @@ clean: rm -f *.o ecri11.o:ecri11.f - $(F90) $(FFLAGS) -c ecri11.f + $(F90) $(FOPTIONS) $(INCLUDES) -c ecri11.f lect11.o:lect11.f - $(F90) $(FFLAGS) -c lect11.f + $(F90) $(FOPTIONS) $(INCLUDES) -c lect11.f lect00.o:lect00.f - $(F90) $(FFLAGS) -c lect00.f + $(F90) $(FOPTIONS) $(INCLUDES) -c lect00.f distclean: rm -f *.o ;\ rm -f $(BINDIR)/onmetis.exe ;