vladchimescu / lpsymphony

3 stars 5 forks source link

configure: error: linking to Fortran libraries from C fails #5

Open grimbough opened 3 years ago

grimbough commented 3 years ago
* installing *source* package ‘lpsymphony’ ...
** using staged installation
configure: loading site script /tmp/RtmpDCNb50/R.INSTALL12889754599a5/lpsymphony/src/SYMPHONY/share/config.site
checking build system type... x86_64-unknown-linux-gnu
checking whether we want to compile in debug mode... no
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether x86_64-conda_cos6-linux-gnu-gcc accepts -g... yes
checking for x86_64-conda_cos6-linux-gnu-gcc option to accept ANSI C... none needed
configure: C compiler options are: -w -g -O2
checking whether we are using the GNU C++ compiler... yes
checking whether /jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/x86_64-conda_cos6-linux-gnu-c++ accepts -g... yes
checking whether C++ compiler /jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/x86_64-conda_cos6-linux-gnu-c++ works... yes
configure: C++ compiler options are: -w -g -O2
configure: Trying to determine Fortran compiler name
checking whether we are using the GNU Fortran 77 compiler... yes
checking whether /jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/x86_64-conda_cos6-linux-gnu-gfortran accepts -g... yes
configure: Fortran compiler options are: -fopenmp -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/include
checking for egrep... grep -E
checking whether ln -s works... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for style of include used by make... GNU
checking dependency style of x86_64-conda_cos6-linux-gnu-gcc... none
checking dependency style of /jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/x86_64-conda_cos6-linux-gnu-c++... none
checking whether to enable maintainer-specific portions of Makefiles... no
checking host system type... x86_64-unknown-linux-gnu
checking for a sed that does not truncate output... /usr/bin/sed
checking for ld used by x86_64-conda_cos6-linux-gnu-gcc... /jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/x86_64-conda_cos6-linux-gnu-ld
checking if the linker (/jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/x86_64-conda_cos6-linux-gnu-ld) is GNU ld... yes
checking for /jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/x86_64-conda_cos6-linux-gnu-ld option to reload object files... -r
checking for BSD-compatible nm... /jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/x86_64-conda_cos6-linux-gnu-nm
checking how to recognise dependent libraries... pass_all
checking how to run the C preprocessor... /jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/x86_64-conda_cos6-linux-gnu-cpp
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking how to run the C++ preprocessor... /jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/x86_64-conda_cos6-linux-gnu-c++ -E
checking the maximum length of command line arguments... 32768
checking command to parse /jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/x86_64-conda_cos6-linux-gnu-nm output from x86_64-conda_cos6-linux-gnu-gcc object... ok
checking for objdir... .libs
checking for ar... /jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/x86_64-conda_cos6-linux-gnu-ar
checking for ranlib... /jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/x86_64-conda_cos6-linux-gnu-ranlib
checking for strip... /jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/x86_64-conda_cos6-linux-gnu-strip
checking if x86_64-conda_cos6-linux-gnu-gcc supports -fno-rtti -fno-exceptions... yes
checking for x86_64-conda_cos6-linux-gnu-gcc option to produce PIC... -fPIC
checking if x86_64-conda_cos6-linux-gnu-gcc PIC flag -fPIC works... yes
hecking if x86_64-conda_cos6-linux-gnu-gcc supports -c -o file.o... yes
checking whether the x86_64-conda_cos6-linux-gnu-gcc linker (/jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/x86_64-conda_cos6-linux-gnu-ld -m elf_x86_64) supports shared libraries... yes
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... no
checking whether to build static libraries... yes
configure: creating libtool
appending configuration tag "CXX" to libtool
checking for ld used by /jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/x86_64-conda_cos6-linux-gnu-c++... /jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/x86_64-conda_cos6-linux-gnu-ld -m elf_x86_64
checking if the linker (/jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/x86_64-conda_cos6-linux-gnu-ld -m elf_x86_64) is GNU ld... yes
checking whether the /jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/x86_64-conda_cos6-linux-gnu-c++ linker (/jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/x86_64-conda_cos6-linux-gnu-ld -m elf_x86_64) supports shared libraries... yes
checking for /jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/x86_64-conda_cos6-linux-gnu-c++ option to produce PIC... -fPIC
checking if /jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/x86_64-conda_cos6-linux-gnu-c++ PIC flag -fPIC works... yes
checking if /jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/x86_64-conda_cos6-linux-gnu-c++ static flag -static works... yes
checking if /jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/x86_64-conda_cos6-linux-gnu-c++ supports -c -o file.o... yes
checking whether the /jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/x86_64-conda_cos6-linux-gnu-c++ linker (/jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/x86_64-conda_cos6-linux-gnu-ld -m elf_x86_64) supports shared libraries... yes
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
appending configuration tag "F77" to libtool
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... no
checking whether to build static libraries... yes
checking for /jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/x86_64-conda_cos6-linux-gnu-gfortran option to produce PIC... -fPIC
checking if /jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/x86_64-conda_cos6-linux-gnu-gfortran PIC flag -fPIC works... yes
checking if /jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/x86_64-conda_cos6-linux-gnu-gfortran static flag -static works... no
checking if /jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/x86_64-conda_cos6-linux-gnu-gfortran supports -c -o file.o... yes
checking whether the /jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/x86_64-conda_cos6-linux-gnu-gfortran linker (/jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/x86_64-conda_cos6-linux-gnu-ld -m elf_x86_64) supports shared libraries... yes
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
configure: Build is "x86_64-unknown-linux-gnu".
checking if library version is set... no
checking whether source of project Blas is available and should be compiled... no, source file ./ThirdParty/Blas/daxpy.f not available
checking whether source of project Lapack is available and should be compiled... no, source file ./ThirdParty/Lapack/LAPACK/SRC/dlarf.f not available
checking whether source of project Glpk is available and should be compiled... no, source file ./ThirdParty/Glpk/glpk/src/glplpx01.c not available
checking whether source of project Sample is available and should be compiled... no
checking whether source of project miblib3 is available and should be compiled... no
checking whether source of project CoinUtils is available and should be compiled... yes, source in CoinUtils
checking whether source of project Osi is available and should be compiled... yes, source in Osi
checking whether source of project Clp is available and should be compiled... yes, source in Clp
checking whether source of project Cgl is available and should be compiled... yes, source in Cgl
checking whether source of project DyLP is available and should be compiled... no
checking whether source of project Vol is available and should be compiled... no
checking whether source of project SYMPHONY is available and should be compiled... yes, source in SYMPHONY
checking whether Clp is required... yes
checking which command should be used to link input files... ln -s
configure: creating ./config.status
config.status: creating Makefile
config.status: executing depfiles commands
configure: configuring in CoinUtils
configure: running /bin/sh './configure' --prefix=/tmp/RtmpDCNb50/R.INSTALL12889754599a5/lpsymphony/src/SYMPHONY  '--enable-static' '--disable-shared' '--with-pic' '--with-application=no' '--disable-dependency-tracking' '--disable-zlib' '--disable-bzlib' '--disable-cplex-libcheck' '--disable-glpk-libcheck' '--disable-osl-libcheck' '--disable-soplex-libcheck' '--disable-xpress-libcheck' 'CFLAGS=-w -g -O2' 'CXXFLAGS=-w -g -O2' 'CC=x86_64-conda_cos6-linux-gnu-gcc' 'CPPFLAGS=-DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/include' 'CPP=/jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/x86_64-conda_cos6-linux-gnu-cpp' 'CXX=/jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/x86_64-conda_cos6-linux-gnu-c++' 'F77=/jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/x86_64-conda_cos6-linux-gnu-gfortran' 'FFLAGS=-fopenmp -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/include' 'LDFLAGS=-Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,--disable-new-dtags -Wl,--gc-sections -Wl,-rpath,/jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/lib -Wl,-rpath-link,/jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/lib -L/jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/lib' --cache-file=/dev/null --srcdir=.
configure: loading site script /tmp/RtmpDCNb50/R.INSTALL12889754599a5/lpsymphony/src/SYMPHONY/share/config.site
checking build system type... x86_64-unknown-linux-gnu
checking for svnversion... yes
checking whether we want to compile in debug mode... no
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether x86_64-conda_cos6-linux-gnu-gcc accepts -g... yes
checking for x86_64-conda_cos6-linux-gnu-gcc option to accept ANSI C... none needed
configure: C compiler options are: -w -g -O2   -DCOINUTILS_BUILD
checking whether we are using the GNU C++ compiler... yes
checking whether /jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/x86_64-conda_cos6-linux-gnu-c++ accepts -g... yes
checking whether C++ compiler /jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/x86_64-conda_cos6-linux-gnu-c++ works... yes
configure: C++ compiler options are: -w -g -O2   -DCOINUTILS_BUILD
configure: Trying to determine Fortran compiler name
checking whether we are using the GNU Fortran 77 compiler... yes
checking whether /jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/x86_64-conda_cos6-linux-gnu-gfortran accepts -g... yes
configure: Fortran compiler options are: -fopenmp -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/include
checking how to get verbose linking output from /jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/x86_64-conda_cos6-linux-gnu-gfortran... -v
checking for Fortran libraries of /jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/x86_64-conda_cos6-linux-gnu-gfortran...  -lm' -L/jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/lib -L/jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0 -L/jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/../lib/gcc -L/jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/lib/../lib -L/jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/../x86_64-conda_cos6-linux-gnu/sysroot/lib/../lib -L/jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/../x86_64-conda_cos6-linux-gnu/sysroot/usr/lib/../lib -L/jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/lib -L/jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/../x86_64-conda_cos6-linux-gnu/sysroot/lib -L/jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/../x86_64-conda_cos6-linux-gnu/sysroot/usr/lib -lgfortran -lm -lgomp -lgcc_s -lquadmath -lpthread
configure: Corrected Fortran libraries:  -lm' -L/jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/lib -L/jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0 -L/jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/../lib/gcc -L/jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/lib/../lib -L/jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/../x86_64-conda_cos6-linux-gnu/sysroot/lib/../lib -L/jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/../x86_64-conda_cos6-linux-gnu/sysroot/usr/lib/../lib -L/jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/lib -L/jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/../x86_64-conda_cos6-linux-gnu/sysroot/lib -L/jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/bin/../x86_64-conda_cos6-linux-gnu/sysroot/usr/lib -lgfortran -lm -lgomp -lquadmath -lpthread
checking for dummy main to link with Fortran libraries... unknown
configure: error: linking to Fortran libraries from C fails
See `config.log' for more details.
configure: error: /bin/sh './configure' failed for CoinUtils
** libs
make[1]: Entering directory '/tmp/RtmpDCNb50/R.INSTALL12889754599a5/lpsymphony/src/SYMPHONY'
Making all in CoinUtils
make[2]: Entering directory '/tmp/RtmpDCNb50/R.INSTALL12889754599a5/lpsymphony/src/SYMPHONY/CoinUtils'
make[2]: *** No rule to make target 'all'.  Stop.
make[2]: Leaving directory '/tmp/RtmpDCNb50/R.INSTALL12889754599a5/lpsymphony/src/SYMPHONY/CoinUtils'
make[1]: *** [Makefile:324: all-recursive] Error 1
make[1]: Leaving directory '/tmp/RtmpDCNb50/R.INSTALL12889754599a5/lpsymphony/src/SYMPHONY'
make: *** [Makevars:13: SYMPHONY.ts] Error 2
ERROR: compilation failed for package ‘lpsymphony’
* removing ‘/jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-4.0/R/4.0/lib64/R/site-library/lpsymphony’
grimbough commented 3 years ago

@kasperdanielhansen I'm not sure how to go about replicating your setup for debugging this, but I thought it'd be useful to have an issue to track suggestions.

After a cursory look over the log, I'm suspicious about the apostrophe in -lm' on the configure: Corrected Fortran libraries: line (also the line above that). I'm not sure where it's coming from, but I've seed stray apostrophes mess up linking lines before.

kasperdanielhansen commented 3 years ago

Well, while it is custom, it is the department-wide installation of R on our HPC with around ~800 packages installed (although I guess that's "only") and many users.

I agree the tick seems weird. Could have been a copy and paste error, I had to do this via screen so I could only get a screenful at a time.

Looking at the configure script I do see a lot of potential issues, some of which are related to my issue. In line 94 you start the configure script inside of src/SYMPHONY. Here, you by-pass the system level CFLAGS and CXXFLAGS. You should grab both of these from R CMD config and you should also grab FFLAGS. The current approach only works on systems where you don't need custom library paths.

Fixing this makes the package install on my system. I did the following

     94         else
     95             (cd src/SYMPHONY && \
     96                 ./configure \
     97                 --enable-static --disable-shared --with-pic \
     98                 --with-application=no --disable-dependency-tracking \
     99                 --disable-zlib --disable-bzlib \
    100                 --disable-cplex-libcheck --disable-glpk-libcheck \
    101                 --disable-osl-libcheck --disable-soplex-libcheck \
    102                 --disable-xpress-libcheck \
    103                 CC="`${R} CMD config CC`" \
    104                 CFLAGS="`${R} CMD config CFLAGS`" \
    105                 CXX="`${R} CMD config CXX`" \
    106                 CXXFLAGS="`${R} CMD config CXXFLAGS`" \
    107                 F77="`${R} CMD config FC`" \
    108                 FFLAGS="`${R} CMD config FFLAGS`" \
    109                 FLIBS="`${R} CMD config FLIBS`")
    110             SYMPHONY_LIBS="-lSym -lCgl -lOsiClp -lClp -lOsi -lCoinUtils"

You may also need to carry over LDFLAGS and the various CPICFLAGS (by various I mean CXXPICFLAGS etc), but that was not needed by my system. The Darwin stuff looks a bit weird to me, where you switch compiler if it doesn't support openmp.

A diff:

diff --git a/configure b/configure
index ea3a741..11568a8 100755
--- a/configure
+++ b/configure
@@ -100,13 +100,12 @@ EOF
                --disable-cplex-libcheck --disable-glpk-libcheck \
                --disable-osl-libcheck --disable-soplex-libcheck \
                --disable-xpress-libcheck \
-               CFLAGS="-w -g -O2" \
-               CXXFLAGS="-w -g -O2" \
                CC="`${R} CMD config CC`" \
-               #CPP="`${R} CMD config CPP`" \
+               CFLAGS="`${R} CMD config CFLAGS`" \
                CXX="`${R} CMD config CXX`" \
-               #CXXCPP="`${R} CMD config CXXCPP`" \
+               CXXFLAGS="`${R} CMD config CXXFLAGS`" \
                F77="`${R} CMD config FC`" \
+               FFLAGS="`${R} CMD config FFLAGS`" \
                FLIBS="`${R} CMD config FLIBS`")
            SYMPHONY_LIBS="-lSym -lCgl -lOsiClp -lClp -lOsi -lCoinUtils"
            SYMPHONY_INCLUDE_PATH="-ISYMPHONY/include"
kasperdanielhansen commented 3 years ago

Also, put a link to the Github repos in the DESCRIPTION.