You are here

編譯openser出現 mysql/mysql.h: No such file or directory 的錯誤

前幾天在跟A-Lang大大談論VOIP時有談到, 用Asterisk架的VoIP並不是真的點對點, 實際在語音通話時還是會吃到SIP Server的頻寬, 如果要實現點對點的話那就要使巾SER或是OPENSER了, 這次我先使用OPENSER進行試驗

在編譯的過程, 因為我要把 mysql module 也編進去所以打了以下命令

make all include_module "mysql"

結果出現了以下錯誤... error: mysql/mysql.h: No such file or directory

make[1]: Entering directory `/tmp/openser-1.3.2-tls/modules/mysql'
Compiling dbase.c
gcc -fPIC -DPIC -g -O9 -funroll-loops -Wcast-align -Wall -minline-all-stringops -falign-loops -ftree-vectorize -mtune=prescott -Wold-style-definition -Wmissing-field-initializers -DMOD_NAME='"mysql"'    -DNAME='"openser"' -DVERSION='"1.3.2-notls"' -DARCH='"i386"' -DOS='"linux"' -DCOMPILER='"gcc 4.0.3"' -D__CPU_i386 -D__OS_linux -D__SMP_yes -DCFG_DIR='"/usr/local/etc/openser/"' -DPKG_MALLOC -DSHM_MEM  -DSHM_MMAP -DUSE_IPV6 -DUSE_MCAST -DUSE_TCP -DDISABLE_NAGLE -DHAVE_RESOLV_RES -DSTATISTICS -DCHANGEABLE_DEBUG_LEVEL -DF_MALLOC  -DFAST_LOCK -DADAPTIVE_WAIT -DADAPTIVE_WAIT_LOOPS=1024  -DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD -DHAVE_MSG_NOSIGNAL -DHAVE_MSGHDR_MSG_CONTROL -DHAVE_ALLOCA_H -DHAVE_TIMEGM -DHAVE_EPOLL -DHAVE_SIGIO_RT -DHAVE_SELECT -I/usr/local/include -I/usr/local/include/mysql -I/usr/local/mysql/include/mysql -I/usr/local/mysql/include -I/usr/include/mysql -c dbase.c -o dbase.o
dbase.c:29:25: error: mysql/mysql.h: No such file or directory
dbase.c:30:26: error: mysql/errmsg.h: No such file or directory
dbase.c:31:33: error: mysql/mysql_version.h: No such file or directory
In file included from dbase.c:38:
my_con.h:38: error: syntax error before ‘MYSQL_RES’
my_con.h:38: warning: no semicolon at end of struct or union
my_con.h:39: warning: type defaults to ‘int’ in declaration of ‘con’
my_con.h:39: warning: data definition has no type or storage class
my_con.h:40: error: syntax error before ‘row’
my_con.h:40: warning: type defaults to ‘int’ in declaration of ‘row’
my_con.h:40: warning: data definition has no type or storage class
my_con.h:42: error: syntax error before ‘}’ token
dbase.c: In function ‘db_mysql_submit_query’:
dbase.c:65: error: dereferencing pointer to incomplete type
dbase.c:66: warning: implicit declaration of function ‘mysql_ping’
dbase.c:66: error: dereferencing pointer to incomplete type
dbase.c:70: error: dereferencing pointer to incomplete type
dbase.c:88: warning: implicit declaration of function ‘mysql_query’
dbase.c:88: error: dereferencing pointer to incomplete type
dbase.c:91: warning: implicit declaration of function ‘mysql_errno’
dbase.c:91: error: dereferencing pointer to incomplete type
dbase.c:92: error: ‘CR_SERVER_GONE_ERROR’ undeclared (first use in this function)
dbase.c:92: error: (Each undeclared identifier is reported only once
dbase.c:92: error: for each function it appears in.)
dbase.c:92: error: ‘CR_SERVER_LOST’ undeclared (first use in this function)
dbase.c:96: warning: implicit declaration of function ‘mysql_error’
dbase.c:96: error: dereferencing pointer to incomplete type
dbase.c:96: error: dereferencing pointer to incomplete type
dbase.c:96: warning: format ‘%s’ expects type ‘char *’, but argument 4 has type ‘int’
dbase.c: In function ‘db_mysql_store_result’:
dbase.c:195: error: dereferencing pointer to incomplete type
dbase.c:195: warning: implicit declaration of function ‘mysql_store_result’
dbase.c:195: error: dereferencing pointer to incomplete type
dbase.c:196: error: dereferencing pointer to incomplete type
dbase.c:197: warning: implicit declaration of function ‘mysql_field_count’
dbase.c:197: error: dereferencing pointer to incomplete type
dbase.c:202: error: dereferencing pointer to incomplete type
dbase.c:202: error: dereferencing pointer to incomplete type
dbase.c:202: warning: format ‘%s’ expects type ‘char *’, but argument 4 has type ‘int’
dbase.c:216: warning: implicit declaration of function ‘mysql_free_result’
dbase.c:216: error: dereferencing pointer to incomplete type
dbase.c:223: error: dereferencing pointer to incomplete type
dbase.c: In function ‘db_mysql_free_result’:
dbase.c:253: error: dereferencing pointer to incomplete type
dbase.c:254: error: dereferencing pointer to incomplete type
dbase.c: In function ‘db_mysql_fetch_result’:
dbase.c:361: error: dereferencing pointer to incomplete type
dbase.c:361: error: dereferencing pointer to incomplete type
dbase.c:362: error: dereferencing pointer to incomplete type
dbase.c:363: error: dereferencing pointer to incomplete type
dbase.c:368: error: dereferencing pointer to incomplete type
dbase.c:368: error: dereferencing pointer to incomplete type
dbase.c:368: warning: format ‘%s’ expects type ‘char *’, but argument 4 has type ‘int’
dbase.c:379: warning: implicit declaration of function ‘mysql_num_rows’
dbase.c:379: error: dereferencing pointer to incomplete type
dbase.c:414: error: dereferencing pointer to incomplete type
dbase.c:414: warning: implicit declaration of function ‘mysql_fetch_row’
dbase.c:414: error: dereferencing pointer to incomplete type
dbase.c:415: error: dereferencing pointer to incomplete type
dbase.c:416: error: dereferencing pointer to incomplete type
dbase.c:416: error: dereferencing pointer to incomplete type
dbase.c:416: warning: format ‘%s’ expects type ‘char *’, but argument 4 has type ‘int’
dbase.c: In function ‘db_last_inserted_id’:
dbase.c:649: warning: implicit declaration of function ‘mysql_insert_id’
dbase.c:649: error: dereferencing pointer to incomplete type
make[1]: *** [dbase.o] Error 1
make[1]: Leaving directory `/tmp/openser-1.3.2-tls/modules/mysql'
make: *** [modules] Error 2

經過在Google上的查詢, 這是因為沒有安裝「ibmysqlclient-dev」套件, 裝完之後再重編就行了

解法是參考這篇文章

Tags: