Hi, I have a similar problem with fortran libraries and MathLink, even using your advice to include
-Wl,--start-group .... -Wl,--end-group -Wl,--no-as-needed.
The makefile (in the context of FormCalc-8.5) contains
mcc $(MCFLAGS) -o $@ $*.tm $*.o $(LIBS) $(STDLIBS) $(LDFLAGS) $(MCLIBS)
As a modification I tried
mcc $(MCFLAGS) -o $@ $*.tm $*.o -Wl,--start-group $(LIBS) $(STDLIBS) $(LDFLAGS) $(MCLIBS) -Wl,--end-group -Wl,--no-as-needed
This generates
mcc -b64 -o run run.tm run.o -Wl,--start-group renconst.a squaredme.a util.a ../../../../FeynHiggs-2.10.2/x86_64-Linux/lib64/libFH.a ../../../LoopTools/x86_64-Linux/lib64/libooptools.a -L/usr/lib/gcc/x86_64-linux-gnu/4.8 -L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../.. -lgfortran -lm -lgcc_s -lgcc -lquadmath -lm -lgcc_s -lgcc -lgcc_s -lgcc -lpthread -Wl,--end-group -Wl,--no-as-needed
However, the output of make contains many undefined references to _gfortran:
run.tm.c: + exec gcc -O3 -g -march=native -std=gnu99 -fomit-frame-pointer -ffast-math -m64 -Iutil//cuba/common -I. -DHAVE_CONFIG_H -I. -I./C -I. -I. -I../../../LoopTools/x86_64-Linux/lib64/../include -I../../../LoopTools/x86_64-Linux/lib64 -I../../../../FeynHiggs-2.10.2/x86_64-Linux/lib64/../include -I../../../../FeynHiggs-2.10.2/x86_64-Linux/lib64 -Irenconst/ -I/usr/local/Wolfram/Mathematica/10.0/SystemFiles/Links/MathLink/DeveloperKit/Linux-x86-64/CompilerAdditions -m64 -o run.tm.o run.tm.c -c
+ exec g++ -m64 -I/usr/local/Wolfram/Mathematica/10.0/SystemFiles/Links/MathLink/DeveloperKit/Linux-x86-64/CompilerAdditions -m64 -o run run.tm.o run.o renconst.a squaredme.a util.a ../../../../FeynHiggs-2.10.2/x86_64-Linux/lib64/libFH.a ../../../LoopTools/x86_64-Linux/lib64/libooptools.a /usr/local/Wolfram/Mathematica/10.0/SystemFiles/Links/MathLink/DeveloperKit/Linux-x86-64/CompilerAdditions/libML64i4.so -L/usr/local/Wolfram/Mathematica/10.0/SystemFiles/Libraries/Linux-x86-64/ -lm -lpthread -lrt -ldl -luuid
run.o: In function `cuba_':
/./F/xsection.F:681: undefined reference to `_gfortran_st_write'
/./F/xsection.F:681: undefined reference to `_gfortran_transfer_character_write'
/./F/xsection.F:681: undefined reference to `_gfortran_st_write_done'
/./F/xsection.F:696: undefined reference to `_gfortran_st_write'
/./F/xsection.F:696: undefined reference to `_gfortran_transfer_character_write'
/./F/xsection.F:696: undefined reference to `_gfortran_transfer_integer_write'
/./F/xsection.F:696: undefined reference to `_gfortran_st_write_done'
...
/LoopTools-2.12/build/ffdcxs.F:502: undefined reference to `_gfortran_st_write_done'
/LoopTools-2.12/build/ffdcxs.F:503: undefined reference to `_gfortran_stop_string'
collect2: error: ld returned 1 exit status
I use Kubuntu-14.04.2, Mathematica 10.0 and gfortran.
Do you have any suggestion how to fix this? Thanks a lot in advance!