2012-03-14 207 views
2

我正在編譯Mac OS X(Lion)上的lsyncd,並且我的配置腳本無法找到我的lua庫: -編譯Mac OS X上的lsyncd(Lion)

calvin$ ./configure 
checking for a BSD-compatible install... /usr/bin/install -c 
checking whether build environment is sane... yes 
checking for a thread-safe mkdir -p... ./install-sh -c -d 
checking for gawk... gawk 
checking whether make sets $(MAKE)... yes 
checking for gcc... gcc 
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 gcc accepts -g... yes 
checking for gcc option to accept ISO C89... none needed 
checking for style of include used by make... GNU 
checking dependency style of gcc... gcc3 
checking whether make sets $(MAKE)... (cached) yes 
checking pkg-config is at least version 0.9.0... yes 
checking for LUA... no 
checking for LUA... no 
checking for LUA... no 
checking for LUA... no 
configure: error: Package requirements (lua >= 5.1.3) were not met: 
No package 'lua' found 
Consider adjusting the PKG_CONFIG_PATH environment variable if you 
installed software in a non-standard prefix. 
Alternatively, you may set the environment variables LUA_CFLAGS 
and LUA_LIBS to avoid the need to call pkg-config. 
See the pkg-config man page for more details. 

我確實通過macports安裝了lua。

calvin$ lua -v 
Lua 5.1.4 Copyright (C) 1994-2008 Lua.org, PUC-Rio 
calvin$ which lua 
/opt/local/bin/lua 

UPDATE

我知道肯定的lua.pc文件位於:

calvin$ sudo find /opt/local -name "lua.pc" 
/opt/local/lib/pkgconfig/lua.pc 

等,去在明確指定PKG_CONFIGPKG_CONFIG_PATH環境變量的程度我的.bashrc文件並找到它。就像這樣:

​​

什麼我需要做的設置正確PKG_CONFIG_PATH環境變量,以便我的配置腳本可以找到LUA?

更新#2

所以我在

export LUA_CFLAGS="/opt/local/include" 
export LUA_LIBS="/opt/local/lib" 

加在我的.bashrc文件,並與該做的,我現在可以運行./configure --without-inotify成功,有以下的輸出: -

calvin$ ./configure --without-inotify 
checking for a BSD-compatible install... /usr/bin/install -c 
checking whether build environment is sane... yes 
checking for a thread-safe mkdir -p... ./install-sh -c -d 
checking for gawk... gawk 
checking whether make sets $(MAKE)... yes 
checking for gcc... gcc 
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 gcc accepts -g... yes 
checking for gcc option to accept ISO C89... none needed 
checking for style of include used by make... GNU 
checking dependency style of gcc... gcc3 
checking whether make sets $(MAKE)... (cached) yes 
checking pkg-config is at least version 0.9.0... yes 
checking for LUA... 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 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 sys/inotify.h usability... no 
checking sys/inotify.h presence... no 
checking for sys/inotify.h... no 
compiling without inotify 
configure: creating ./config.status 
config.status: creating Makefile 
config.status: creating config.h 
config.status: config.h is unchanged 
config.status: executing depfiles commands 

不幸的是,運行make不起作用,因爲它似乎是lsyncd.h heade r文件無法包含lua.h

