2

I am giving it a go at compiling lsyncd on Mac OS X (Lion) and I got a little stuck at my configure script not being able to locate my lua libraries:-

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.

I do have lua installed via macports.

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

UPDATE

I know for sure that the lua.pc file is located in:

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

and so, gone to the extent of explicitly specifying the PKG_CONFIG and PKG_CONFIG_PATH environment variables in my .bashrc file and sourcing it. Like this:

export PKG_CONFIG="/opt/local/lib/pkgconfig:$PKG_CONFIG"
export PKG_CONFIG_PATH="/opt/local/lib/pkgconfig:$PKG_CONFIG_PATH"

What do I need to do to set the correct PKG_CONFIG_PATH environment variable so that my configure script can find lua?

UPDATE #2

So I added in

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

in my .bashrc file, and with that done, I can now run ./configure --without-inotify successfully, with the following output:-

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

Unfortunately, running make doesn't work as it seems that the lsyncd.h header file is unable to include 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

Any suggestions?

4

1 回答 1

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" 

依赖项是:

这个

doc/lsyncd.1: doc/lsyncd.1.xml
xsltproc -o $@ -nonet /etc/asciidoc/docbook-xsl/manpage.xsl $<

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

然后运行

make

并且 lsyncd 应该可以成功编译。

于 2012-03-15T03:57:49.120 回答