Cross Compiling OpenWrt Package
- 
					
					
					
					
 For anyone interested, I succeeded compiling a simple helloworld program to my Omega2. The Omega2 is basically the same hardware as the Linkit Smart so I followed the tutorial there : 
 https://docs.labs.mediatek.com/resource/linkit-smart-7688/en/tutorials/c-c++-programming/using-openwrt-sdk-to-build-c-c++-programsAt first, it did not work. I realized the Linkit Smart use kernel 3.18.23 and the Omega use kernel 4.4.39 
 I also saw at boot a link refering to : https://lede-project.org/By searching the website, I found the SDK that the Omega team used for the Omega2 
 https://downloads.lede-project.org/snapshots/targets/ramips/mt7688/You can then follow the Mediatek tutorial and use this SDK instead : 
 https://downloads.lede-project.org/snapshots/targets/ramips/mt7688/lede-sdk-ramips-mt7688_gcc-5.4.0_musl-1.1.15.Linux-x86_64.tar.xzThe package was compiled on my Linux computer (latest version of Linux Mint) 
 You also need to install ncurses to make the package
 sudo apt-get install libncurses5-dev libncursesw5-devIf you want to try to install the helloworld package just put the file below in your omega 
 helloworld_1.0.0-1_mipsel_24kc.ipk
 you can install it with
 opkg install helloworld_1.0.0-1_mipsel_24kc.ipkLet me know if you try it! 
 
- 
					
					
					
					
 This morning, I tried compiling something a little bit more useful than helloworld. When I connect to a Linux device by SSH, I often use the treecommand to get a quick look at the files inside a directory structure.See http://mama.indstate.edu/users/ice/tree/ It was really easy to make and compile the package. All I had to do is to place the source code in the package directory under a folder named tree. I copied the openwrt makefile of the helloworld package and replaced all occurence of helloworld by tree. I'm surprised it is just easy as that. Here is the package : tree_1.0.0-1_mipsel_24kc.ipk 
 
- 
					
					
					
					
 @Fred-Blais thanx for this article , realy help me  
 i found some mistake in the cross compiling tutorial
 i will post it later in details later in this post
 but finally i succeed with eclipse cross compiling
 
- 
					
					
					
					
 @ammar-tsh Can you guide me on the way to cross-compile C code with a shared library. 
 For example, the cross-compiler doesn't have MQTT library. I have installed MQTT on board and there is a .so file in Board. Now, how do I cross-compile with this library?
 Thank you so much!
 
- 
					
					
					
					
 @luckycometdaft cross compiling with a shared library is not really a concept, what you want to do is link your app with a dependency on a shared library. You didn't mention what method you are using for cross compilation so I assume you are using a make file so look at your ld sytax and ensure you are including the .so If you prefer to use an IDE, I wrote some notes on how to setup NetBeans to cross compile and you can easily add the so to the linker. 
 
- 
					
					
					
					
 @luckycometdaft said in Cross Compiling OpenWrt Package: ... I have installed MQTT on board and there is a .so file in Board. Now, how do I cross-compile with this library? Look through my first post in the manual [Manual] How to make native C/C++ application step by step. There is part of it: ... Second problem in third-party libraries - Omega; opkg manager doesn't install -dev files of libraries and it's will be a problem in your application. You have to know OpenWRT it's a minimal disk-size system. It have no .h-files to build anything in. I think you compiled your application into the Omega board (direct compilation). In this case you had install GCC build system with common h-files, but you need append your third-party h-file for special .so library. You have to find this and append manually. You can find your h-file from so-library repository. 
 But I recommend you compile via SDK. You will need it in future if touch to build native applications.