I have installed a package, it says that it has installed fine but then I can only find the library files (*.so.*) and no headers (.h) ?



  • I have tried to install OpenCV using opkg (opkg install opencv).

    No errors were reported during install but when I look on the system I can only find can only find library (.so.) files and no header (.h) files.

    I cannot compile any code.

    I don't understand the package manager - is the code from this ready to run (as a return that the package has installed would imply) or do packages need to be compiled ?

    I have found a couple of threads on here discussing OpenCV but no conclusion.



  • There seems to be some confusion here. The OpenWrt package manager opkg only deploys compiled binaries (i.e. the .so) files. If you looking to build and deploy your own binaries (again the .so files), you'll need to setup a Cross-Compile Build Environment. That's where you will need to deal with the .h files.



  • Hi Janus

    Thanks for your reply.

    Definitely some confusion - I'm by no means an expert !

    I have now read; https://docs.onion.io/omega2-docs/c-compiler-on-omega.html and https://docs.onion.io/omega2-docs/cross-compiling.html#cross-compiling.

    My understanding from these articles and your reply is that if I want to write a program in C++ that uses the OpenCV library then I should write AND cross-compile that program on a LEDE build system installed on a PC. I then copy the compiled program to my Onion. When I then run that program on my Onion it will then use the compiled library binaries already installed on my Onion by opkg.

    Does this make more sense ?

    Thanks for your help.

    Ed



  • I would also check that OpenCV doesn't have any dependencies that are not available on OpenWRT/LEDE build system.



  • @Edward-Cheadle That's correct. Also, I highly recommend using Docker. You'll spend several hours (expert) if not weeks (novice) learning how to build the LEDE environment. Do yourself a huge favor and learn Docker with DockerHub.



  • @crispyoz @Janus-Sanders Thanks for your replies.

    @crispyoz - I guess I will only find this out once I try ? I only need one module from OpenCV - not the complete library so will not need the dependencies. As far as I can see you can specify this at build:
    https://stackoverflow.com/questions/25594003/build-specific-modules-opencv

    @Janus-Sanders Do you know if this Docker Image;
    https://hub.docker.com/r/onion/omega2-source/
    will work for my Omega2 Pro;
    https://onion.io/announcing-the-new-omega2-pro/

    Best Wishes,

    Ed



  • @Edward-Cheadle asked:

    @Janus-Sanders Do you know if this Docker Image;
    https://hub.docker.com/r/onion/omega2-source/
    will work for my Omega2 Pro;
    https://onion.io/announcing-the-new-omega2-pro/

    Yes, it will, but that docker image is a bit long in the tooth now, so there are a few things you'll have to do, namely:

    • fix the ubuntu package install environment
    • install the time package
    • update the source
    • switch to the openwrt branch
    • create a symlink to the O2 .config if building firmware b222 and later

    Something along the lines of (after creating your container):

    # fix the ubuntu package install environment
    # install the time package
    apt-get update
    apt-get -f install
    apt-get install time
    
    # update the source
    git pull
    
    # switch to the openwrt branch
    git checkout openwrt-18.06
    
    # clean out any old LEDE related feeds
    ./scripts/feeds clean
    ./scripts/feeds update -a
    ./scripts/feeds install -a
    
    # create a symlink to the O2 .config (only relevant when building firmware b222 onwards)
    ln -s .config.O2 .config
    
    # build
    make
    

    I took this from my container's history, so I hope I haven't missed anything or made any errors.

    Also make sure you allocate enough space for the container. I suggest 30GB at a minimum, but more if you have it.

    If you'd like to build a particular firmware revision, it's useful to add a few git tags where necessary. If you are interested here are the last few of mine:

    git tag v0.3.2-b222 96400e1
    git tag v0.3.2-b221 221604e
    git tag v0.3.2-b220 0984915
    git tag v0.3.2-b219 7cdd57e
    git tag v0.3.2-b218 adfead5
    git tag v0.3.2-b217 d624ea1
    git tag v0.3.1-b216 c22c17c
    

    Then you can run a specific build with a:

    git checkout v0.3.1-b216
    make
    


  • @cas Thanks for this - I've followed your instructions - it looks like they contain detail missing from the Omega tutorial on cross-compilation so you have probably saved alot of head scratching.

    It looks like I have alot to learn and feeling a bit out of my depth.

    Presumably the firmware revision should match that on my board ?



  • @cas well said. I set my Docker image to 40Gb!



  • @Edward-Cheadle said:

    It looks like I have alot to learn and feeling a bit out of my depth.
    Presumably the firmware revision should match that on my board ?

    Take your time, but yes, it may seem a bit daunting at first. And there will be bouts of frustration. Ask questions, the community will help where we can, but we also don't know everything... šŸ˜‰ We all learn from each other's mistakes.

    If you are new to this, then it will be best to get to the point where you can do a successful build i.e. run make to completion without any errors, before you start to introduce your own specific changes to the source. That way you will know that any errors are of your own making and not errors with the build environment and you will know where to focus to investigate and solve them.

    Regarding the firmware revision, it doesn't have to match what you currently have, any recent one should work on the O2Pro, but it's probably best to stick at one level until you are confident with what you are doing. Comments on the fixes/changes in each can be found in the CHANGELOG.md



  • I would add that it is a very good idea to familiarise yourself with the serial console. If you're building your own firmware you are very likely to make some mistakes which will disable your Omega, maybe even brick it. If you are already familiar with the use of the serial console and the recovery methods, you'll find it a lot less stressful.

    https://docs.onion.io/omega2-docs/connecting-to-the-omega-terminal.html#connecting-to-the-omega-terminal-serial

    You learn a lot more from your mistakes than if everything works perfectly everytime, you just have to prepare yourself.



  • @Janus-Sanders @cas

    Hi I've been stuck all day trying to set the container size either by increasing the container size limit: https://bobcares.com/blog/docker-container-size/
    or using the --storage-opt size=40G option.

    I haven't had any success and am guessing that there must be a simple way to do this that I haven't found ?



  • @Janus-Sanders Looking at this post on Stack Overflow
    https://stackoverflow.com/questions/52848004/how-to-increase-docker-disk-image-size-in-ubuntu
    it appears that there is no way and no need to increase the container size. BTW I'm running Ubuntu 18.04 with extfs filesystem. Hope this makes sense ?



  • @crispyoz Thanks - I've got serial console working so I have some option if I brick it šŸ™‚



  • @Edward-Cheadle said:

    it appears that there is no way and no need to increase the container size. BTW I'm running Ubuntu 18.04 with extfs filesystem. Hope this makes sense ?

    Yes, that's correct, the container will grow in size dynamically as you build the sources.
    What you need to do is to ensure that you have sufficient space in your docker environment to accommodate (at least) a 30 or 40GB container. Apologies if that was unclear.



  • @cas Thanks - How do I do that; should I have added some option when I installed Docker ?



  • @Edward-Cheadle
    Make sure that the filesystem on which your docker environment is installed and where the container(s) are housed has plenty (>= 40GB in this context) of free space.

    eg. If docker's home is /var/lib/docker make sure that /var (or / if you don't have /var in its own filesystem) has lots of free space.



  • @cas Thanks Cas - I set up a new 120GB SSD specifically for this 'machine' so apart from the fresh install of Ubuntu there is nothing else on the disk - i can see docker in var/lib - so with the container resizing I should be fine.

    I got a successful compile of the image on my second attempt.

    However, when I try to compile the example code from:

    https://github.com/OnionIoT/c-cross-compile-example.git

    I get the following error

    make: /root/source/staging_dir/toolchain-mipsel_24kc_gcc-5.4.0_musl-1.1.16/bin/mipsel-openwrt-linux-gcc: Command not found

    I note that the git directory I cloned from hasn't been touched for 2 years so this example is likely out of date. When I look in /root/source/staging_dir/toolchain-mipsel_24kc_gcc-5.4.0_musl-1.1.16/ there is no bin directory. I found a bin directory with the mipsel-openwrt-linux-gcc in /root/source/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl but I have no idea what to edit to ensure that this file is used - it doesn't appear to be the makefile ?



  • @cas I figured this out for myself - sorry I should have just re read all instructions again in the first place.

    I changed the lines:

    "# define the toolchain and target names
    TOOLCHAIN_NAME="toolchain-mipsel_24kc_gcc-5.4.0_musl-1.1.16"
    TARGET_NAME="target-mipsel_24kc_musl-1.1.16"

    in xCompile.sh

    to :

    "# define the toolchain and target names
    TOOLCHAIN_NAME="toolchain-mipsel_24kc_gcc-7.3.0_musl"
    TARGET_NAME="target-mipsel_24kc_musl"

    and the example C gipoRead compiled fine and runs on my board.



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