hightman / xunsearch

免费开源的中文搜索引擎,采用 C/C++ 编写 (基于 xapian 和 scws),提供 PHP 的开发接口和丰富文档
http://www.xunsearch.com
Other
1.65k stars 391 forks source link

Compile error when configure with custom xapian location #1

Closed KDr2 closed 11 years ago

KDr2 commented 12 years ago

I installed

  1. libevent1 to /Volumes/KDr2/Developer/libevent1
  2. scws to /Volumes/KDr2/Developer/scws
  3. xapian-core(scws patch) to /Volumes/KDr2/Developer/xapian-scws

Then I configure xunsearch with command:

./configure --prefix=/Volumes/KDr2/Developer/xunsearch \
--with-libevent=/Volumes/KDr2/Developer/libevent1 \
--with-scws=/Volumes/KDr2/Developer/scws \
--with-xapian=/Volumes/KDr2/Developer/xapian-scws

Till here all things go well, here's the configure output:

KDr2@KDr2-MacBookPro:~/Work/seas/xunsearch$ ./configure --prefix=/Volumes/KDr2/Developer/xunsearch --with-libevent=/Volumes/KDr2/Developer/libevent1 --with-scws=/Volumes/KDr2/Developer/scws --with-xapian=/Volumes/KDr2/Developer/xapian-scws
checking for a BSD-compatible install... /opt/local/bin/ginstall -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /opt/local/bin/gmkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for gawk... (cached) gawk
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for style of include used by make... GNU
checking dependency style of g++... gcc3
checking for gcc... gcc
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking for a sed that does not truncate output... /usr/bin/sed
checking whether ln -s works... yes
checking whether make sets $(MAKE)... (cached) yes
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking union semun for semaphore...... yes
checking for sun_len in sys/un.h... yes
checking for event.h of libevent... yes: /Volumes/KDr2/Developer/libevent1
checking for correct libevent version... ok
checking for event_init in -levent... yes
checking for scws.h of scws... yes: /Volumes/KDr2/Developer/scws
checking for scws_new in -lscws... yes
checking for xapian.h of xapian-core... yes: /Volumes/KDr2/Developer/xapian-scws
checking for correct xapian version... ok
checking for library of xapian-core... ok
checking for pthread_mutex_init in -lpthread... yes
checking how to run the C++ preprocessor... g++ -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking arpa/inet.h usability... yes
checking arpa/inet.h presence... yes
checking for arpa/inet.h... yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking netinet/in.h usability... yes
checking netinet/in.h presence... yes
checking for netinet/in.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for strings.h... (cached) yes
checking sys/param.h usability... yes
checking sys/param.h presence... yes
checking for sys/param.h... yes
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for unistd.h... (cached) yes
checking for stdbool.h that conforms to C99... yes
checking for _Bool... no
checking for inline... inline
checking for off_t... yes
checking for pid_t... yes
checking for size_t... yes
checking size of off_t... 8
checking for error_at_line... no
checking vfork.h usability... no
checking vfork.h presence... no
checking for vfork.h... no
checking for fork... yes
checking for vfork... yes
checking for working fork... yes
checking for working vfork... (cached) yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... yes
checking for stdlib.h... (cached) yes
checking for unistd.h... (cached) yes
checking for sys/param.h... (cached) yes
checking for getpagesize... yes
checking for working mmap... yes
checking for working strtod... yes
checking for setproctitle... no
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating sdk/Makefile
config.status: creating src/xs-ctl.sh
config.status: creating src/xs-optimize.sh
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
KDr2@KDr2-MacBookPro:~/Work/seas/xunsearch$

Then I make it, and an error occurs:

KDr2@KDr2-MacBookPro:~/Work/seas/xunsearch$ make
make  all-recursive
Making all in .
Making all in src
g++ -DHAVE_CONFIG_H -I. -I..     -g -O2 -I/Volumes/KDr2/Developer/libevent1/include -MT import.o -MD -MP -MF .deps/import.Tpo -c -o import.o import.cc
import.cc:20:20: error: xapian.h: No such file or directory
import.cc:21:28: error: xapian/unicode.h: No such file or directory
import.cc:61: error: ‘Xapian’ has not been declared
import.cc:61: error: expected initializer before ‘database’
import.cc:62: error: ‘Xapian’ has not been declared
import.cc:62: error: expected initializer before ‘indexer’
import.cc:63: error: ‘Xapian’ has not been declared
import.cc:63: error: expected initializer before ‘stemmer’
import.cc:64: error: ‘Xapian’ has not been declared
import.cc:64: error: expected initializer before ‘stopper’
import.cc:65: error: ‘std::string’ has not been declared
import.cc: In function ‘void show_usage()’:
import.cc:125: error: expected `)' before ‘XAPIAN_VERSION’
import.cc: In function ‘void batch_committed(int)’:
import.cc:140: error: ‘archive’ was not declared in this scope
import.cc:143: error: ‘database’ was not declared in this scope
import.cc:148: error: ‘database’ was not declared in this scope
import.cc:159: error: ISO C++ forbids declaration of ‘Xapian’ with no type
import.cc:159: error: expected `)' before ‘::’ token
import.cc:159: error: expected `{' before ‘::’ token
import.cc:159: error: ‘::Error’ has not been declared
import.cc:159: error: ‘e’ was not declared in this scope
import.cc:159: error: expected `;' before ‘)’ token
import.cc:163: error: expected primary-expression before ‘catch’
import.cc:163: error: expected `;' before ‘catch’
import.cc: In function ‘int signal_term(int)’:
import.cc:193: error: ‘database’ was not declared in this scope
import.cc: In function ‘void signal_reload(int)’:
import.cc:232: error: ‘database’ was not declared in this scope
import.cc:237: error: ‘database’ was not declared in this scope
import.cc: At global scope:
import.cc:258: error: expected ‘,’ or ‘...’ before ‘&’ token
import.cc:258: error: ISO C++ forbids declaration of ‘string’ with no type
import.cc: In function ‘bool should_stem(int)’:
import.cc:261: error: ‘Xapian’ has not been declared
import.cc:262: error: ‘Xapian’ has not been declared
import.cc:263: error: ‘Xapian’ has not been declared
import.cc:264: error: ‘Xapian’ has not been declared
import.cc:265: error: ‘Xapian’ has not been declared
import.cc:265: error: expected `;' before ‘u’
import.cc:266: error: ‘u’ was not declared in this scope
import.cc:266: error: ‘Xapian’ has not been declared
import.cc: In function ‘int doc_fetch()’:
import.cc:360: error: ‘Xapian’ has not been declared
import.cc:360: error: expected `;' before ‘doc’
import.cc:441: error: ‘Xapian’ has not been declared
import.cc:441: error: ‘syn_db’ was not declared in this scope
import.cc:442: error: ‘string’ was not declared in this scope
import.cc:442: error: expected `;' before ‘org_term’
import.cc:443: error: expected `;' before ‘syn_term’
import.cc:445: error: expected `;' before ‘org_stem’
import.cc:446: error: ‘org_term’ was not declared in this scope
import.cc:446: error: ‘string’ is not a class or namespace
import.cc:448: error: ‘org_stem’ was not declared in this scope
import.cc:448: error: ‘stemmer’ was not declared in this scope
import.cc:449: error: ‘syn_stem’ was not declared in this scope
import.cc:449: error: ‘syn_term’ was not declared in this scope
import.cc:453: error: ‘archive’ was not declared in this scope
import.cc:453: error: ‘database’ was not declared in this scope
import.cc:457: error: ‘org_term’ was not declared in this scope
import.cc:457: error: ‘syn_term’ was not declared in this scope
import.cc:461: error: ‘org_stem’ was not declared in this scope
import.cc:463: error: ‘syn_stem’ was not declared in this scope
import.cc:471: error: ‘syn_term’ was not declared in this scope
import.cc:474: error: ‘org_term’ was not declared in this scope
import.cc:478: error: ‘org_stem’ was not declared in this scope
import.cc:480: error: ‘syn_stem’ was not declared in this scope
import.cc:488: error: ‘org_term’ was not declared in this scope
import.cc:492: error: ‘org_stem’ was not declared in this scope
import.cc:515: error: ‘archive’ was not declared in this scope
import.cc:524: error: ‘database’ was not declared in this scope
import.cc:539: error: ‘indexer’ was not declared in this scope
import.cc:539: error: ‘doc’ was not declared in this scope
import.cc:584: error: ‘string’ was not declared in this scope
import.cc:584: error: expected `;' before ‘tt’
import.cc:585: error: expected `;' before ‘pp’
import.cc:589: error: ‘pp’ was not declared in this scope
import.cc:592: error: ‘pp’ was not declared in this scope
import.cc:592: error: ‘tt’ was not declared in this scope
import.cc:596: error: ‘pp’ was not declared in this scope
import.cc:596: error: ‘tt’ was not declared in this scope
import.cc:600: error: ‘tt’ was not declared in this scope
import.cc:602: error: expected `;' before ‘ss’
import.cc:603: error: ‘ss’ was not declared in this scope
import.cc:603: error: ‘pp’ was not declared in this scope
import.cc:603: error: ‘stemmer’ was not declared in this scope
import.cc:620: error: ‘string’ was not declared in this scope
import.cc:620: error: expected `;' before ‘enc’
import.cc:621: error: ‘enc’ was not declared in this scope
import.cc:661: error: ‘database’ was not declared in this scope
import.cc:666: error: ‘archive’ was not declared in this scope
import.cc:673: error: ‘database’ was not declared in this scope
import.cc:681: error: ISO C++ forbids declaration of ‘Xapian’ with no type
import.cc:681: error: expected `)' before ‘::’ token
import.cc:681: error: expected `{' before ‘::’ token
import.cc:681: error: ‘::Error’ has not been declared
import.cc:681: error: ‘e’ was not declared in this scope
import.cc:681: error: expected `;' before ‘)’ token
import.cc: In function ‘int main(int, char**)’:
import.cc:710: error: ‘stemmer’ was not declared in this scope
import.cc:710: error: ‘Xapian’ has not been declared
import.cc:750: error: ‘Xapian’ has not been declared
import.cc:779: error: ‘stopper’ was not declared in this scope
import.cc:894: error: ‘database’ was not declared in this scope
import.cc:894: error: ‘Xapian’ has not been declared
import.cc:894: error: ‘Xapian’ has not been declared
import.cc:898: error: ‘database’ was not declared in this scope
import.cc:898: error: ‘Xapian’ has not been declared
import.cc:901: error: ‘indexer’ was not declared in this scope
import.cc:902: error: ‘stopper’ was not declared in this scope
import.cc:903: error: ‘database’ was not declared in this scope
import.cc:907: error: ‘Xapian’ has not been declared
import.cc:910: error: ISO C++ forbids declaration of ‘Xapian’ with no type
import.cc:910: error: expected `)' before ‘::’ token
import.cc:910: error: expected `{' before ‘::’ token
import.cc:910: error: ‘::Error’ has not been declared
import.cc:910: error: ‘e’ was not declared in this scope
import.cc:910: error: expected `;' before ‘)’ token
import.cc:916: error: expected primary-expression before ‘catch’
import.cc:916: error: expected `;' before ‘catch’
import.cc:931: error: ‘archive’ was not declared in this scope
import.cc:931: error: ‘Xapian’ has not been declared
import.cc:931: error: ‘Xapian’ has not been declared
import.cc:940: error: ‘archive’ was not declared in this scope
import.cc:940: error: ‘Xapian’ has not been declared
import.cc:940: error: ‘Xapian’ has not been declared
import.cc:951: error: ‘database’ was not declared in this scope
import.cc:953: error: ‘database’ was not declared in this scope
import.cc:984: error: ‘database’ was not declared in this scope
import.cc:1001: error: ‘archive’ was not declared in this scope
import.cc:1021: error: ‘Xapian’ has not been declared
import.cc:1021: error: ‘Xapian’ has not been declared
make[2]: *** [import.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
KDr2@KDr2-MacBookPro:~/Work/seas/xunsearch$ 

I think there's some thing wrong with the XAPIAN_DIR substitute is configure.ac when configure with option --with-xapian=..., would you please check and fix this? Many Thanks!

PS:

  1. My os: MacOSX 10.7, but I think this bug can be produced on linux.
  2. xunsearch-full-version.tar.bz2 works(be installed) well on my computer.
KDr2 commented 12 years ago

I found the bug and fixed it, and added a configure option --enable-php=yes|no to decide whether install the php sdk:

https://github.com/KDr2/xunsearch/commit/d25909539dca4a40bb6eed5b3b17c130ff237a0e

Does this project receive pull-request, if so, I'll make one.

hightman commented 12 years ago

Thank you for your patch, I noticed that there is extra whitespace. But I am not familiar with many operating on github, such as pull-reuqest ...

Therefore, I add your correction code to my local repository first