Compiling C++ applications for mipsel platform

In the past, I usually posted about my success of doing something but not this post. I have been encountering big problem that is not solved yet. It is more than 7 days from the beginning. Generally, I will leave tabs relating to my current interesting in Firefox until all problems are solved. Then I will post what I did here or somewhere else. In my opinion, 7 days are too long for such a problem. I should suspend this topic for next chance. So I will post everything involved to this topic here as the checkpoint.

The problem is about running a C++ applications on mipsel platform. In particular, the applications are all examples of libtorrent and the mipsel platform is Asus WL-500g Premium. libtorrent is written in C++. That is not exactly the cause of this problem. The real problem is it relies on Boost library and this library uses many C++ features that are not available in uClibc++.

Let me discuss about the problem in detail now, here. Running BTQueue on Asus WL-500g Premium which has 32 MB ram is not a good idea because it consumes approximately 24 MB at startup and even more according to number of concurrent downloading files. Honestly, it takes me 300 MB ram in production use. OMG!

That is just overture. I hope to reduce memory footprint of BTQueue by changing its core engine to libtorrent and also changing Python to Lua. Lua is not as good as Python but it is much more smaller in term of memory consumption. Moreover, Lua seems to be the best glue language. This is a long journey.

Boost requires ICU for unicode support in regular expression module. Compiling ICU is so easy because it is written in C. uClibc has everything need to build ICU. For C++, standard C++ libraries bundled with g++ in OpenWrt SDK does not work properly on mipsel. I don't know why but I always get Segmentation fault. So I have to try uClibc++. Compiling uClibc++ goes smoothly. To use uClibc++ to compile Boost, I have to apply several techniques.

  1. Boost uses bjam as the build utility (make replacement) so I have to specify additional flags by this tip.

    bjam -sBUILD="release xxx xxx"
    
  2. To use uClibc++, I have to specify below flags.

    -fno-builtin -nostdinc++
    -nodefaultlibs -luClibc++ -lc -gcc
    
  3. I have to disable regex and program_options in Boost to remove everything regarding locales and anything that are not available in uClibc++.

As a result, I successfully compiled Boost and libtorrent. Unfortunately, I still got segfault. I'm sorry but I have to stop here. My plan is to reimplement libtorrent in pure C.

Tags: , , , , , , , ,

NoABKUeoHa

Xw6eXy gghjyuy

compiling boost mipsel-linux-uclibc-g++

thanks for the hints, I am currently facing the same issue. Could you give me a hint on step 3: how did you disable regex and program_options? Also, AFAICS, wchar is generally not supported in uclibc++, so how have you been able to disable that in boost? Any help appreciated, roman

Post new comment