Mac x86平台安装SystemC遇src/Makefile.in缺失及语法错误求助
在x86架构macOS 13.0.1上安装SystemC 2.3.3的编译错误解决
初始问题
按照官方文档执行以下步骤:
cd path/to/systemc-2.3.3 mkdir objdir cd objdir export CXX=g++ ../configure
运行configure时提示找不到src/Makefile.in,错误日志:
checking build system type... x86_64-apple-darwin22.1.0 // 大量检查步骤... checking whether the C++ compiler works... yes //... checking that generated files are newer than configure... done configure: creating ./config.status config.status: creating Makefile config.status: error: cannot find input file: `src/Makefile.in'
更新进展
在源码目录执行autoconf和automake发现缺失文件,随后执行aclocal和automake --add-missing,automake可正常运行,但再次执行../configure时出现语法错误:
$ checking ... $ ../configure: line 2761: syntax error near unexpected token `1.10' $ ../configure: line 2761: `AM_INIT_AUTOMAKE(1.10 tar-pax -Werror -Wno-portability no-define subdir-objects foreign)'
问题原因
初始错误原因:
- SystemC 2.3.3源码包可能不完整,解压过程中丢失了
src/Makefile.in这类automake模板文件; - macOS自带的automake/autoconf版本过旧,无法正确识别或生成所需的配置文件。
- SystemC 2.3.3源码包可能不完整,解压过程中丢失了
更新后语法错误原因:
本地安装的automake版本低于1.10,而SystemC配置脚本中使用了1.10版本才支持的参数(如tar-pax、subdir-objects),低版本automake无法解析这些参数,导致语法错误。
解决方向
校验源码完整性:
重新下载官方SystemC 2.3.3压缩包,使用系统自带tar命令解压,避免第三方工具损坏文件:tar xzf systemc-2.3.3.tar.gz升级automake/autoconf工具:
通过Homebrew安装符合版本要求的工具:brew install automake autoconf安装完成后,确认工具路径在系统PATH中(执行
which automake,输出应为/usr/local/bin/automake或/opt/homebrew/bin/automake)。重新生成配置文件:
回到SystemC源码根目录,清理残留文件后重新生成配置脚本:make distclean # 若之前执行过编译,先清理 aclocal automake --add-missing autoconf再重新执行编译配置步骤:
mkdir -p objdir && cd objdir export CXX=g++ ../configure可选优化参数:
若仍有编译问题,可尝试添加configure参数规避兼容性问题:../configure --prefix=/usr/local/systemc-2.3.3 --disable-werror--prefix指定安装路径,避免权限问题;--disable-werror关闭将警告视为错误的规则,适配新编译器的警告输出。
内容的提问来源于stack exchange,提问作者L.DZ
相关产品推荐
相关产品推荐