calvin$ make 
make all-am 
gcc -DHAVE_CONFIG_H -I.  -g -O2 -Wall /opt/local/include -MT lsyncd.o -MD -MP -MF .deps/lsyncd.Tpo -c -o lsyncd.o lsyncd.c 
In file included from lsyncd.c:16: 
lsyncd.h:27:17: error: lua.h: No such file or directory 
In file included from lsyncd.c:16: 
lsyncd.h:52: error: expected ‘)’ before ‘*’ token 
lsyncd.h:55: error: expected ‘)’ before ‘*’ token 
lsyncd.h:88: error: expected ‘)’ before ‘*’ token 
lsyncd.h:115: error: expected ‘)’ before ‘*’ token 
lsyncd.h:118: error: expected ‘;’ before ‘void’ 
lsyncd.h:130: error: expected ‘)’ before ‘*’ token 
lsyncd.h:131: error: expected ‘;’, ‘,’ or ‘)’ before ‘void’ 
lsyncd.c:44:20: error: lualib.h: No such file or directory 
lsyncd.c:45:21: error: lauxlib.h: No such file or directory 
lsyncd.c:64:3: error: #error "need at least one notifcation system. please rerun ./configure" 
lsyncd.c:175:3: warning: #warning having to use old style realpath() 
lsyncd.c:337: error: expected ‘)’ before ‘*’ token 
lsyncd.c:432: error: expected ‘)’ before ‘*’ token 
lsyncd.c: In function ‘pipe_tidy’: 
lsyncd.c:453: error: ‘struct observance’ has no member named ‘extra’ 
lsyncd.c: At top level: 
lsyncd.c:522: error: expected ‘)’ before ‘*’ token 
lsyncd.c:564: error: expected ‘)’ before ‘*’ token 
lsyncd.c:565: error: expected ‘;’, ‘,’ or ‘)’ before ‘void’ 
lsyncd.c: In function ‘nonobserve_fd’: 
lsyncd.c:650: error: ‘struct observance’ has no member named ‘tidy’ 
lsyncd.c: At top level: 
lsyncd.c:662: error: expected ‘)’ before ‘*’ token 
lsyncd.c:689: error: expected ‘)’ before ‘*’ token 
lsyncd.c:730: error: expected ‘)’ before ‘*’ token 
lsyncd.c:731: error: expected ‘)’ before ‘*’ token 
lsyncd.c:740: error: expected ‘)’ before ‘*’ token 
lsyncd.c:800: error: expected ‘)’ before ‘*’ token 
lsyncd.c:821: error: expected ‘)’ before ‘*’ token 
lsyncd.c:968: error: expected ‘)’ before ‘*’ token 
lsyncd.c:1011: error: expected ‘)’ before ‘*’ token 
lsyncd.c:1045: error: expected ‘)’ before ‘*’ token 
lsyncd.c:1097: error: expected ‘)’ before ‘*’ token 
lsyncd.c:1111: error: expected ‘)’ before ‘*’ token 
lsyncd.c:1186: error: expected ‘)’ before ‘*’ token 
lsyncd.c:1241: error: expected ‘)’ before ‘*’ token 
lsyncd.c:1268: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘lsyncdlib’ 
lsyncd.c:1286: error: expected ‘)’ before ‘*’ token 
lsyncd.c:1309: error: expected ‘)’ before ‘*’ token 
lsyncd.c:1334: error: expected ‘)’ before ‘*’ token 
lsyncd.c:1346: error: expected ‘)’ before ‘*’ token 
lsyncd.c:1358: error: expected ‘)’ before ‘*’ token 
lsyncd.c:1371: error: expected ‘)’ before ‘*’ token 
lsyncd.c:1423: error: expected ‘)’ before ‘*’ token 
lsyncd.c:1449: error: expected ‘)’ before ‘*’ token 
lsyncd.c:1497: error: expected ‘)’ before ‘*’ token 
lsyncd.c: In function ‘main1’: 
lsyncd.c:1669: error: ‘lua_State’ undeclared (first use in this function) 
lsyncd.c:1669: error: (Each undeclared identifier is reported only once 
lsyncd.c:1669: error: for each function it appears in.) 
lsyncd.c:1669: error: ‘L’ undeclared (first use in this function) 
lsyncd.c:1677: warning: implicit declaration of function ‘lua_open’ 
lsyncd.c:1678: warning: implicit declaration of function ‘luaL_openlibs’ 
lsyncd.c:1683: warning: implicit declaration of function ‘lua_getglobal’ 
lsyncd.c:1684: warning: implicit declaration of function ‘luaL_checkstring’ 
lsyncd.c:1684: warning: assignment makes pointer from integer without a cast 
lsyncd.c:1693: warning: implicit declaration of function ‘lua_pop’ 
lsyncd.c:1710: warning: implicit declaration of function ‘printlogf0’ 
lsyncd.c:1717: warning: implicit declaration of function ‘register_lsyncd’ 
lsyncd.c:1754: warning: implicit declaration of function ‘luaL_loadfile’ 
lsyncd.c:1755: warning: implicit declaration of function ‘lua_tostring’ 
lsyncd.c:1762: warning: implicit declaration of function ‘luaL_loadbuffer’ 
lsyncd.c:1776: warning: implicit declaration of function ‘lua_pcall’ 
lsyncd.c:1776: error: ‘LUA_MULTRET’ undeclared (first use in this function) 
lsyncd.c:1780: warning: implicit declaration of function ‘lua_pushlightuserdata’ 
lsyncd.c:1782: warning: implicit declaration of function ‘lua_insert’ 
lsyncd.c:1784: warning: implicit declaration of function ‘lua_settable’ 
lsyncd.c:1784: error: ‘LUA_REGISTRYINDEX’ undeclared (first use in this function) 
lsyncd.c:1789: warning: implicit declaration of function ‘lua_gettable’ 
lsyncd.c:1790: warning: implicit declaration of function ‘lua_pushstring’ 
lsyncd.c:1792: warning: implicit declaration of function ‘lua_remove’ 
lsyncd.c:1800: warning: assignment makes pointer from integer without a cast 
lsyncd.c:1831: warning: implicit declaration of function ‘load_runner_func’ 
lsyncd.c:1847: warning: implicit declaration of function ‘lua_newtable’ 
lsyncd.c:1849: warning: implicit declaration of function ‘lua_pushnumber’ 
lsyncd.c:1866: warning: assignment makes pointer from integer without a cast 
lsyncd.c:1930: warning: implicit declaration of function ‘lua_pushboolean’ 
lsyncd.c:1935: warning: implicit declaration of function ‘masterloop’ 
lsyncd.c:1943: error: ‘struct observance’ has no member named ‘tidy’ 
lsyncd.c:1965: warning: implicit declaration of function ‘lua_close’ 
make[1]: *** [lsyncd.o] Error 1 
make: *** [all] Error 2 

