1、按照readme操作,進入lib目錄下make報錯:
gcc -g -o2 -d_reentrant -wall -d_posix_pthread_semantics -c -o daemon_inetd.o daemon_inetd.c
in file included from /usr/include/netinet/in.h:24,
from /usr/include/rpc/types.h:90,
from /usr/include/rpc/rpc.h:38,
from unpipc.h:115,
from daemon_inetd.c:1:
/usr/include/stdint.h:49: error: duplicate 『unsigned』
/usr/include/stdint.h:49: error: two or more data types in declaration specifiers
/usr/include/stdint.h:50: error: duplicate 『unsigned』
/usr/include/stdint.h:50: error: duplicate 『short』
/usr/include/stdint.h:52: error: duplicate 『unsigned』
/usr/include/stdint.h:52: error: two or more data types in declaration specifiers
make: *** [daemon_inetd.o] 錯誤 1
修改config.h 注釋掉一下三行:
//#define uint8_t unsigned char /* */
//#define uint16_t unsigned short /* */
//#define uint32_t unsigned int /* */
./libunpipc.a(wrapunix.o): in function `mktemp':
/home/vonnyfly/document/unix_src/unpv22e/lib/wrapunix.c:184: warning: the use of `mktemp' is dangerous, better use `mkstemp' or `mkdtemp'
/tmp/cckndn2n.o: in function `main':
mqcreate1.c:(.text+0x3a): undefined reference to `getopt'
./libunpipc.a(wrapunix.o): in function `shm_unlink':
wrapunix.c:(.text+0x54d): undefined reference to `shm_unlink'
./libunpipc.a(wrapunix.o): in function `shm_open':
wrapunix.c:(.text+0x58c): undefined reference to `shm_open'
./libunpipc.a(wrapunix.o): in function `sem_getvalue':
wrapunix.c:(.text+0x6d4): undefined reference to `sem_getvalue'
./libunpipc.a(wrapunix.o): in function `sem_post':
wrapunix.c:(.text+0x6fd): undefined reference to `sem_post'
./libunpipc.a(wrapunix.o): in function `sem_trywait':
wrapunix.c:(.text+0x72e): undefined reference to `sem_trywait'
./libunpipc.a(wrapunix.o): in function `sem_wait':
wrapunix.c:(.text+0x77d): undefined reference to `sem_wait'
./libunpipc.a(wrapunix.o): in function `sem_destroy':
wrapunix.c:(.text+0x7ad): undefined reference to `sem_destroy'
./libunpipc.a(wrapunix.o): in function `sem_init':
wrapunix.c:(.text+0x7eb): undefined reference to `sem_init'
./libunpipc.a(wrapunix.o): in function `sem_unlink':
wrapunix.c:(.text+0x81d): undefined reference to `sem_unlink'
./libunpipc.a(wrapunix.o): in function `sem_close':
wrapunix.c:(.text+0x84d): undefined reference to `sem_close'
./libunpipc.a(wrapunix.o): in function `sem_open':
wrapunix.c:(.text+0x897): undefined reference to `sem_open'
wrapunix.c:(.text+0x8b0): undefined reference to `sem_open'
./libunpipc.a(wrapunix.o): in function `mq_setattr':
wrapunix.c:(.text+0xbeb): undefined reference to `mq_setattr'
./libunpipc.a(wrapunix.o): in function `mq_getattr':
wrapunix.c:(.text+0xc24): undefined reference to `mq_getattr'
./libunpipc.a(wrapunix.o): in function `mq_notify':
wrapunix.c:(.text+0xc54): undefined reference to `mq_notify'
./libunpipc.a(wrapunix.o): in function `mq_receive':
wrapunix.c:(.text+0xc92): undefined reference to `mq_receive'
./libunpipc.a(wrapunix.o): in function `mq_send':
wrapunix.c:(.text+0xce2): undefined reference to `mq_send'
./libunpipc.a(wrapunix.o): in function `mq_unlink':
wrapunix.c:(.text+0xd0d): undefined reference to `mq_unlink'
./libunpipc.a(wrapunix.o): in function `mq_close':
wrapunix.c:(.text+0xd3d): undefined reference to `mq_close'
./libunpipc.a(wrapunix.o): in function `mq_open':
wrapunix.c:(.text+0xd79): undefined reference to `__mq_open_2'
wrapunix.c:(.text+0xd9e): undefined reference to `mq_open'
collect2: ld returned 1 exit status
解決辦法:gcc 新增-lrt命令選項(具體檢視man mq_open)
3、找不到getopt:
/tmp/ccv1uey3.o: in function `main':
mqcreate1.c:(.text+0x3a): undefined reference to `getopt'
collect2: ld returned 1 exit status
直接把程式改了getopt,沒關係。
Unix網路程式設計(卷二)原始碼編譯報錯解決
1 按照readme操作,進入lib目錄下make報錯 gcc g o2 d reentrant wall d posix pthread semantics c o daemon inetd.o daemon inetd.c in file included from usr include ne...
《unix網路程式設計》原始碼編譯
tar xzvf unpv13e.tar.gz cd unpv13e 編譯過程,及遇到的問題。可以通過檢視readme檔案來檢視編譯步驟 1 編譯庫 configure cd lib make cd libfree make 會報錯 inet ntop.c 61 error argument siz...
unix網路程式設計書籍原始碼編譯和測試
我在本人的資源中上傳乙份unix網路程式設計的原始碼,當然也是我從網上就可以找的,放在這裡是為了大家尋找方便點,如下 unix網路程式設計這本書的原始碼類似於很多系統軟體的原始碼組織。首先拿到原始碼之後閱讀原始碼的readme檔案。configure try to figure out all im...