Cross compile external libraries (using libuv)



  • I am looking into using a small footprint solution to use libuv on the Omega with either Python or Lua as the 'interface' to it.

    OpenWRT on the Omega seems to support libuv out of the box.

    root@Omega-1E13:~# opkg list | grep libuv
    libuv - 1.4.2-1
    

    But I am struggling with cross compiling libraries such as pyuv or luv

    I setup the cross compile environment on a linux VM and tried to compile a package (not the whole image) according to the tutorial to no avail. Does anyone have experience cross compiling e.g pyuv or any other external package? Maybe the tutorial could be updated with an example of how to create external packages?



  • @Joost-Oostdijk I've been having a look around for you, but have been unable to find feeds for either luv or pyuv under the feeds I know about for building OpenWRT packages.

    However, I do note from your post https://community.onion.io/topic/764/cross-compile-lua-library-luv that you have attempted to build luv yourself (though you don't give the URL of the GIT repository for the sources). From the output you gave in that post, it looks like you are using a toolchain that does not contain the lua code. This is not overly surprising.

    Since I do have a full OpenWRT setup for building packages (and the toolchain), I could build a version of the toolchain for you that does include lua

    Let me know if this would be of any use to you



  • @Joost-Oostdijk Quick update to my previous post - what you actually need is the OpenWRT SDK including the lua source files. I have this available already and could send it to you. You will need to make a very minor change to the cmake file.

    Let me know the best way to get the SDK to you if you want it. It is about 90MByte



  • @Kit-Bishop Thanks for your help. I guess it might help me out to have a toolchain version that includes Lua.
    What probably would help me even more is to also figure out what I do not understand about the toolchain.

    I assumed that if the lua package is under the packages dir of the toolchain that I could somehow link to it, but yeah assumptions, ;)

    The luv repository is the one from where I got the source. I was trying to build against lua not luajit.

    Thank you for your time!



  • @Joost-Oostdijk You are welcome. :-) As I said, I believe you should be able to build luv using the SDK rather than the toolchain - the toolchain just contains the basic tools for compiling/building etc., the SDK contains additional source for additional modules.

    If you want the SDK I can supply it if you could let me known how to get it too you (because of the size I am reluctant to just attach it here). I can also let you know the minor changes you would need to make to your cmake make file to use the SDK



  • @Kit-Bishop dropped you an email.



  • @Joost-Oostdijk Saw it. Will be replying shortly :-)



  • @Kit-Bishop After installing/configuring the SDK I now have the following problem:
    (put it here for future reference)

    vagrant@ubuntu-xenial64-server:~/openwrt/custom/luv$ WITH_LUA_ENGINE=Lua LUA_BUILD_TYPE=System WITH_SHARED_LIBUV=ON BUILD_MODULE=OFF BUILD_SHARED_LIBS=ON STAGING_DIR=/home/vagrant/openwrt/sdk/OpenWrt-SDK-ar71xx-generic_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64/staging_dir make
    cmake -H. -Bbuild -DBUILD_MODULE=OFF -DBUILD_SHARED_LIBS=ON -DWITH_SHARED_LIBUV=ON -DWITH_LUA_ENGINE=Lua -DLUA_BUILD_TYPE=System -DCMAKE_TOOLCHAIN_FILE=~/openwrt/openwrt.cmake  -DWITH_AMALG=OFF
    System is unknown to cmake, create:
    Platform/AR71xx to use this system, please send your config file to cmake@www.cmake.org so it can be added to cmake
    Your CMakeCache.txt file was copied to CopyOfCMakeCache.txt. Please send that file to cmake@www.cmake.org.
    -- Could NOT find LIBUV (missing:  LIBUV_LIBRARIES LIBUV_INCLUDE_DIR)
    -- Could NOT find Lua (missing:  LUA_LIBRARIES LUA_INCLUDE_DIR)
    CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
    Please set them or make sure they are set and tested correctly in the CMake files:
    LIBUV_LIBRARIES
        linked by target "luv" in directory /home/vagrant/openwrt/custom/luv
    
    -- Configuring incomplete, errors occurred!
    See also "/home/vagrant/openwrt/custom/luv/build/CMakeFiles/CMakeOutput.log".
    See also "/home/vagrant/openwrt/custom/luv/build/CMakeFiles/CMakeError.log".
    Makefile:37: recipe for target 'build/Makefile' failed
    make: *** [build/Makefile] Error 1
    

    I am sure it is just setting those missing variables, but I have no clue where to find them from.
    I changed the cmake file into:

    # 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/sdk/OpenWrt-SDK-ar71xx-generic_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64/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/sdk/OpenWrt-SDK-ar71xx-generic_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64/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/sdk/OpenWrt-SDK-ar71xx-generic_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64/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)
    

Log in to reply
 

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