OpenWrt Forum Archive

Topic: Help installing cgilua, luafilesystem

The content of this topic has been archived on 23 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi guys,

I'm trying to get CGILua installed, but it has a dependency of luafilesystem.

I've found an old patch which didn't seem to make it to the openwrt build, and modified it so it should work, but now I get this error when I try and make using the toolchain:

make[3]: Entering directory `/home/psteyn/CrisOS/SDKF/devel/package/luafilesystem'                                                                                                                                                           
cd /home/psteyn/CrisOS/SDKF/devel/build_dir/cris/luafilesystem-1.2/ && cris-linux-uclibc-gcc -shared -o src/lfs.so src/lfs.c -Wall -fPIC   -Os -pipe -funit-at-a-time -fhonour-copts -L/home/psteyn/CrisOS/SDKF/devel/staging_dir/toolchain-cris_gcc4.1.2/lib -L/home/psteyn/CrisOS/SDKF/devel/staging_dir/cris/usr/lib -L/home/psteyn/CrisOS/SDKF/devel/staging_dir/cris/lib -Wl,-rpath-link=/home/psteyn/CrisOS/SDKF/devel/staging_dir/cris/usr/lib -llua -lm -ldl && cris-linux-uclibc-strip src/lfs.so && cris-linux-uclibc-gcc -c -o src/lfs.o src/lfs.c -Wall   -Os -pipe -funit-at-a-time -fhonour-copts -L/home/psteyn/CrisOS/SDKF/devel/staging_dir/toolchain-cris_gcc4.1.2/lib -L/home/psteyn/CrisOS/SDKF/devel/staging_dir/cris/usr/lib -L/home/psteyn/CrisOS/SDKF/devel/staging_dir/cris/lib -Wl,-rpath-link=/home/psteyn/CrisOS/SDKF/devel/staging_dir/cris/usr/lib && cris-linux-uclibc-ar r src/liblua-filesystem.a src/lfs.o                                       
src/lfs.c:39:17: error: lua.h: No such file or directory                                                                                                                                                                                     
src/lfs.c:40:21: error: lauxlib.h: No such file or directory                                                                                                                                                                                 
src/lfs.c:41:20: error: lualib.h: No such file or directory                                                                                                                                                                                 
In file included from src/lfs.c:43:                                                                                                                                                                                                         
src/lfs.h:16: error: expected ')' before '*' token                                                                                                                                                                                           
src/lfs.c:74: error: expected ')' before '*' token                                                                                                                                                                                           
src/lfs.c:92: error: expected ')' before '*' token                                                                                                                                                                                           
src/lfs.c:108: error: expected ')' before '*' token                                                                                                                                                                                         
src/lfs.c:124: error: expected ')' before '*' token                                                                                                                                                                                         
src/lfs.c:175: error: expected ')' before '*' token                                                                                                                                                                                         
src/lfs.c:197: error: expected ')' before '*' token                                                                                                                                                                                         
src/lfs.c:212: error: expected ')' before '*' token                                                                                                                                                                                         
src/lfs.c:237: error: expected ')' before '*' token                                                                                                                                                                                         
src/lfs.c:255: error: expected ')' before '*' token                                                                                                                                                                                         
src/lfs.c:300: error: expected ')' before '*' token                                                                                                                                                                                         
src/lfs.c:320: error: expected ')' before '*' token                                                                                                                                                                                         
src/lfs.c:347: error: expected ')' before '*' token                                                                                                                                                                                         
src/lfs.c:411: error: expected ')' before '*' token                                                                                                                                                                                         
src/lfs.c:433: error: expected ')' before '*' token                                                                                                                                                                                         
src/lfs.c:437: error: expected ')' before '*' token                                                                                                                                                                                         
src/lfs.c:441: error: expected ')' before '*' token                                                                                                                                                                                         
src/lfs.c:445: error: expected ')' before '*' token                                                                                                                                                                                         
src/lfs.c:449: error: expected ')' before '*' token                                                                                                                                                                                         
src/lfs.c:453: error: expected ')' before '*' token                                                                                                                                                                                         
src/lfs.c:457: error: expected ')' before '*' token                                                                                                                                                                                         
src/lfs.c:461: error: expected ')' before '*' token                                                                                                                                                                                         
src/lfs.c:465: error: expected ')' before '*' token                                                                                                                                                                                         
src/lfs.c:469: error: expected ')' before '*' token                                                                                                                                                                                         
src/lfs.c:473: error: expected ')' before '*' token                                                                                                                                                                                         
src/lfs.c:478: error: expected ')' before '*' token                                                                                                                                                                                         
src/lfs.c:482: error: expected ')' before '*' token                                                                                                                                                                                         
src/lfs.c:487: error: expected ')' before '*' token                                                                                                                                                                                         
src/lfs.c:491: error: expected specifier-qualifier-list before '_push_function'                                                                                                                                                             
src/lfs.c:495: error: 'push_st_mode' undeclared here (not in a function)                                                                                                                                                                     
src/lfs.c:495: warning: excess elements in struct initializer                                                                                                                                                                               
src/lfs.c:495: warning: (near initialization for 'members[0]')                                                                                                                                                                               
src/lfs.c:496: error: 'push_st_dev' undeclared here (not in a function)                                                                                                                                                                     
src/lfs.c:496: warning: excess elements in struct initializer                                                                                                                                                                               
src/lfs.c:496: warning: (near initialization for 'members[1]')                                                                                                                                                                               
src/lfs.c:497: error: 'push_st_ino' undeclared here (not in a function)                                                                                                                                                                     
src/lfs.c:497: warning: excess elements in struct initializer                                                                                                                                                                               
src/lfs.c:497: warning: (near initialization for 'members[2]')                                                                                                                                                                               
src/lfs.c:498: error: 'push_st_nlink' undeclared here (not in a function)                                                                                                                                                                   
src/lfs.c:498: warning: excess elements in struct initializer                                                                                                                                                                               
src/lfs.c:498: warning: (near initialization for 'members[3]')                                                                                                                                                                               
src/lfs.c:499: error: 'push_st_uid' undeclared here (not in a function)                                                                                                                                                                     
src/lfs.c:499: warning: excess elements in struct initializer                                                                                                                                                                               
src/lfs.c:499: warning: (near initialization for 'members[4]')                                                                                                                                                                               
src/lfs.c:500: error: 'push_st_gid' undeclared here (not in a function)                                                                                                                                                                     
src/lfs.c:500: warning: excess elements in struct initializer                                                                                                                                                                               
src/lfs.c:500: warning: (near initialization for 'members[5]')                                                                                                                                                                               
src/lfs.c:501: error: 'push_st_rdev' undeclared here (not in a function)                                                                                                                                                                     
src/lfs.c:501: warning: excess elements in struct initializer                                                                                                                                                                               
src/lfs.c:501: warning: (near initialization for 'members[6]')                                                                                                                                                                               
src/lfs.c:502: error: 'push_st_atime' undeclared here (not in a function)                                                                                                                                                                   
src/lfs.c:502: warning: excess elements in struct initializer                                                                                                                                                                               
src/lfs.c:502: warning: (near initialization for 'members[7]')                                                                                                                                                                               
src/lfs.c:503: error: 'push_st_mtime' undeclared here (not in a function)                                                                                                                                                                   
src/lfs.c:503: warning: excess elements in struct initializer                                                                                                                                                                               
src/lfs.c:503: warning: (near initialization for 'members[8]')                                                                                                                                                                               
src/lfs.c:504: error: 'push_st_ctime' undeclared here (not in a function)                                                                                                                                                                   
src/lfs.c:504: warning: excess elements in struct initializer                                                                                                                                                                               
src/lfs.c:504: warning: (near initialization for 'members[9]')                                                                                                                                                                               
src/lfs.c:505: error: 'push_st_size' undeclared here (not in a function)                                                                                                                                                                     
src/lfs.c:505: warning: excess elements in struct initializer                                                                                                                                                                               
src/lfs.c:505: warning: (near initialization for 'members[10]')                                                                                                                                                                             
src/lfs.c:507: error: 'push_st_blocks' undeclared here (not in a function)                                                                                                                                                                   
src/lfs.c:507: warning: excess elements in struct initializer                                                                                                                                                                               
src/lfs.c:507: warning: (near initialization for 'members[11]')                                                                                                                                                                             
src/lfs.c:508: error: 'push_st_blksize' undeclared here (not in a function)                                                                                                                                                                 
src/lfs.c:508: warning: excess elements in struct initializer                                                                                                                                                                               
src/lfs.c:508: warning: (near initialization for 'members[12]')                                                                                                                                                                             
src/lfs.c:510: warning: excess elements in struct initializer                                                                                                                                                                               
src/lfs.c:510: warning: (near initialization for 'members[13]')                                                                                                                                                                             
src/lfs.c:516: error: expected ')' before '*' token                                                                                                                                                                                         
src/lfs.c:556: error: expected ')' before '*' token                                                                                                                                                                                         
src/lfs.c:569: error: array type has incomplete element type                                                                                                                                                                                 
src/lfs.c:570: error: 'file_info' undeclared here (not in a function)                                                                                                                                                                       
src/lfs.c:571: error: 'change_dir' undeclared here (not in a function)                                                                                                                                                                       
src/lfs.c:572: error: 'get_dir' undeclared here (not in a function)                                                                                                                                                                         
src/lfs.c:573: error: 'dir_iter_factory' undeclared here (not in a function)                                                                                                                                                                 
src/lfs.c:574: error: 'file_lock' undeclared here (not in a function)                                                                                                                                                                       
src/lfs.c:575: error: 'make_dir' undeclared here (not in a function)                                                                                                                                                                         
src/lfs.c:576: error: 'remove_dir' undeclared here (not in a function)                                                                                                                                                                       
src/lfs.c:577: error: 'file_utime' undeclared here (not in a function)                                                                                                                                                                       
src/lfs.c:578: error: 'file_unlock' undeclared here (not in a function)                                                                                                                                                                     
src/lfs.c:582: error: expected ')' before '*' token                                                                                                                                                                                         
make[3]: *** [/home/psteyn/CrisOS/SDKF/devel/build_dir/cris/luafilesystem-1.2/.built] Error 1                                                                                                                                               
make[3]: Leaving directory `/home/psteyn/CrisOS/SDKF/devel/package/luafilesystem'                                                                                                                                                           
make[2]: *** [package/luafilesystem/compile] Error 2                                                                                                                                                                                         
make[2]: Leaving directory `/home/psteyn/CrisOS/SDKF/devel'                                                                                                                                                                                 
make[1]: *** [/home/psteyn/CrisOS/SDKF/devel/staging_dir/cris/stamp/.package_compile] Error 2                                                                                                                                               
make[1]: Leaving directory `/home/psteyn/CrisOS/SDKF/devel'                                                                                                                                                                                 
make: *** [world] Error 2

