- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我从源代码安装了 gcc 8.3.0。
如果我使用带完整路径的 gcc,它会完美运行。
$ /usr/bin/gcc test.c
但是如果我在没有完整路径的情况下使用gcc,它会导致错误:
$ gcc test.c
gcc: error trying to exec 'cc1': execvp: No such file or directory
我可以解决这个问题吗?还是这个 gcc 特定(必须使用完整路径)?
样本来源:
//test.c or test.cpp
void main(){}
没有完整路径的 strace(错误:1):
execve("/bin/sh", ["/bin/sh", "-c", "gcc test.cpp -Wno-write-st"...], 0xbfbb4e68 /* 14 vars */) = 0
set_thread_area({entry_number=-1, base_addr=0x814816c, limit=0x0fffff, seg_32bit=1, contents=0, read_exec_only=0, limit_in_pages=1, seg_not_present=0, useable=1}) = 0 (entry_number=6)
set_tid_address(0x81489ec) = 16010
getuid32() = 0
brk(NULL) = 0x8cee000
brk(0x8cef000) = 0x8cef000
getpid() = 16010
rt_sigprocmask(SIG_UNBLOCK, [RT_1 RT_2], NULL, 8) = 0
rt_sigaction(SIGCHLD, {sa_handler=0x80bee30, sa_mask=~[RTMIN RT_1 RT_2], sa_flags=SA_RESTORER, sa_restorer=0x8114571}, NULL, 8) = 0
rt_sigaction(SIGHUP, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x8114571}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
brk(0x8cf0000) = 0x8cf0000
getppid() = 16007
uname({sysname="Linux", nodename="DESLX", ...}) = 0
stat64("/tmp/linux-test", {st_mode=S_IFDIR|0755, st_size=260, ...}) = 0
stat64(".", {st_mode=S_IFDIR|0755, st_size=260, ...}) = 0
rt_sigaction(SIGINT, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGINT, {sa_handler=0x80bee30, sa_mask=~[RTMIN RT_1 RT_2], sa_flags=SA_RESTORER, sa_restorer=0x8114571}, NULL, 8) = 0
rt_sigaction(SIGQUIT, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGQUIT, {sa_handler=SIG_IGN, sa_mask=~[RTMIN RT_1 RT_2], sa_flags=SA_RESTORER, sa_restorer=0x8114571}, NULL, 8) = 0
rt_sigaction(SIGTERM, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
stat64("/sbin/gcc", 0xbf92665c) = -1 ENOENT (No such file or directory)
stat64("/usr/sbin/gcc", 0xbf92665c) = -1 ENOENT (No such file or directory)
stat64("/bin/gcc", 0xbf92665c) = -1 ENOENT (No such file or directory)
stat64("/usr/bin/gcc", {st_mode=S_IFREG|0755, st_size=1490096, ...}) = 0
execve("/usr/bin/gcc", ["gcc", "test.cpp", "-Wno-write-strings"], 0x8cee314 /* 14 vars */) = 0
set_thread_area({entry_number=-1, base_addr=0x8177bf4, limit=0x0fffff, seg_32bit=1, contents=0, read_exec_only=0, limit_in_pages=1, seg_not_present=0, useable=1}) = 0 (entry_number=6)
set_tid_address(0x8177dc8) = 16010
brk(NULL) = 0x853b000
brk(0x853c000) = 0x853c000
brk(NULL) = 0x853c000
brk(0x853e000) = 0x853e000
brk(0x854f000) = 0x854f000
brk(0x8550000) = 0x8550000
ioctl(2, TIOCGWINSZ, 0xbfd450f8) = -1 EINVAL (Invalid argument)
ioctl(2, TIOCGWINSZ, 0xbfd450f8) = -1 EINVAL (Invalid argument)
rt_sigaction(SIGINT, {sa_handler=SIG_IGN, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x80d9557}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RT_1 RT_2], NULL, 8) = 0
rt_sigaction(SIGINT, {sa_handler=0x804cc90, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x80d9557}, {sa_handler=SIG_IGN, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x80d9557}, 8) = 0
rt_sigaction(SIGHUP, {sa_handler=SIG_IGN, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x80d9557}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGHUP, {sa_handler=0x804cc90, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x80d9557}, {sa_handler=SIG_IGN, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x80d9557}, 8) = 0
rt_sigaction(SIGTERM, {sa_handler=SIG_IGN, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x80d9557}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGTERM, {sa_handler=0x804cc90, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x80d9557}, {sa_handler=SIG_IGN, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x80d9557}, 8) = 0
rt_sigaction(SIGPIPE, {sa_handler=SIG_IGN, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x80d9557}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGPIPE, {sa_handler=0x804cc90, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x80d9557}, {sa_handler=SIG_IGN, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x80d9557}, 8) = 0
rt_sigaction(SIGCHLD, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x80d9557}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1 RT_2], [], 8) = 0
rt_sigprocmask(SIG_BLOCK, ~[], NULL, 8) = 0
prlimit64(0, RLIMIT_STACK, {rlim_cur=65536*1024, rlim_max=RLIM64_INFINITY}, NULL) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
brk(0x8551000) = 0x8551000
brk(0x8552000) = 0x8552000
open("gcc", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_CLOEXEC|O_PATH) = -1 ENOENT (No such file or directory)
open("gcc", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_CLOEXEC|O_PATH) = -1 ENOENT (No such file or directory)
access("test.cpp", F_OK) = 0
access("../lib/gcc/i686-test-linux/8.3.0/", X_OK) = -1 ENOENT (No such file or directory)
access("../lib/gcc/i686-test-linux/", X_OK) = -1 ENOENT (No such file or directory)
access("../lib/gcc/", X_OK) = -1 ENOENT (No such file or directory)
access("../lib/", X_OK) = -1 ENOENT (No such file or directory)
access("../lib/gcc/i686-test-linux/8.3.0/", X_OK) = -1 ENOENT (No such file or directory)
access("../lib/gcc/i686-test-linux/", X_OK) = -1 ENOENT (No such file or directory)
access("../lib/gcc/", X_OK) = -1 ENOENT (No such file or directory)
access("../lib/", X_OK) = -1 ENOENT (No such file or directory)
open("gcc", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_CLOEXEC|O_PATH) = -1 ENOENT (No such file or directory)
brk(0x8553000) = 0x8553000
access("../../usr", F_OK) = 0
access("../lib/gcc/i686-test-linux/8.3.0/specs", R_OK) = -1 ENOENT (No such file or directory)
access("../lib/gcc/specs", R_OK) = -1 ENOENT (No such file or directory)
access("../i686-test-linux/lib/i686-test-linux/8.3.0/specs", R_OK) = -1 ENOENT (No such file or directory)
access("../i686-test-linux/lib/specs", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/lib/gcc/i686-test-linux/specs", R_OK) = -1 ENOENT (No such file or directory)
access("../lib/gcc/i686-test-linux/8.3.0/", X_OK) = -1 ENOENT (No such file or directory)
access("../lib/gcc/i686-test-linux/", X_OK) = -1 ENOENT (No such file or directory)
access("../lib/gcc/", X_OK) = -1 ENOENT (No such file or directory)
access("../", X_OK) = 0
access("../", X_OK) = 0
brk(0x8554000) = 0x8554000
stat64("../libexec/gcc/i686-test-linux/8.3.0/lto-wrapper", 0xbfd44ff0) = -1 ENOENT (No such file or directory)
stat64("../libexec/gcc/lto-wrapper", 0xbfd44ff0) = -1 ENOENT (No such file or directory)
stat64("../i686-test-linux/bin/i686-test-linux/8.3.0/lto-wrapper", 0xbfd44ff0) = -1 ENOENT (No such file or directory)
stat64("../i686-test-linux/bin/lto-wrapper", 0xbfd44ff0) = -1 ENOENT (No such file or directory)
access("/tmp", R_OK|W_OK|X_OK) = 0
clock_gettime(CLOCK_REALTIME, {tv_sec=1561737190, tv_nsec=72258100}) = 0
open("/tmp/ccKGEANB.s", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0600) = 3
close(3) = 0
stat64("../libexec/gcc/i686-test-linux/8.3.0/cc1plus", 0xbfd44660) = -1 ENOENT (No such file or directory)
stat64("../libexec/gcc/cc1plus", 0xbfd44660) = -1 ENOENT (No such file or directory)
stat64("../i686-test-linux/bin/i686-test-linux/8.3.0/cc1plus", 0xbfd44660) = -1 ENOENT (No such file or directory)
stat64("../i686-test-linux/bin/cc1plus", 0xbfd44660) = -1 ENOENT (No such file or directory)
vfork(gcc: error trying to exec 'cc1plus': execvp: No such file or directory
) = 16011
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=16011, si_uid=0, si_status=255, si_utime=0, si_stime=0} ---
wait4(16011, [{WIFEXITED(s) && WEXITSTATUS(s) == 255}], 0, NULL) = 16011
stat64("/tmp/ccKGEANB.s", {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
unlink("/tmp/ccKGEANB.s") = 0
exit_group(1) = ?
+++ exited with 1 +++
带完整路径的 strace(错误:0):
execve("/bin/sh", ["/bin/sh", "-c", "/usr/bin/gcc test.cpp -Wno"...], 0xbffa0bc8 /* 14 vars */) = 0
set_thread_area({entry_number=-1, base_addr=0x814816c, limit=0x0fffff, seg_32bit=1, contents=0, read_exec_only=0, limit_in_pages=1, seg_not_present=0, useable=1}) = 0 (entry_number=6)
set_tid_address(0x81489ec) = 16029
getuid32() = 0
brk(NULL) = 0x8f18000
brk(0x8f19000) = 0x8f19000
getpid() = 16029
rt_sigprocmask(SIG_UNBLOCK, [RT_1 RT_2], NULL, 8) = 0
rt_sigaction(SIGCHLD, {sa_handler=0x80bee30, sa_mask=~[RTMIN RT_1 RT_2], sa_flags=SA_RESTORER, sa_restorer=0x8114571}, NULL, 8) = 0
rt_sigaction(SIGHUP, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x8114571}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
brk(0x8f1a000) = 0x8f1a000
getppid() = 16026
uname({sysname="Linux", nodename="DESLX", ...}) = 0
stat64("/tmp/linux-test", {st_mode=S_IFDIR|0755, st_size=260, ...}) = 0
stat64(".", {st_mode=S_IFDIR|0755, st_size=260, ...}) = 0
rt_sigaction(SIGINT, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGINT, {sa_handler=0x80bee30, sa_mask=~[RTMIN RT_1 RT_2], sa_flags=SA_RESTORER, sa_restorer=0x8114571}, NULL, 8) = 0
rt_sigaction(SIGQUIT, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGQUIT, {sa_handler=SIG_IGN, sa_mask=~[RTMIN RT_1 RT_2], sa_flags=SA_RESTORER, sa_restorer=0x8114571}, NULL, 8) = 0
rt_sigaction(SIGTERM, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
execve("/usr/bin/gcc", ["/usr/bin/gcc", "test.cpp", "-Wno-write-strings"], 0x8f1832c /* 14 vars */) = 0
set_thread_area({entry_number=-1, base_addr=0x8177bf4, limit=0x0fffff, seg_32bit=1, contents=0, read_exec_only=0, limit_in_pages=1, seg_not_present=0, useable=1}) = 0 (entry_number=6)
set_tid_address(0x8177dc8) = 16029
brk(NULL) = 0x986d000
brk(0x986e000) = 0x986e000
brk(NULL) = 0x986e000
brk(0x9870000) = 0x9870000
brk(0x9881000) = 0x9881000
brk(0x9882000) = 0x9882000
ioctl(2, TIOCGWINSZ, 0xbfec0478) = -1 EINVAL (Invalid argument)
ioctl(2, TIOCGWINSZ, 0xbfec0478) = -1 EINVAL (Invalid argument)
rt_sigaction(SIGINT, {sa_handler=SIG_IGN, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x80d9557}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RT_1 RT_2], NULL, 8) = 0
rt_sigaction(SIGINT, {sa_handler=0x804cc90, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x80d9557}, {sa_handler=SIG_IGN, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x80d9557}, 8) = 0
rt_sigaction(SIGHUP, {sa_handler=SIG_IGN, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x80d9557}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGHUP, {sa_handler=0x804cc90, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x80d9557}, {sa_handler=SIG_IGN, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x80d9557}, 8) = 0
rt_sigaction(SIGTERM, {sa_handler=SIG_IGN, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x80d9557}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGTERM, {sa_handler=0x804cc90, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x80d9557}, {sa_handler=SIG_IGN, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x80d9557}, 8) = 0
rt_sigaction(SIGPIPE, {sa_handler=SIG_IGN, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x80d9557}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGPIPE, {sa_handler=0x804cc90, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x80d9557}, {sa_handler=SIG_IGN, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x80d9557}, 8) = 0
rt_sigaction(SIGCHLD, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x80d9557}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1 RT_2], [], 8) = 0
rt_sigprocmask(SIG_BLOCK, ~[], NULL, 8) = 0
prlimit64(0, RLIMIT_STACK, {rlim_cur=65536*1024, rlim_max=RLIM64_INFINITY}, NULL) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
brk(0x9883000) = 0x9883000
brk(0x9884000) = 0x9884000
open("/usr/bin/gcc", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_CLOEXEC|O_PATH) = 3
readlink("/proc/self/fd/3", "/usr/bin/gcc", 4095) = 12
fstat64(3, {st_mode=S_IFREG|0755, st_size=1490096, ...}) = 0
stat64("/usr/bin/gcc", {st_mode=S_IFREG|0755, st_size=1490096, ...}) = 0
close(3) = 0
open("/usr/bin/gcc", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_CLOEXEC|O_PATH) = 3
readlink("/proc/self/fd/3", "/usr/bin/gcc", 4095) = 12
fstat64(3, {st_mode=S_IFREG|0755, st_size=1490096, ...}) = 0
stat64("/usr/bin/gcc", {st_mode=S_IFREG|0755, st_size=1490096, ...}) = 0
close(3) = 0
access("test.cpp", F_OK) = 0
access("/usr/lib/gcc/i686-test-linux/8.3.0/", X_OK) = 0
access("/usr/lib/gcc/i686-test-linux/8.3.0/", X_OK) = 0
brk(0x9885000) = 0x9885000
access("/usr/lib/gcc/i686-test-linux/8.3.0/specs", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/lib/gcc/i686-test-linux/8.3.0/../../../../i686-test-linux/lib/i686-test-linux/8.3.0/specs", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/lib/gcc/i686-test-linux/8.3.0/../../../../i686-test-linux/lib/specs", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/lib/gcc/i686-test-linux/specs", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/lib/gcc/i686-test-linux/8.3.0/", X_OK) = 0
brk(0x9886000) = 0x9886000
stat64("/usr/libexec/gcc/i686-test-linux/8.3.0/lto-wrapper", {st_mode=S_IFREG|0755, st_size=1397652, ...}) = 0
access("/usr/libexec/gcc/i686-test-linux/8.3.0/lto-wrapper", X_OK) = 0
brk(0x9887000) = 0x9887000
access("/tmp", R_OK|W_OK|X_OK) = 0
clock_gettime(CLOCK_REALTIME, {tv_sec=1561737208, tv_nsec=84838200}) = 0
open("/tmp/ccoIKDmM.s", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0600) = 3
close(3) = 0
stat64("/usr/libexec/gcc/i686-test-linux/8.3.0/cc1plus", {st_mode=S_IFREG|0755, st_size=30230160, ...}) = 0
access("/usr/libexec/gcc/i686-test-linux/8.3.0/cc1plus", X_OK) = 0
vfork() = 16030
wait4(16030, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 16030
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=16030, si_uid=0, si_status=0, si_utime=38, si_stime=3} ---
clock_gettime(CLOCK_REALTIME, {tv_sec=1561737208, tv_nsec=558595000}) = 0
open("/tmp/ccaIfIIE.o", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0600) = 3
close(3) = 0
stat64("/usr/libexec/gcc/i686-test-linux/8.3.0/as", 0xbfec0280) = -1 ENOENT (No such file or directory)
stat64("/usr/libexec/gcc/i686-test-linux/8.3.0/as", 0xbfec0280) = -1 ENOENT (No such file or directory)
stat64("/usr/libexec/gcc/i686-test-linux/as", 0xbfec0280) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/gcc/i686-test-linux/8.3.0/as", 0xbfec0280) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/gcc/i686-test-linux/as", 0xbfec0280) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/gcc/i686-test-linux/8.3.0/../../../../i686-test-linux/bin/i686-test-linux/8.3.0/as", 0xbfec0280) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/gcc/i686-test-linux/8.3.0/../../../../i686-test-linux/bin/as", {st_mode=S_IFREG|0755, st_size=1780284, ...}) = 0
access("/usr/lib/gcc/i686-test-linux/8.3.0/../../../../i686-test-linux/bin/as", X_OK) = 0
vfork() = 16031
wait4(16031, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 16031
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=16031, si_uid=0, si_status=0, si_utime=1, si_stime=0} ---
stat64("/usr/libexec/gcc/i686-test-linux/8.3.0/collect2", {st_mode=S_IFREG|0755, st_size=1058760, ...}) = 0
access("/usr/libexec/gcc/i686-test-linux/8.3.0/collect2", X_OK) = 0
stat64("/usr/libexec/gcc/i686-test-linux/8.3.0/.", {st_mode=S_IFDIR|0777, st_size=4096, ...}) = 0
stat64("/usr/libexec/gcc/i686-test-linux/8.3.0/.", {st_mode=S_IFDIR|0777, st_size=4096, ...}) = 0
stat64("/usr/libexec/gcc/i686-test-linux/.", {st_mode=S_IFDIR|0777, st_size=0, ...}) = 0
stat64("/usr/lib/gcc/i686-test-linux/8.3.0/.", {st_mode=S_IFDIR|0777, st_size=4096, ...}) = 0
stat64("/usr/lib/gcc/i686-test-linux/.", {st_mode=S_IFDIR|0777, st_size=0, ...}) = 0
stat64("/usr/lib/gcc/i686-test-linux/8.3.0/../../../../i686-test-linux/bin/i686-test-linux/8.3.0/.", 0xbfec0360) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/gcc/i686-test-linux/8.3.0/../../../../i686-test-linux/bin/.", {st_mode=S_IFDIR|0777, st_size=4096, ...}) = 0
stat64("/usr/lib/gcc/i686-test-linux/8.3.0/.", {st_mode=S_IFDIR|0777, st_size=4096, ...}) = 0
stat64("/usr/lib/gcc/i686-test-linux/8.3.0/../../../../i686-test-linux/lib/i686-test-linux/8.3.0/.", 0xbfec0360) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/gcc/i686-test-linux/8.3.0/../../../../i686-test-linux/lib/.", {st_mode=S_IFDIR|0777, st_size=0, ...}) = 0
stat64("/usr/lib/gcc/i686-test-linux/8.3.0/../../../i686-test-linux/8.3.0/.", 0xbfec0360) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/gcc/i686-test-linux/8.3.0/../../../.", {st_mode=S_IFDIR|0777, st_size=24576, ...}) = 0
stat64("/usr/lib/i686-test-linux/8.3.0/.", 0xbfec0360) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/.", {st_mode=S_IFDIR|0777, st_size=24576, ...}) = 0
stat64("/usr/usr/lib/i686-test-linux/8.3.0/.", 0xbfec0360) = -1 ENOENT (No such file or directory)
stat64("/usr/usr/lib/.", 0xbfec0360) = -1 ENOENT (No such file or directory)
brk(0x9888000) = 0x9888000
brk(0x9889000) = 0x9889000
brk(0x988a000) = 0x988a000
brk(0x988b000) = 0x988b000
brk(0x988c000) = 0x988c000
access("/usr/lib/gcc/i686-test-linux/8.3.0/crt1.o", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/lib/gcc/i686-test-linux/8.3.0/../../../../i686-test-linux/lib/i686-test-linux/8.3.0/crt1.o", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/lib/gcc/i686-test-linux/8.3.0/../../../../i686-test-linux/lib/crt1.o", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/lib/gcc/i686-test-linux/8.3.0/../../../i686-test-linux/8.3.0/crt1.o", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/lib/gcc/i686-test-linux/8.3.0/../../../crt1.o", R_OK) = 0
access("/usr/lib/gcc/i686-test-linux/8.3.0/crti.o", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/lib/gcc/i686-test-linux/8.3.0/../../../../i686-test-linux/lib/i686-test-linux/8.3.0/crti.o", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/lib/gcc/i686-test-linux/8.3.0/../../../../i686-test-linux/lib/crti.o", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/lib/gcc/i686-test-linux/8.3.0/../../../i686-test-linux/8.3.0/crti.o", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/lib/gcc/i686-test-linux/8.3.0/../../../crti.o", R_OK) = 0
access("/usr/lib/gcc/i686-test-linux/8.3.0/crtbegin.o", R_OK) = 0
stat64("/usr/lib/gcc/i686-test-linux/8.3.0/.", {st_mode=S_IFDIR|0777, st_size=4096, ...}) = 0
stat64("/usr/lib/gcc/i686-test-linux/8.3.0/../../../../i686-test-linux/lib/i686-test-linux/8.3.0/.", 0xbfebfb00) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/gcc/i686-test-linux/8.3.0/../../../../i686-test-linux/lib/.", {st_mode=S_IFDIR|0777, st_size=0, ...}) = 0
stat64("/usr/lib/gcc/i686-test-linux/8.3.0/../../../i686-test-linux/8.3.0/.", 0xbfebfb00) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/gcc/i686-test-linux/8.3.0/../../../.", {st_mode=S_IFDIR|0777, st_size=24576, ...}) = 0
stat64("/usr/lib/i686-test-linux/8.3.0/.", 0xbfebfb00) = -1 ENOENT (No such file or directory)
stat64("/usr/usr/lib/i686-test-linux/8.3.0/.", 0xbfebfb00) = -1 ENOENT (No such file or directory)
stat64("/usr/usr/lib/.", 0xbfebfb00) = -1 ENOENT (No such file or directory)
access("/usr/lib/gcc/i686-test-linux/8.3.0/crtend.o", R_OK) = 0
access("/usr/lib/gcc/i686-test-linux/8.3.0/crtn.o", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/lib/gcc/i686-test-linux/8.3.0/../../../../i686-test-linux/lib/i686-test-linux/8.3.0/crtn.o", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/lib/gcc/i686-test-linux/8.3.0/../../../../i686-test-linux/lib/crtn.o", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/lib/gcc/i686-test-linux/8.3.0/../../../i686-test-linux/8.3.0/crtn.o", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/lib/gcc/i686-test-linux/8.3.0/../../../crtn.o", R_OK) = 0
stat64("/usr/libexec/gcc/i686-test-linux/8.3.0/collect2", {st_mode=S_IFREG|0755, st_size=1058760, ...}) = 0
access("/usr/libexec/gcc/i686-test-linux/8.3.0/collect2", X_OK) = 0
vfork() = 16032
wait4(16032, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 16032
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=16032, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
stat64("/tmp/ccaIfIIE.o", {st_mode=S_IFREG|0600, st_size=175096, ...}) = 0
unlink("/tmp/ccaIfIIE.o") = 0
stat64("/tmp/ccoIKDmM.s", {st_mode=S_IFREG|0600, st_size=333416, ...}) = 0
unlink("/tmp/ccoIKDmM.s") = 0
exit_group(0) = ?
+++ exited with 0 +++
为 gcc 应用补丁:(用于在 *-test-linux-gnu
中支持 musl)
diff -- a/gcc/config.gcc b/gcc/config.gcc
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -779,7 +779,7 @@ case ${target} in
*-*-*uclibc*)
tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC"
;;
- *-*-*musl*)
+ *-*-*musl* | *-test-*-gnu )
tm_defines="$tm_defines DEFAULT_LIBC=LIBC_MUSL"
;;
*)
diff -- a/libstdc++-v3/configure b/libstdc++-v3/configure
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -28912,7 +28912,7 @@ else
# First, test for "known" system libraries. We may be using newlib even
# on a hosted environment.
if test "x${with_newlib}" = "xyes"; then
- os_include_dir="os/newlib"
+ os_include_dir="os/generic"
$as_echo "#define HAVE_HYPOT 1" >>confdefs.h
diff -- a/libstdc++-v3/configure.host b/libstdc++-v3/configure.host
--- a/libstdc++-v3/configure.host
+++ b/libstdc++-v3/configure.host
@@ -393,3 +393,11 @@ case "${host}" in
abi_baseline_subdir_switch=--print-multi-os-directory
;;
esac
+
+# TEST Linux patch
+case "${host}" in
+ *-test-* | *-test-dev-* )
+ os_include_dir="os/generic"
+ ;;
+esac
+
./配置选项(gcc -###):
Using built-in specs.
COLLECT_GCC=gcc
Target: i686-test-linux
Configured with: /l/src/build/i686-test-linux/gcc-8.3.0/configure CFLAGS='-static -O2' CXXFLAGS='-static -O2'
--build=i686-test-linux --host=i686-test-linux --target=i686-test-linux --prefix=/usr/ --with-sysroot=/usr/
--with-native-system-header-dir=/include --with-local-prefix=/usr/ --with-newlib --without-headers --enable-languages=c,c++
--disable-libstdcxx --disable-nls --disable-shared --disable-multilib --disable-decimal-float --disable-threads
--disable-libada --disable-libatomic --disable-libffi --disable-libgomp --disable-libhsail-rt --disable-libitm
--disable-libmpx --disable-libobjc --disable-liboffloadmic --disable-libquadmath --disable-libsanitizer --disable-libssp
--disable-libstdc++-v3 --disable-libvtv --disable-bootstrap
Thread model: single
gcc version 8.3.0 (TEST Embedded Linux Toolchain for [i686])```
我已经测试了这些更改,但没有解决:
我的linux环境只有:
注意:我的 linux 没有任何包管理器。所以不能像'sudo apt-get install g++'那样使用它
最佳答案
我用简单的方法解决了这个问题。
export PATH
执行此命令后,使用相对路径编译即可成功。
找到它的途径:
$ PATH=${PATH}:/usr/libexec/gcc/i686-test-linux/8.3.0/
-> 成功
根据strace log,我认为gcc并没有使用$PATH来搜索cc1/cc1plus。为什么?
$ PATH=${PATH}:/usr/bin
-> 成功
$ echo ${PATH}
/sbin:/usr/sbin:/bin:/usr/bin
$ PATH=${PATH} gcc
-> 成功
$ gcc
和 $ PATH=$PATH gcc
有什么区别???$ set
HOME='/'
HOSTNAME='TEST0'
IFS='
'
LINENO=''
OLDPWD='/'
OPTIND='1'
PATH='/sbin:/usr/sbin:/bin:/usr/bin'
PPID='2701'
PS1='\w \$ '
PS2='> '
PS4='+ '
PWD='/'
SHLVL='8'
TERM='linux'
$ export
export HOME='/'
export OLDPWD='/'
export PWD='/'
export SHLVL='8'
export TERM='linux'
哦,PATH 不导出为环境变量。仅作为 shell 变量存在...
关于c - 没有完整路径的 gcc : error trying to exec 'cc1' : execvp: No such file or directory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56810443/
我试图找到使用这行代码的原因 var cc = cc = cc || {}; 在 Cocos2D JavaScript 库中,例如 this地方,但我找不到任何合理的理由。就设置默认值而言,单一赋值是
我的 make 文件中有这些行: ifeq ($(SYSTEM),SOLARIS) # SUN Solaris 8 no c99 ifeq ($(OSVER),510)
服务器详细信息 MySQL 5.6.22 256GB 内存 4TB 固态硬盘 32 核 背景信息 有一个删除进程,每秒大约执行 3 次删除。每秒 2-3k QPS。主要是 SELECT。没有长时间运行
我正在 Spring 的帮助下发送邮件,其中我想要 CC 中的多个电子邮件 ID,所有人都会收到邮件,但问题是当他们在rackspace(apps.rackspace.com)中打开电子邮件时,它只显
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 这个问题似乎不是关于 a specific programming problem, a softwar
我有一个生成文件。当我在 Unix 上运行它时,我得到这个错误: cc -I/opt/oracle/product/9.2.0/rdbms/demo -I/opt/oracle/product/9.2
直观的逻辑,具有 build 性,是函数式编程中类型系统的基础。经典逻辑不是 build 性的,尤其是排中律 A ∨ ¬A(或其等价物,例如 double negation elimination 或
我必须使用我之前创建的列表文件在 C++ 中编写一个队列,并且我很难编译所有内容。 我目前遇到的问题是,当我编译时出现错误: Queue.h:7:2: 错误:'List' 没有命名类型 如何正确连接队
使用支持延续的语言,例如Scheme、Ruby 和 Haskell,假设有一个函数 cc' 不带参数并返回当前延续,以便通过调用 cc' 获得延续的调用者然后可以随心所欲地在任何地方调用延续。 cc'
我有一个 InDesign 文档,其中包含不同宽度尺寸的页面。现在我想用 JS 脚本添加垂直指南。因此我必须添加 pageWidth + pageWidth (特定页面的)。 但我只知道如何获取文档尺
像这样,我有一个对象: { 'person': { 'like': { 'color': 'red', 'food': 'rice' }, 'nam
我知道我可以用: string input = "AA,BB,CC"; string output = ""; foreach (var item in
我正在尝试使用我使用 Label-img 标记的样本来训练对象检测算法。我的图像尺寸为 1100 x 1100 像素。我使用的算法是在 TensorFlow 2 Detection Model Zoo
我正在尝试学习 C,并且刚刚开始阅读“艰难地学习 C”这本书。在第二课中,作者提到了 Makefiles,并指出当使用命令“make example.c”时,“make”会自动调用 cc 来构建 .c
在我的主要方法的一开始,我就有了 main(int argc, char *argv[]){ if(argc!=2){ printf("not enough arguments"); ex
因此,我有一个 c 模块,其中我修改了两件事:向函数添加了一个参数,向结构体添加了一个参数。 问题是,当使用 cc 进行编译时(从我继承的脚本),无论我的更改在哪里,我都会收到错误消息(抱歉,如果翻译
我浪费了很多时间来弄清楚为什么一种算法应该比另一种算法更有效,然而,就速度而言,另一种算法却完全相同。我做了这些操作:我在一个单独的终端窗口中编译了第一个源代码;而第二个源代码在另一个窗口中。我只是用
多次按 Tab 不会将文本向右移动。有没有办法让它表现得像 Visual Studio 的智能缩进?第一个制表符缩进,随后的制表符将文本移动到下一个制表位。谢谢你。 最佳答案 像这样的东西? (def
如果我使用 C 编译器 cc,则命令行完成不起作用。如果我输入 cc dig + press tab 那么什么都不会发生,但是如果我用 cc digenv.c 编译程序,那么它就可以工作。为什么 cc
有人对它的工作原理有很好的指导吗?带有视觉辅助的东西会很好,我遇到的每个指南似乎都在说我需要重新尝试的同一件事。 最佳答案 这是留在CS实验室白板上的图。因此,您将要获取一些苹果,然后在开始操作之前先
我是一名优秀的程序员,十分优秀!