[英]fatal error: sys/socket.h: No such file or directory, x86_64-w64-mingw32 mode
[英]sys/socket.h is not found for gcc arm x86_64-aarch64 cross compiling
我正在嘗試交叉編譯(通過gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf )一個簡單的測試。c
#include <sys/socket.h>
#include <stdio.h>
#include <unistd.h>
int main()
{
int s = socket(AF_INET, 0, 0);
printf("socket = %i\n", s);
close(s);
}
用這個命令
/opt/gcc-arm-8.3-2019.03-x86_64-aarch64-elf/bin/aarch64-elf-gcc test.c -o test
但它失敗並顯示一條消息:
test.c:1:10:致命錯誤: sys/socket.h:沒有這樣的文件或目錄
我什至用-I
標志指定了 /usr/include 目錄,但找不到asm/socket.h
同樣,我直接從編譯器可執行目錄(來自/opt/gcc-arm-8.3-2019.03-x86_64-aarch64-elf/bin/)嘗試過,但 ld 無法鏈接 test.c 中的任何符號。
同樣使用gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf進行了測試
正如user253751和Ian Abbott在評論中回答的那樣,沒有 header 文件,因為沒有定義“套接字”實體的操作系統。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.