Ubuntu/Linux Mint安装Kamailio遇mysql.h缺失编译错误求助
Hey there, let's get your Kamailio installation sorted out—this is a common issue with missing development dependencies, so we'll tackle it step by step:
1. Resolve the mysql.h Fatal Error
The error fatal error: mysql.h: Adresár alebo súbor neexistuje translates to "Directory or file doesn't exist"—this means your system is missing the MySQL development libraries needed to compile Kamailio's MySQL modules.
On Ubuntu/Linux Mint, install the required package with this command:
sudo apt-get update && sudo apt-get install libmysqlclient-dev
This package includes all the header files (like mysql.h) and static libraries required for compiling software that interacts with MySQL.
2. Fix Directory Missing Issues
If you're hitting directory not found errors during setup, here's what to check:
- Ensure you cloned the correct repository and branch: Since you're following the 4.4.x guide, make sure you checked out the right branch after cloning:
git clone https://github.com/kamailio/kamailio.git cd kamailio git checkout 4.4 - Generate the build configuration: Before compiling, run the
make cfgcommand in the Kamailio root directory. This creates the necessary build directories and configuration files:make cfg - Verify you're in the right directory: Always run compilation commands from the root of the Kamailio repository you cloned—don't try to run them from a subdirectory unless the guide specifies it.
3. Recompile Kamailio
Once the dependencies are installed and directory structure is fixed, re-run your compilation command (usually make all or make followed by sudo make install):
make all sudo make install
That should resolve both the missing mysql.h error and directory-related issues. If you run into any other hiccups, feel free to share more details!
内容的提问来源于stack exchange,提问作者Kajim

