【发布时间】:2020-07-25 05:58:39
【问题描述】:
我在 dockerhub 上试用了 muslcc 映像,但无法运行已编译的 Hello World 程序。
我使用的图像是:muslcc/i686:x86_64-linux-musl(找到here)。我加载图像:
docker run -it --rm -v /path/to/local:/var muslcc/i686:x86_64-linux-musl
这样我就可以在本地机器上编码,并在 musl 映像上编译和测试。
我正在编译的程序是一个基本的hello world:
#include<stdio.h>
int main(void){
puts("Hello world.");
return 0;
}
此文件保存为helloworld.c
我运行gcc -Wall helloworld.c 并在同一目录中获取a.out。做ls -l给了我:
total 1068
-rwxr-xr-x 1 root root 7584 Jul 25 05:41 a.out
-rw-r--r-- 1 root root 76 Jul 25 05:27 helloworld.c
当我尝试使用./a.out 运行a.out 时,我得到:
/bin/sh: ./a.out: not found
我也尝试指定一个输出文件,以防这是默认输出的一些问题,但没有运气。我也尝试过使用绝对路径,例如 /var/a.out,但也没有运气。
-- 编辑:
- 我已经检查过了,
./符号在 $PATH 中
【问题讨论】: