c - 本地错误 : ' is already registered with AC_CONFIG_FILES; and/or $'\r': command not found

标签 c automake

我正在构建一个 C automake 项目。运行“aclocal”显示以下错误。

 $ aclocal
 ' is already registered with AC_CONFIG_FILES./usr/src/ports/autoconf2.5/autoconf2.5-2.69-3.noarch/src/autoconf-2.69/lib/autoconf/status.m4:288: AC_CONFIG_FILES is 
 expanded from...
 configure.ac:890: the top level
 autom4te-2.69: /usr/bin/m4 failed with exit status: 1
 aclocal-1.15: error: echo failed with exit status: 1

我在 Windows 10 上使用 Cygwin。

configure.ac 从第 886 行到末尾有以下内容。

# ----------------------------------------------------------------------
# Create output files
#
echo $SLIM_VERSION > VERSION
AC_OUTPUT(Makefile \
      src/Makefile \
      src/genconfig \
      src/verifier/Makefile \
      src/utility/Makefile \
      src/test/Makefile \
      lib/Makefile \
      ext/Makefile \
      test/Makefile \
      test/system_check/Makefile \
      third_party/Makefile \
      third_party/zdelta-2.1/Makefile \
      third_party/google-perftools-1.8.3/Makefile \
      third_party/google-perftools-1.8.3/src/google/tcmalloc.h \
      third_party/google-perftools-1.8.3/src/windows/google/tcmalloc.h \
      doc/Makefile \
      doc/slim.1)

按照建议,我在每个“*.am”文件和“configure.ac”上都使用了“dos2unix”,但运行“make”时显示以下错误。

configure.ac:596: the top level
cd ../.. && /bin/sh ./config.status third_party/zdelta-2.1/Makefile depfiles
config.status: creating third_party/zdelta-2.1/Makefile
config.status: executing depfiles commands
source='deflate.c' object='deflate.o' libtool=no \
DEPDIR=.deps depmode=none /bin/sh ../../depcomp \
gcc -DHAVE_CONFIG_H -I. -I../../src     -Wall -export-dynamic -O3  -fopenmp -c -o deflate.o deflate.c
../../depcomp:行2: $'\r': 未找到命令
../../depcomp:行5: $'\r': 未找到命令
../../depcomp:行10: $'\r': 未找到命令
../../depcomp:行15: $'\r': 未找到命令
../../depcomp:行20: $'\r': 未找到命令
../../depcomp:行25: $'\r': 未找到命令
../../depcomp:行27: $'\r': 未找到命令
../../depcomp:行64: 未预期的符号 `$'in\r'' 附近有语法错误
'./../depcomp:行64: `case "$depmode" in
make[2]: *** [Makefile:419:deflate.o] 错误 2
make[2]: 离开目录“/cygdrive/c/LaViT2_8_9/lmntal/slim-lightweight- 
hlground/third_party/zdelta-2.1”
make[1]: *** [Makefile:386:all-recursive] 错误 1
make[1]: 离开目录“/cygdrive/c/LaViT2_8_9/lmntal/slim-lightweight- 
hlground/third_party”
make: *** [Makefile:425:all-recursive] 错误 1

这里,

行2: $'\r': 未找到命令

是指 第 2 行:$'\r': 找不到命令

谁能帮我解决这个问题?

最佳答案

可以确定您的问题是由 DOS 换行引起的。

赠品是这个错误:

' is already registered with AC_CONFIG_FILES./usr/src/ports/autoconf2.5/autoconf2.5-2.69-3.noarch/src/autoconf-2.69/lib/autoconf/status.m4:288: AC_CONFIG_FILES is

' 开头的行已经注册到 意味着光标在将行写入控制台的过程中被发送回行首——打印字符串的确切行为读取来自 DOS 格式的文本文件,而它期望它是 UNIX 格式。


配置 git 以 checkout UNIX 格式的文本文件

git config --global core.autocrlf false
git config --global core.eol lf

关于c - 本地错误 : ' is already registered with AC_CONFIG_FILES; and/or $'\r': command not found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50256967/

相关文章:

permissions - 当我执行 'make install' 时,它不会创建目录

c - 如何检查整数是否已排序(两侧)

c - 在 C 编程中动态填充数组

ubuntu - 在 ubuntu 14 中的 automake 命令期间收到错误

c++ - 构建 PHP 扩展时如何检查未损坏的 C++ 符号?

c++ - 'CXXABI_1.3.1 1' not found`

c - 在c中传递和分配指向void*的指针

c - 如何防止C99浮点代码改变优化级别的结果

c++ - 在 C++ 中为 C 库转换数据类型

c - 将自定义代码添加到 Automake 生成的 Makefile 中