有什麼建議嗎?

回答

5

解決它

./configure --without-inotify --with-fsevents CFLAGS="-I /Users/calvin/xnu-1699.24.23/" LUA_CFLAGS="-I /opt/local/include" LUA_LIBS="/opt/local/lib/liblua.a" 

依賴關係是:對應版本的Mac OS X,http://www.opensource.apple.com/source/xnu/xnu-1699.24.23/對我的方案

  • asciidoc

    • XNU(這是我穿過的MacPorts安裝)
    • lsyncd中的一些小的語法錯誤,我已經向lsyncd開發者發送了一個pull請求https://github.com/axkibe/lsyncd
    • 和在生成文件(從configure生成生成文件之後)從

    doc/lsyncd.1: doc/lsyncd.1.xml 
    xsltproc -o [email protected] -nonet /etc/asciidoc/docbook-xsl/manpage.xsl $< 
    

    doc/lsyncd.1: doc/lsyncd.1.xml 
        xsltproc -o [email protected] -nonet /opt/local/etc/asciidoc/docbook-xsl/manpage.xsl $< 
    

    的微小變化,然後運行

    make 
    

    lsyncd應該成功編譯。

  • +0

    您是如何確定要下載哪個XNU的? – Mutant 2013-03-03 05:05:07

    +0

    您的解決方案(經過一些微調)爲我工作!我使用[http://www.opensource.apple.com/release/mac-os-x-1083/]獲得了正確的XNU,並且必須創建一個自定義的lua mac-port,因爲該版本已經在macports中碰到了現在需要compat支持。 – Gilimanjaro 2013-05-18 20:17:21