Closed skychengzhixing closed 2 years ago
bash: ./main: No such file or directory
clear indication that the dynamic link interpreter isn't in the expected path.
check readelf -a main | grep -i interp
to see the expected path.
you need to either install the musl dynlinker to that location, or run path/to/musl-cross-install/lib/libc.so main
. alternatively you can static link your binary. the reason the dynlinker isnt installed to your system /lib is because mcm is a cross-compiler intended to compile binaries for other systems (which have the proper filesystem layout), and since it would require additional privileges.
Thank you for your reply. According to your method, both the static link method and the dynamic link method can make the program run. I record my method. If other people encounter similar problems, you can refer to the following:
hi,friend: I wrote a hello world applet, but it can't run; I generated a hello world applet from GCC in the cross tool chain compiled by myself, but it failed to run. The specific errors are as follows: The steps are as follows: (1)x86_64-linux-musl-gcc 11.c -o main (2)./main Errors are reported as follows:
I tried some methods, but the problem still hasn't been solved. Can you help me see what caused the problem?