So, it seems that luafilesystem can't find the headers for lua, but they do exist in the toolchain.

I suspect the problem is with the Makefile I'm using, which I'll paste here:

# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
# $Id: Makefile 6994 2007-04-18 00:46:40Z nico $

include $(TOPDIR)/rules.mk

PKG_NAME:=luafilesystem
PKG_VERSION:=1.2
PKG_RELEASE:=1

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://luaforge.net/frs/download.php/1487/
PKG_MD5SUM:=f4dba157febb2e46d0ef3beba52f6fc6
PKG_CAT:=zcat

PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install

include $(INCLUDE_DIR)/package.mk

define Package/liblua-filesystem
  SECTION:=lang
  CATEGORY:=Languages
  TITLE:=luafilsystem library for the LUA programming language
  URL:=http://www.luaforge.net/projects/luafilesystem
  DEPEND:=+liblua
endef

define Package/liblua-filesystem/description
This package contains the luafilesystem library, a set of portable
functions for directory creation, listing and deletion and for file
locking.
endef


define Build/Configure
endef

define Build/Compile
        cd $(PKG_BUILD_DIR)/ && \
        $(TARGET_CROSS)gcc -shared -o src/lfs.so src/lfs.c -Wall -fPIC \
                $(EXTRA_CFLAGS) $(EXTRA_LDFLAGS) \
                $(TARGET_CFLAGS) $(TARGET_LDFLAGS)\
                -llua -lm -ldl &&\
        $(TARGET_CROSS)strip src/lfs.so &&\
        $(TARGET_CROSS)gcc -c -o src/lfs.o src/lfs.c -Wall \
                $(EXTRA_CFLAGS) $(EXTRA_LDFLAGS) \
                $(TARGET_CFLAGS) $(TARGET_LDFLAGS) &&\
        $(TARGET_CROSS)ar r src/liblua-filesystem.a src/lfs.o
