安装旧版Tor时libevent C头文件找不到的问题求助
Got it, let's break down why this error is happening and get your Tor build working smoothly.
The Root Cause
When you run ./configure --with-libevent-dir=/libevent/lib/x86_64-linux-gnu/, you're pointing the configure script directly to the library subdirectory—but it still needs access to the header files, which live in the include folder at the top level of your libevent directory. Most older configure scripts expect --with-libevent-dir to point to the parent folder containing both include/ and lib/ subdirectories, not just the lib subfolder.
Step-by-Step Solutions
1. Point to the Top-Level Libevent Directory
Update your configure command to target the root of your libevent folder (the one containing include/, lib/, and share/). For example, if your libevent folder is in your current working directory, run:
./configure --with-libevent-dir=./libevent/
This lets the configure script automatically locate both the header files (in ./libevent/include/) and libraries (in ./libevent/lib/x86_64-linux-gnu/) without extra flags.
2. Explicitly Separate Include and Library Paths
If the first method doesn't work (some older configure scripts are stricter about path parsing), you can specify the header and library paths separately to remove ambiguity:
./configure --with-libevent-include=./libevent/include/ --with-libevent-lib=./libevent/lib/x86_64-linux-gnu/
This directly tells the script exactly where to look for the required headers and compiled libraries.
3. Verify Critical Header Files
From your directory structure, I can see event2/event-config.h exists—this is a key file that old Tor versions depend on. Since this file is present, the above commands should resolve the "header files not found" error once you use the correct paths.
内容的提问来源于stack exchange,提问作者Antonio Sanchez

