Kali系统编译Ettercap插件报错:ec.h文件找不到求解决
First off, you don't need to move your source code to a specific location—the issue has nothing to do with where your attack_test.c is stored. The problem is that GCC can't locate the ec.h header file when compiling. Let's break down the fixes step by step:
Step 1: Check if
ec.hexists on your system
Open a terminal and run this command to search for the header file across your system:find / -name ec.h 2>/dev/nullIf no results appear: You're missing the library that provides
ec.h. In Kali, this is almost always part of the OpenSSL development package. Install it with:sudo apt update && sudo apt install libssl-devThis package places
ec.hin/usr/include/openssl/, a standard path GCC checks by default.If results show up (e.g.,
/usr/include/openssl/ec.h): Either your code uses the wrong include statement, or GCC needs explicit instructions to find the file's directory.
Step 2: Fix the include statement or specify the path to GCC
- If
ec.hlives in/usr/include/openssl/, update yourattack_test.cto use the full qualified include line:#include <openssl/ec.h> - If you don't want to modify the code, add the include directory to your compile command with the
-Iflag. For example, ifec.his in/custom/path/include, your command becomes:gcc -shared -o attack_test.so -fPIC -I/custom/path/include attack_test.c
- If
Step 3: Verify the fix
After installing the package or adjusting the include path, re-run your original compile command. It should now locateec.hwithout errors.
If you've made partial progress already (like installing some packages but still hitting snags), double-check that the include path is correctly specified or that the library version matches what your code expects. Some custom crypto library builds might place ec.h in non-standard locations, so the find command will help you pinpoint exactly where it's stored.
内容的提问来源于stack exchange,提问作者Aidan

