Cross compile Lua library luv



  • I'm trying to cross compile luv with the help of the cross compile tutorial. I set the environment up on a virtual machine and git cloned the luv repo to ~/openwrt/custom/luv directory on this VM.

    Then I added a openwrt.cmake file with this content (as building this repo depends on cmake)

    # this one is important
    SET(CMAKE_SYSTEM_NAME AR7xxx)
    #this one not so much
    SET(CMAKE_SYSTEM_VERSION 1)
    
    # specify the cross compiler
    SET(CMAKE_C_COMPILER   /home/vagrant/openwrt/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mips-openwrt-linux-gcc)
    SET(CMAKE_CXX_COMPILER /home/vagrant/openwrt/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mips-openwrt-linux-g++)
    
    # where is the target environment
    SET(CMAKE_FIND_ROOT_PATH  /home/vagrant/openwrt/target/linux/ar71xx)
    
    # search for programs in the build host directories
    SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
    # for libraries and headers in the target directories
    SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
    SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
    

    and in order to source the previous settings to cmake I added this line to the luv repos Makefile

    -DCMAKE_TOOLCHAIN_FILE=~/openwrt/openwrt.cmake \
    

    I run make as follows (I intend to install lua and libuv separately (these can be simply installed with opkg) so the make flags are intended to link to the deps)

    $ WITH_LUA_ENGINE=Lua LUA_BUILD_TYPE=System WITH_SHARED_LIBUV=ON BUILD_MODULE=OFF BUILD_SHARED_LIBS=ON STAGING_DIR=./staging_dir make
    

    this however results in :

    cmake --build build --config Debug
    make[1]: Entering directory '/home/vagrant/openwrt/custom/luv/build'
    make[2]: Entering directory '/home/vagrant/openwrt/custom/luv/build'
    make[3]: Entering directory '/home/vagrant/openwrt/custom/luv/build'
    make[3]: Leaving directory '/home/vagrant/openwrt/custom/luv/build'
    [ 92%] Built target uv
    make[3]: Entering directory '/home/vagrant/openwrt/custom/luv/build'
    make[3]: Leaving directory '/home/vagrant/openwrt/custom/luv/build'
    make[3]: Entering directory '/home/vagrant/openwrt/custom/luv/build'
    [ 96%] Building C object CMakeFiles/luv.dir/src/luv.c.obj
    In file included from /home/vagrant/openwrt/custom/luv/src/luv.c:18:0:
    /home/vagrant/openwrt/custom/luv/src/luv.h:19:17: fatal error: lua.h: No such file or directory
     #include <lua.h>
                     ^
    compilation terminated.
    CMakeFiles/luv.dir/build.make:62: recipe for target 'CMakeFiles/luv.dir/src/luv.c.obj' failed
    make[3]: *** [CMakeFiles/luv.dir/src/luv.c.obj] Error 1
    make[3]: Leaving directory '/home/vagrant/openwrt/custom/luv/build'
    CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/luv.dir/all' failed
    make[2]: *** [CMakeFiles/luv.dir/all] Error 2
    make[2]: Leaving directory '/home/vagrant/openwrt/custom/luv/build'
    Makefile:127: recipe for target 'all' failed
    make[1]: *** [all] Error 2
    make[1]: Leaving directory '/home/vagrant/openwrt/custom/luv/build'
    Makefile:40: recipe for target 'luv' failed
    make: *** [luv] Error 2
    

    How can I make sure lua is available in the cross compile environment? I am quite new to openwrt, lua and cross compiling in general so I might be missing something obvious.


Log in to reply
 

Looks like your connection to Onion Community was lost, please wait while we try to reconnect.