I am trying to create a library that has only static links to libgfortran (and preferably libgcc ).
However, if I use linker flags
-static -lgfortran -static-libgfortran -static-libgcc
on OS X I get
ld: library not found for -lcrt0.o collect2: error: ld returned 1 exit status
and if I try to use
-shared -lgfortran -static-libgfortran
I get
Undefined symbols for architecture x86_64: "_quadmath_snprintf", referenced from: _write_float in libgfortran.a(write.o) "_strtoflt128", referenced from: __gfortrani_convert_real in libgfortran.a(read.o) __gfortrani_convert_infnan in libgfortran.a(read.o)
and everything compiles fine (but has a dynamic link to libgfortran and libgcc) if I use -dynamiclib -lgfortran .
It seems that gcc does not build statically in OS X.
How do I create my library so that end users do not need to install gfortran or gcc?
I am using the gcc version for macports, but I am ready to use another gfortran / gcc distributor if this allows me to do this.
source share