【问题标题】:Make error on Mac OS X: libtool: compile: unrecognized option `-c'在 Mac OS X 上出错:libtool: compile: unrecognized option `-c'
【发布时间】:2014-11-11 18:16:25
【问题描述】:

我正在尝试制作一个名为 seqpp 的工具。但我得到这个错误:

/bin/sh ../libtool --tag=F77   --mode=compile    -c -o fcdiv.lo fcdiv.f
libtool: compile: unrecognized option `-c'
libtool: compile: Try `libtool --help' for more information.

我在 MacOSx 10.9.5 Mavericks 工作 我想到了2个问题:

  • 没有fortran编译器,

  • 或 libtool 包有问题。

    所以我通过使用 Macports 重新安装 gcc 编译器来安装 gfortran:sudo port install gcc46 +gfortran。我使用 MacPorts 重新安装了 libtool。我还安装了最新版本的开发工具,以防万一。

libtool 似乎已正确安装: $ 哪个库工具 /usr/bin/libtool

我真的不知道如何检查 gfortran 的安装。它可能仍然不行;正如您在日志中看到的:检查 f77... 否 这是正确的问题吗?如果是,如何解决?

提前感谢您的宝贵帮助!

这是整个安装日志(“./configure”后跟“make”命令):

   $ ./configure
    checking for a BSD-compatible install... /usr/bin/install -c  
    checking whether build environment is sane... yes  
    checking for a thread-safe mkdir -p... ./install-sh -c -d  
    checking for gawk... no  
    checking for mawk... no  
    checking for nawk... no  
    checking for awk... awk  
    checking whether make sets $(MAKE)... yes  
    checking for gawk... (cached) awk  
    checking for g++... g++  
    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 g++ accepts -g... yes  
    checking for style of include used by make... GNU  
    checking dependency style of g++... gcc3  
    checking for g77... no  
    checking for xlf... no  
    checking for f77... no  
    checking for frt... no  
    checking for pgf77... no  
    checking for cf77... no  
    checking for fort77... no  
    checking for fl32... no  
    checking for af77... no  
    checking for xlf90... no  
    checking for f90... no  
    checking for pgf90... no  
    checking for pghpf... no  
    checking for epcf90... no  
    checking for gfortran... no  
    checking for g95... no  
    checking for xlf95... no  
    checking for f95... no  
    checking for fort... no  
    checking for ifort... no  
    checking for ifc... no  
    checking for efc... no  
    checking for pgf95... no  
    checking for lf95... no  
    checking for ftn... no  
    checking whether we are using the GNU Fortran 77 compiler... no  
    checking whether  accepts -g... no  
    checking for a BSD-compatible install... /usr/bin/install -c  
    checking whether ln -s works... yes  
    checking build system type... i386-apple-darwin13.4.0  
    checking host system type... i386-apple-darwin13.4.0  
    checking for gcc... gcc  
    checking whether we are using the GNU C compiler... yes  
    checking whether gcc accepts -g... yes  
    checking for gcc option to accept ISO C89... none needed  
    checking dependency style of gcc... gcc3  
    checking for a sed that does not truncate output... /usr/bin/sed  
    checking for grep that handles long lines and -e... /usr/bin/grep  
    checking for egrep... /usr/bin/grep -E  
    checking for fgrep... /usr/bin/grep -F  
    checking for ld used by gcc... /Applications/Xcode.app/Contents/Developer/Toolchains  /XcodeDefault.xctoolchain/usr/bin/ld  
    checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains  /XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no  
    checking for BSD- or MS-compatible name lister (nm)... /opt/local/bin/nm  
    checking the name lister (/opt/local/bin/nm) interface... BSD nm  
    checking the maximum length of command line arguments... 196608  
    checking whether the shell understands some XSI constructs... yes  
    checking whether the shell understands "+="... yes  
    checking for /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain  /usr/bin/ld option to reload object files... -r  
    checking how to recognize dependent libraries... pass_all  
    checking for ar... ar  
    checking for strip... strip  
    checking for ranlib... ranlib  
    checking command to parse /opt/local/bin/nm output from gcc object... ok  
    checking for dsymutil... dsymutil  
    checking for nmedit... nmedit  
    checking for lipo... lipo
    checking for otool... otool
    checking for otool64... no
    checking for -single_module linker flag... yes
    checking for -exported_symbols_list linker flag... yes
    checking how to run the C preprocessor... gcc -E
    checking for ANSI C header files... rm: conftest.dSYM: is a directory
    rm: conftest.dSYM: is a directory
    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 for dlfcn.h... yes
    checking whether we are using the GNU C++ compiler... (cached) yes  
    checking whether g++ accepts -g... (cached) yes  
    checking dependency style of g++... (cached) gcc3  
    checking how to run the C++ preprocessor... g++ -E  
    checking for g77... no  
    checking for xlf... no  
    checking for f77... no  
    checking for frt... no  
    checking for pgf77... no  
    checking for cf77... no  
    checking for fort77... no  
    checking for fl32... no  
    checking for af77... no  
    checking for xlf90... no  
    checking for f90... no  
    checking for pgf90... no  
    checking for pghpf... no  
    checking for epcf90... no  
    checking for gfortran... no  
    checking for g95... no  
    checking for xlf95... no  
    checking for f95... no  
    checking for fort... no  
    checking for ifort... no  
    checking for ifc... no  
    checking for efc... no  
    checking for pgf95... no  
    checking for lf95... no  
    checking for ftn... no  
    checking whether we are using the GNU Fortran 77 compiler... (cached) no  
    checking whether  accepts -g... (cached) no
    checking for objdir... .libs
    rm: conftest.dSYM: is a directory
    checking if gcc supports -fno-rtti -fno-exceptions... yes
    checking for gcc option to produce PIC... -fno-common -DPIC
    checking if gcc PIC flag -fno-common -DPIC works... yes
    checking if gcc static flag -static works... no
    checking if gcc supports -c -o file.o... yes
    checking if gcc supports -c -o file.o... (cached) yes
    checking whether the gcc linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
    checking dynamic linker characteristics... darwin13.4.0 dyld
    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... yes
    checking whether to build static libraries... yes
    checking for ld used by g++... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
    checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no
    checking whether the g++ linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
    checking for g++ option to produce PIC... -fno-common -DPIC
    checking if g++ PIC flag -fno-common -DPIC works... yes
    checking if g++ static flag -static works... no
    checking if g++ supports -c -o file.o... yes
    checking if g++ supports -c -o file.o... (cached) yes
    checking whether the g++ linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
    checking dynamic linker characteristics... darwin13.4.0 dyld
    checking how to hardcode library paths into programs... immediate
    checking for gsl-config... /usr/local/bin/gsl-config
    checking for doxygen... no
    checking libintl.h usability... no
    checking libintl.h presence... no
    checking for libintl.h... no
    checking for stdlib.h... (cached) yes
    checking for string.h... (cached) yes
    checking for strings.h... (cached) yes
    checking for unistd.h... (cached) yes
    checking getopt.h usability... yes
    checking getopt.h presence... yes
    checking for getopt.h... yes
    checking for getopt.h... (cached) yes
    checking for an ANSI C-conforming const... yes
    checking for size_t... yes
    checking for strchr... yes
    checking for strcspn... yes
    checking for strrchr... yes
    checking for strtol... yes
    checking for main in -lm... yes
    checking for ANSI C header files... (cached) yes
    checking for an ANSI C-conforming const... (cached) yes
    checking for inline... inline
    checking whether make sets $(MAKE)... (cached) yes
    configure: creating ./config.status
    config.status: creating seqpp.spec
    config.status: creating Makefile
    config.status: creating seqpp/Makefile
    config.status: creating doc/Makefile
    config.status: creating doc/doxyfiles/config.dox
    config.status: creating doc/doxyfiles/header.html
    config.status: creating doc/doxyfiles/footer.html
    config.status: creating doc/html/Makefile
    config.status: creating doc/man/Makefile
    config.status: creating argtable2/Makefile
    config.status: creating src/Makefile
    config.status: creating alphabet/Makefile
    config.status: creating data/Makefile
    config.status: creating config.h
    config.status: config.h is unchanged
    config.status: executing depfiles commands
    config.status: executing libtool commands
    configure: WARNING: "Note that XML Library libxml2 NOT FOUND or XML Modules NOT ACTIVATED by --enable-xml => XML output disabled."
    pc17:seqpp-4.2.0 iryna$ make
    /Applications/Xcode.app/Contents/Developer/usr/bin/make  all-recursive
    Making all in seqpp
    /bin/sh ../libtool --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I..    `/usr/local/bin/gsl-config --cflags` `` -O3 -MT Coder.lo -MD -MP -MF .deps/Coder.Tpo -c -o Coder.lo Coder.cc
    libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I.. -I/usr/local/include -O3 -MT Coder.lo -MD -MP -MF .deps/Coder.Tpo -c Coder.cc  -fno-common -DPIC -o .libs/Coder.o
    libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I.. -I/usr/local/include -O3 -MT Coder.lo -MD -MP -MF .deps/Coder.Tpo -c Coder.cc -o Coder.o >/dev/null 2>&1
    mv -f .deps/Coder.Tpo .deps/Coder.Plo
    /bin/sh ../libtool --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I..    `/usr/local/bin/gsl-config --cflags` `` -O3 -MT arnoldi.lo -MD -MP -MF .deps/arnoldi.Tpo -c -o arnoldi.lo arnoldi.cc
    libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I.. -I/usr/local/include -O3 -MT arnoldi.lo -MD -MP -MF .deps/arnoldi.Tpo -c arnoldi.cc  -fno-common -DPIC -o .libs/arnoldi.o
    arnoldi.cc:218:51: warning: illegal character encoding in string literal
          [-Winvalid-source-encoding]
                  cerr<<"arnoldi: no convergence, too many it<E9>rations !"<<endl;
                                                             ^~~~
    arnoldi.cc:482:51: warning: illegal character encoding in string literal
          [-Winvalid-source-encoding]
                  cerr<<"arnoldi: no convergence, too many it<E9>rations !"<<endl;
                                                             ^~~~
    arnoldi.cc:744:51: warning: illegal character encoding in string literal
          [-Winvalid-source-encoding]
                  cerr<<"arnoldi: no convergence, too many it<E9>rations !"<<endl;
                                                             ^~~~
    arnoldi.cc:1009:51: warning: illegal character encoding in string literal
          [-Winvalid-source-encoding]
                  cerr<<"arnoldi: no convergence, too many it<E9>rations !"<<endl;
                                                             ^~~~
    4 warnings generated.
    libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I.. -I/usr/local/include -O3 -MT arnoldi.lo -MD -MP -MF .deps/arnoldi.Tpo -c arnoldi.cc -o arnoldi.o >/dev/null 2>&1
    mv -f .deps/arnoldi.Tpo .deps/arnoldi.Plo
    /bin/sh ../libtool --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I..    `/usr/local/bin/gsl-config --cflags` `` -O3 -MT Sequence.lo -MD -MP -MF .deps/Sequence.Tpo -c -o Sequence.lo Sequence.cc
    libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I.. -I/usr/local/include -O3 -MT Sequence.lo -MD -MP -MF .deps/Sequence.Tpo -c Sequence.cc  -fno-common -DPIC -o .libs/Sequence.o
    libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I.. -I/usr/local/include -O3 -MT Sequence.lo -MD -MP -MF .deps/Sequence.Tpo -c Sequence.cc -o Sequence.o >/dev/null 2>&1
    mv -f .deps/Sequence.Tpo .deps/Sequence.Plo
    /bin/sh ../libtool --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I..    `/usr/local/bin/gsl-config --cflags` `` -O3 -MT PrimarySequence.lo -MD -MP -MF .deps/PrimarySequence.Tpo -c -o PrimarySequence.lo PrimarySequence.cc
    libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I.. -I/usr/local/include -O3 -MT PrimarySequence.lo -MD -MP -MF .deps/PrimarySequence.Tpo -c PrimarySequence.cc  -fno-common -DPIC -o .libs/PrimarySequence.o
    PrimarySequence.cc:19:26: warning: comparison of unsigned expression < 0 is
          always false [-Wtautological-compare]
      if ( ( beg>stop )||(beg<0)||(stop>=_length) ){
                          ~~~^~
    PrimarySequence.cc:36:26: warning: comparison of unsigned expression < 0 is
          always false [-Wtautological-compare]
      if ( ( beg>stop )||(beg<0)||(stop>=_length) ){
                          ~~~^~
    2 warnings generated.
    libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I.. -I/usr/local/include -O3 -MT PrimarySequence.lo -MD -MP -MF .deps/PrimarySequence.Tpo -c PrimarySequence.cc -o PrimarySequence.o >/dev/null 2>&1
    mv -f .deps/PrimarySequence.Tpo .deps/PrimarySequence.Plo
    /bin/sh ../libtool --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I..    `/usr/local/bin/gsl-config --cflags` `` -O3 -MT SequenceSet.lo -MD -MP -MF .deps/SequenceSet.Tpo -c -o SequenceSet.lo SequenceSet.cc
    libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I.. -I/usr/local/include -O3 -MT SequenceSet.lo -MD -MP -MF .deps/SequenceSet.Tpo -c SequenceSet.cc  -fno-common -DPIC -o .libs/SequenceSet.o
    libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I.. -I/usr/local/include -O3 -MT SequenceSet.lo -MD -MP -MF .deps/SequenceSet.Tpo -c SequenceSet.cc -o SequenceSet.o >/dev/null 2>&1
    mv -f .deps/SequenceSet.Tpo .deps/SequenceSet.Plo
    /bin/sh ../libtool --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I..    `/usr/local/bin/gsl-config --cflags` `` -O3 -MT PhasedMarkov.lo -MD -MP -MF .deps/PhasedMarkov.Tpo -c -o PhasedMarkov.lo PhasedMarkov.cc
    libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I.. -I/usr/local/include -O3 -MT PhasedMarkov.lo -MD -MP -MF .deps/PhasedMarkov.Tpo -c PhasedMarkov.cc  -fno-common -DPIC -o .libs/PhasedMarkov.o
    In file included from PhasedMarkov.cc:1:
    ../seqpp/PhasedMarkov.h:31:17: warning: using directive refers to
          implicitly-defined namespace 'std'
    using namespace std;
                    ^
    PhasedMarkov.cc:63:20: warning: illegal character encoding in string literal
          [-Winvalid-source-encoding]
            cerr<<"\"# Phase n<B0>\" line missing or mispositionned"<<endl;
                              ^~~~
    PhasedMarkov.cc:935:46: warning: illegal character encoding in string literal
          [-Winvalid-source-encoding]
                    cerr<<"arnoldi: no convergence, too many it<E9>rations !"<<endl;
                                                               ^~~~
    PhasedMarkov.cc:1396:5: warning: add explicit braces to avoid dangling else
          [-Wdangling-else]
        else{
        ^
    PhasedMarkov.cc:1413:4: warning: add explicit braces to avoid dangling else
          [-Wdangling-else]
              else{
              ^
    PhasedMarkov.cc:1426:2: warning: add explicit braces to avoid dangling else
          [-Wdangling-else]
            else{
            ^
    PhasedMarkov.cc:1458:6: warning: add explicit braces to avoid dangling else
          [-Wdangling-else]
         else{       
         ^
    PhasedMarkov.cc:1619:70: warning: illegal character encoding in string literal
          [-Winvalid-source-encoding]
      ...PhasedMarkov::distVarTot\n, Pi ou Mu ne sont pas d<E9>finis pour une de...
                                                           ^~~~
    PhasedMarkov.cc:1677:19: warning: illegal character encoding in string literal
          [-Winvalid-source-encoding]
            Out << "# Phase n<B0>" << p <<endl;
                             ^~~~
    9 warnings generated.
    libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I.. -I/usr/local/include -O3 -MT PhasedMarkov.lo -MD -MP -MF .deps/PhasedMarkov.Tpo -c PhasedMarkov.cc -o PhasedMarkov.o >/dev/null 2>&1
    mv -f .deps/PhasedMarkov.Tpo .deps/PhasedMarkov.Plo
    /bin/sh ../libtool --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I..    `/usr/local/bin/gsl-config --cflags` `` -O3 -MT Markov.lo -MD -MP -MF .deps/Markov.Tpo -c -o Markov.lo Markov.cc
    libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I.. -I/usr/local/include -O3 -MT Markov.lo -MD -MP -MF .deps/Markov.Tpo -c Markov.cc  -fno-common -DPIC -o .libs/Markov.o
    In file included from Markov.cc:1:
    In file included from ../seqpp/Markov.h:31:
    ../seqpp/PhasedMarkov.h:31:17: warning: using directive refers to
          implicitly-defined namespace 'std'
    using namespace std;
                    ^
    1 warning generated.
    libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I.. -I/usr/local/include -O3 -MT Markov.lo -MD -MP -MF .deps/Markov.Tpo -c Markov.cc -o Markov.o >/dev/null 2>&1
    mv -f .deps/Markov.Tpo .deps/Markov.Plo
    /bin/sh ../libtool --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I..    `/usr/local/bin/gsl-config --cflags` `` -O3 -MT Translator.lo -MD -MP -MF .deps/Translator.Tpo -c -o Translator.lo Translator.cc
    libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I.. -I/usr/local/include -O3 -MT Translator.lo -MD -MP -MF .deps/Translator.Tpo -c Translator.cc  -fno-common -DPIC -o .libs/Translator.o
    Translator.cc:183:37: warning: illegal character encoding in string literal
          [-Winvalid-source-encoding]
            cout<<_iter_si->first<<" est associ<E9> <E0> "
                                               ^~~~ ~~~~
    Translator.cc:190:37: warning: illegal character encoding in string literal
          [-Winvalid-source-encoding]
            cout<<_iter_ci->first<<" est associ<E9> <E0> "
                                               ^~~~ ~~~~
    Translator.cc:202:37: warning: illegal character encoding in string literal
          [-Winvalid-source-encoding]
            cout<<_iter_si->first<<" est associ<E9> <E0> "
                                               ^~~~ ~~~~
    Translator.cc:207:17: warning: illegal character encoding in string literal
          [-Winvalid-source-encoding]
        cout<<"Compl<E9>mentaire"<<endl;
                    ^~~~
    Translator.cc:211:37: warning: illegal character encoding in string literal
          [-Winvalid-source-encoding]
            cout<<_iter_si->first<<" est associ<E9> <E0> "
                                               ^~~~ ~~~~
    Translator.cc:218:28: warning: illegal character encoding in string literal
          [-Winvalid-source-encoding]
          cout<<i<<" est associ<E9> <E0> "
                               ^~~~ ~~~~
    Translator.cc:223:28: warning: illegal character encoding in string literal
          [-Winvalid-source-encoding]
          cout<<i<<" est associ<E9> <E0> "
                               ^~~~ ~~~~
    Translator.cc:353:37: warning: illegal character encoding in string literal
          [-Winvalid-source-encoding]
            cout<<_iter_si->first<<" est associ<E9> <E0> "
                                               ^~~~ ~~~~
    Translator.cc:360:37: warning: illegal character encoding in string literal
          [-Winvalid-source-encoding]
            cout<<_iter_ci->first<<" est associ<E9> <E0> "
                                               ^~~~ ~~~~
    Translator.cc:372:37: warning: illegal character encoding in string literal
          [-Winvalid-source-encoding]
            cout<<_iter_si->first<<" est associ<E9> <E0> "
                                               ^~~~ ~~~~
    Translator.cc:379:28: warning: illegal character encoding in string literal
          [-Winvalid-source-encoding]
          cout<<i<<" est associ<E9> <E0> "
                               ^~~~ ~~~~
    11 warnings generated.
    libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I.. -I/usr/local/include -O3 -MT Translator.lo -MD -MP -MF .deps/Translator.Tpo -c Translator.cc -o Translator.o >/dev/null 2>&1
    mv -f .deps/Translator.Tpo .deps/Translator.Plo
    /bin/sh ../libtool --tag=F77   --mode=compile    -c -o fcdiv.lo fcdiv.f
    libtool: compile: unrecognized option `-c'
    libtool: compile: Try `libtool --help' for more information.
    make[2]: *** [fcdiv.lo] Error 1
    make[1]: *** [all-recursive] Error 1
    make: *** [all] Error 2
    
    

【问题讨论】:

  • 始终使用标签fortran 并且仅在必要时添加版本以区分您的问题是具体的。例如,您不能使用 Fortran 2008,而只能使用 Fortran 90。

标签: macos fortran fortran77 libtool


【解决方案1】:

其实我发现了问题:确实是因为没有fortran编译器。正如我所说,我从 Macports 下载了一个包含 fortran 的 gcc 编译器:

sudo 端口安装 gcc46 +gfortran

然后我不得不将此编译器设置为我的默认编译器:
1) 从 Macports 安装 gcc_select
sudo 端口安装 gcc_select

2)查看所有 gcc 编译器并默认将其中一个设置为编译器(我的编译器是 mp-gcc46):
端口选择 --list gcc
sudo 端口选择 --set gcc mp-gcc46

3)您可以检查编译器是否已被修改:
gcc --version

就是这样,希望对大家有所帮助

【讨论】:

    猜你喜欢
    • 2012-07-11
    • 2015-12-10
    • 2011-05-16
    • 2015-12-06
    • 2017-02-28
    • 1970-01-01
    • 1970-01-01
    • 2015-08-19
    • 2015-03-19
    相关资源
    最近更新 更多