为 freebsd 11 编译 gcc4.8.5 时出错: 错误: 未知类型名称 'choke'

Error while compiling gcc4.8.5 for freebsd 11 : error: unknown type name 'choke'

本文关键字:编译 choke freebsd 类型 未知 出错 错误 gcc4      更新时间:2023-10-16

在新的Ubuntu 14.04机器上重现错误的步骤。

  1. 从前安装的freebsd机器的/usr获取和lib文件夹。
  2. 在Ubuntu机器的主目录中设置文件夹。

现在,运行的命令

sudo apt-get update
sudo apt-get install gcc g++ freebsd-buildutils gobjc++-mingw-w64-x86-64 gobjc++-mingw-w64-i686 gobjc++ flex bison libisl-dev libelf-dev binutils-dev libc6-dev linux-libc-dev build-essential
sudo apt-get install zip unzip
sudo apt-get install cloog-isl libcloog-isl-dev ppl-dev libspice-client-glib-2.0-dev
sudo apt-get install gawk mawk patch
sudo mkdir /opt/cross-freebsd && sudo chown -R $USER /opt/cross-freebsd
sudo mkdir build-tmp && cd build-tmp
pushd .
cd ~
cp -a include/. /opt/cross-freebsd/x86_64-pc-freebsd10/
cp -a lib/. /opt/cross-freebsd/x86_64-pc-freebsd10/lib/
ls /opt/cross-freebsd/x86_64-pc-freebsd10/
popd
pushd .
cd /opt/cross-freebsd/x86_64-pc-freebsd10/lib
ln -s libm.so.5 libm.so
ln -s libc.so.7 libc.so
popd
wget http://ftp.gnu.org/gnu/binutils/binutils-2.25.1.tar.gz
tar xf binutils-2.25.1.tar.gz 
cd binutils-2.25.1/
./configure --enable-libssp --enable-gold --enable-ld 
  --target=x86_64-pc-freebsd10 --prefix=/opt/cross-freebsd
fmake -j4
fmake install
cat config.log | grep -in error

预期:没有错误

结果:

77:Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.8.4-2ubuntu1~14.04.4' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
82:gcc: error: unrecognized command line option '-V'
83:gcc: fatal error: no input files
87:gcc: error: unrecognized command line option '-qversion'
88:gcc: fatal error: no input files
137:Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.8.4-2ubuntu1~14.04.4' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
142:g++: error: unrecognized command line option '-V'
143:g++: fatal error: no input files
147:g++: error: unrecognized command line option '-qversion'
148:g++: fatal error: no input files
238:conftest.c:15:5: error: unknown type name 'choke'
740:stage2_werror_flag=''

我该怎么做才能避免这些错误?

我该怎么做才能避免这些错误?

您不能,这些错误是无效的,而只是来自 configure 确实可以建立您是哪种配置。

例如,检查Cloog的版本是否为0.17.0,它会编译包含的文件:

#include "cloog/version.h"
int
main ()
{
#if CLOOG_VERSION_MAJOR != 0     || CLOOG_VERSION_MINOR != 17     || CLOOG_VERSION_REVISION < 0
     choke me
    #endif
   ;
   return 0;
 }

编译时有一个错误,指示CLOOG_VERSION_MAJOR != 0 || CLOOG_VERSION_MINOR != 17 || CLOOG_VERSION_REVISION < 0为true。在这种情况下,错误是由于choke me引起的,但可能来自任何其他无效的形式。编译时没有错误表示版本为0.17.0,有错误表明该版本不是0.17.0,也就是全部。

etc

所以最后一切都可以