You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Arch Linux 64位环境下SASM无法编译hello.asm的问题求助

SASM错误编译program.asm而非指定的hello.asm

环境与配置

  • 系统:Arch Linux 64位
  • 目标编译文件:hello.asm
  • SASM配置:
Mode: x64
Assembler : NASM
Assemble optionss : -g -f elf64 $SOURCE$ -l $LSTOUTPUT$ -o $PROGRAM.OBJ$
Linking options : $PROGRAM.OBJ$ $MACRO.OBJ$ -g -o $PROGRAM$  -no-pie
Assembler path : nasm
Linker path : gcc
Object file name : program.o

编译报错信息

[13:18:59] Warning! Errors have occurred in the build:
/tmp/SASM/program.asm:6: error: expression syntax error
/usr/bin/ld: cannot find /tmp/SASM/program.o: No such file or directory
/usr/bin/ld: cannot find : No such file or directory
collect2: error: ld returned 1 exit status
[13:18:59] Before debugging you need to build the program.

问题核心

SASM未编译指定的hello.asm,反而尝试编译program.asm,重装SASM(包管理器/源码编译)无法解决。

解决方法

1. 清理SASM临时目录

SASM默认将临时文件存放在/tmp/SASM/,残留的旧文件可能干扰编译:

rm -rf /tmp/SASM/*

清理后重启SASM,重新加载hello.asm编译。

2. 修正配置错误

  • 拼写修正:将配置中Assemble optionss改为Assemble options(多了一个冗余的s)
  • 移除无效变量:链接选项中的$MACRO.OBJ$未被正确替换,会导致ld报错,修改为:
    $PROGRAM.OBJ$ -g -o $PROGRAM$ -no-pie
    
  • 关联目标文件名:将「Object file name」设置为hello.o,确保与源文件对应,避免固定生成program.o。

3. 重新加载源文件

关闭SASM,通过「文件」→「打开」重新选择hello.asm,避免拖拽或快捷方式导致的路径识别异常。

4. 回退SASM版本

Arch Linux的滚动更新可能导致SASM与系统组件不兼容,尝试安装旧版本:

# 安装指定旧版本示例,可根据Archive调整版本号
sudo pacman -U https://archive.archlinux.org/packages/s/sasm/sasm-3.12.2-1-x86_64.pkg.tar.zst

添加到pacman忽略列表防止自动更新:

echo "sasm" >> /etc/pacman.conf

内容的提问来源于stack exchange,提问作者MultiDimension

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.20 12:13:31