binutils的构建代码:
echo -e "${BLUE}===================== build gas && gold ===========================${NC}"
echo
if [ ! -f ${PWD_PATH}/succeed/binutils ]; then
wget -c 'https://ftp.gnu.org/gnu/binutils/binutils-2.30.tar.xz'
tar xvJf binutils-2.30.tar.xz
rm -r binutils-2.30/gas
rm -r binutils-2.30/gold
cp -r ${SRC_PATH}/binutils/gas-2.30 ${GAS_DIR}
cp -r ${SRC_PATH}/binutils/gold-2.30 ${GOLD_DIR}
cp $PROTODEF_DIR/$C_HDR $GAS_DIR
cp $PROTODEF_DIR/$CC_HDR ${GOLD_DIR}/
cp $PROTODEF_DIR/$PROTO_C ${GOLD_DIR}/
eval "cd $PWD_PATH/binutils-2.30 && mkdir -p build && cd build"
CFLAGS="`pkg-config --cflags 'libprotobuf-c >= 1.0.0'`" LDFLAGS=`pkg-config --libs 'libprotobuf-c >= 1.0.0'` \
../configure --enable-gold --prefix=${PWD_PATH}/executable_binutils \
--disable-werror --enable-shared \
--enable-ld=default \
--fcommon \
--enable-plugins \
--enable-64-bit-bfd \
--with-system-zlib \
&& make -j$(nproc)
# && make install
echo "done" > ${PWD_PATH}/succeed/binutils
fi
echo
echo -e "${GREEN}[*] build gas&&gold succeed!${NC}"
GAS_PATH=$PWD_PATH/binutils-2.30/build/gas/as-new
GOLD_PATH=$PWD_PATH/binutils-2.30/build/gold/ld-new
# get gcc-8.1.0
GCC_PATH="$PWD_PATH/gcc-8.1.0"
# GCC_EXE_PATH="$PWD_PATH/gcc_executable"
#GCC_EXE_PATH=""
GCC_BUILD_PATH="$PWD_PATH/build_gcc"
GCC_EXE_PATH="$PWD_PATH/executable_gcc"
# soft link gas
eval " sudo cp /usr/bin/as /usr/bin/as.old"
echo
这里我想在CFLAGS中传递-fcommon标志,因为我得到了多个定义错误。但不确定如何传递此标志。我试图在configure行及其下方添加as --fcommon,但它不起作用。
错误消息:
binutils-2.30/depcomp
binutils-2.30/config.guess
binutils-2.30/ltmain.sh
binutils-2.30/ltsugar.m4
configure: error: unrecognized option: `--fcommon'
Try `../configure --help' for more information.
[*] build gas&&gold succeed!
1条答案
按热度按时间hmtdttj41#
configure
不是编译器。不能传递编译器标志。如果你查看autoconf文档,或者运行
configure --help
,你会发现:因此,您可以将
CFLAGS=-fcommon
添加到configure
命令行。