endef

define Build/InstallDev
        mkdir -p $(STAGING_DIR)/usr/include
        mkdir -p $(STAGING_DIR)/usr/lib/lua/5.1/
        $(CP) $(PKG_BUILD_DIR)/src/lfs.h $(STAGING_DIR)/usr/include
        $(CP) $(PKG_BUILD_DIR)/src/lfs.so \
                $(STAGING_DIR)/usr/lib/liblua-filesystem.so.0.0.0
        cd $(STAGING_DIR)/usr/lib/ && \
                ln -fs liblua-filesystem.so.0.0.0 liblua-filesystem.so
        cd $(STAGING_DIR)/usr/lib/ && \
                ln -fs liblua-filesystem.so.0.0.0 liblua-filesystem.so.0
        cd $(STAGING_DIR)/usr/lib/lua/5.1/ && \
                ln -fs ../../liblua-filesystem.so.0.0.0 lfs.so
        $(CP) $(PKG_BUILD_DIR)/src/liblua-filesystem.a $(STAGING_DIR)/usr/lib
endef

define Build/UninstallDev
        $(RM) -f $(STAGING_DIR)/usr/include/lfs.h
        $(RM) -f $(STAGING_DIR)/usr/lib/liblua-filesystem.so.0.0.0
        $(RM) -f $(STAGING_DIR)/usr/lib/liblua-filesystem.so.0
        $(RM) -f $(STAGING_DIR)/usr/lib/liblua-filesystem.a
        $(RM) -f $(STAGING_DIR)/usr/lib/lua/5.1/lfs.so
endef

define Package/liblua-filesystem/install
        $(INSTALL_DIR) $(1)/usr/lib/lua/5.1
        $(CP) $(PKG_BUILD_DIR)/src/lfs.so \
                $(1)/usr/lib/liblua-filesystem.so.0.0.0
        cd $(1)/usr/lib/ && ln -fs liblua-filesystem.so.0.0.0 liblua-filesystem.so
        cd $(1)/usr/lib/lua/5.1/ && \
                ln -fs ../../liblua-filesystem.so.0.0.0 lfs.so
endef

$(eval $(call BuildPackage,liblua-filesystem))

Could someone please help me?  Thanks.

in my case it was gcc-4.0.0

i delete it. and use

gcc-3.3.3

and error disappeared

The discussion might have continued from here.