• Le Pan II tablet upgrade to ICS (Ice Cream Sandwich) the brute force method

    If you’re like my son, happily using his Le Pan II tablet because it sports awesome hardware and offers great performance. Unfortunately while trying many new programs from the google app store he was finding that many were NOT working. This lead to debate in the family as to whether or not the Motorola Xoom tablet was better than the Le Pan II simply because it did not create so many compatibility problems. Let me assure you the Le Pan II ia a great tablet and upgrading to ICS solved most of my sons compatibility issues while offering greatly improved performance (he was a happy camper).

    The process of upgrading to ICS however was NOT EASY and following the useless instructions from Le Pan was equally useless. For example when press Volume + and Power buttons we NEVER could get into fastboot mode, and selecting the ICS zip file from the tablets About / System update screen only gave signature invalid errors on reboot (hold the lock button to reboot back to normal mode if that happens).

    1. So first download the ICS firmware from:

    2. Unzip it in either Windows XP or higher (Yes thats right Le Pan only supports Windows for this update process, how evilly convenient) in your root of C:\

    3. In Control Panel (in Windows) select the Add new hardware option, select All or whatever option it takes so you can tell Windows to install from a disk, then navigate to the AnyData folder that is in the extracted folder in C:\ and Windows will install the Any Data driver (THIS IS REQUIRED AS IT ALLOWS DIRECT COMMUNICATION WITH THE TABLET VIA USB)

    4. Reboot your windows computer

    5. Ensure your tablet has Development USB mode enabled (not sure why but we had to do this or the Anydata driver did not find the tablet properly) and reboot the tablet

    6. Once the tablet has rebooted and is at the main screen, open a command prompt in your Windows Machine (make sure the tablet is connected via the usb cable) and enter the Extracted folder from step 2 but this time NOT the any data fodler but the other folder which contains a .cmd file (Release_LePanII_v406_Secured_Fused_06272012_user_fastboot). From this folder run:

    adb devices

    and you should see a device show up under the listing title. If not reinstall the USB driver and ensure the tablet has USB debugging enabled. NExt execute the following command from the windows command prompt:

    adb reboot bootloader

    You should see the tablet reboot in fastboot mode (the words fastboot mode display on the tablet in the top left corner within 30 seconds)

    from the same command prompt run:

    flash_all_with_new_partition.cmd

    When this command finishes your tablet will reboot and finish the ICS install (and will ask for system setting info on reboot)

    Done!


  • How to use libvlc in an open source application?

    For a while I was looking for a good open source cross platform library to use for video playback in my open source software. After a long while I finally found libvlc, which does the job well.

    If you want to see libvlc in action, with a wrapper class to play videos (local and streaming from youtube), compiled cross platform and integrated with OpenGL, check out the source code from here:

    http://megaglest.svn.sourceforge.net/viewvc/megaglest/trunk/source/shared_lib/sources/graphics/video_player.cpp?view=log


  • Division, and I’m not talking about math.

    It matters not whether politics or religion, business or family, left or right wing, this statement will always remain true:

    Matthew 12:25 And Jesus knew their thoughts, and said unto them, Every kingdom divided against itself is brought to desolation; and every city or house divided against itself shall not stand:

    And Christ is asking every honest Christian today:

    1 Corinthian 1:13 Is Christ divided? was Paul crucified for you? or were ye baptized in the name of Paul?


  • Helping your neighbour

    What draws a person to want to help another? When asked, and ‘who is my neighbour’, Jesus gave us a parable speaking of a Samaritan who helped a Jew who was beaten by robbers and left to die. This Samaritan was a neighbour simply because the Samaritan helped the man in need. Jesus then said go and do likewise.

    Years ago I saw the documentary “Revolution OS” which highlighted Richard Stallmans quest for a Free Software Society. One of the key tenants in this is to ‘help your neighbour’. The concept is not to leave a user ‘high and dry’ and technologically dead in the water, this very much bothered Richard from what he saw in his earlier years. Richard is not a Christian by any means, but his desire to ‘help his neighbour’ is an important part of GNU and Free Software, it is in fact the ‘Free’ in ‘Free Software’.

    Desiring to help ones neighbour should never be limited to minimal things, as the parable of Christ teaches, the Samaritan did everything in his power to help his neighbour in need. Who is your neighbour? The one that you choose to help! This can be done by spending time to help others in your community through volunteer work (volunteer fire fighters, shelters, etc) or missions or simply showing up at a farm and giving that poor guy a hand during hay season! There is something precious and important here that seems virtually abandoned in our current generation, but it need not be.

    Brothers and Sisters, help your neighbour!


  • Freedom at last, Linux + MingW cross compiler’s endless possibilies

    Having worked on an RTS (real time strategy) open source game at sourceforge.net, I came across many challenges but also learned many things related to the world of open source. This article will attempt to discuss some of those things in the hope that the information helps other developers in the open source realm. I will attempt to share this in 2 parts, part 1 will be the ultimate way to freedom, while part 2 will discuss things encountered along the way and will act almost as a kind of story.

    Part 1: Cross compiling your C/C++ open source project in Linux, for Linux and Windows.

    The basic recipe that I used to accomplish this involves the following:

    – CodeBlocks IDE (you could likely use eclipse too)
    – MingW cross compiler
    – All the source code for your project (and its dependencies)
    – time (the precious commodity that everyone wants from you)

    For the first 2 items (CodeBlocks and MingW) got the following links:

    CodeBlocks
    MingW

    Now, a few things to keep in mind as you travel through the compilation process:

    – you MUST recompile all dll’s and libs within MingW (VC++ and other compilers are NOT compatible with MingW)

    Take for example compiling OpenAL (Open Audio Library) from Creative that many open source projects use. Compiling this library includes a few challenges, including the need to fix dsound.h from the DirectX SDK to compile with MingW.

    edit dsound.h and comment out line 1899:

    //typedef struct IDirectSoundFullDuplex *LPDIRECTSOUNDFULLDUPLEX;

    next edit the file included in the OpenAL SDK named XCompile.txt so its looks something like the following:

    # Cross-compiling requires CMake 2.6 or newer. To cross-compile, first modify
    # this file to set the proper settings and paths. Then use it from build/ like:
    # cmake .. -DCMAKE_TOOLCHAIN_FILE=../XCompile.txt \
    #          -DCMAKE_INSTALL_PREFIX=/usr/mingw32/mingw
    # If you already have a toolchain file setup, you may use that instead of this
    # file.

    # the name of the target operating system
    SET(CMAKE_SYSTEM_NAME Windows)

    # which compilers to use for C and C++
    SET(CMAKE_C_COMPILER i586-mingw32msvc-gcc)
    SET(CMAKE_CXX_COMPILER i586-mingw32msvc-g++)

    # here is the target environment located
    SET(CMAKE_FIND_ROOT_PATH /usr/i586-mingw32msvc)

    # adjust the default behaviour of the FIND_XXX() commands:
    # search headers and libraries in the target environment, search
    # programs in the host environment
    set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
    set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
    set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

    Next edit CMakeLists.txt to tell it where to find your DirectX SDK files adding something like the following BEFORE the section:

    # Check DSound/MMSystem backend
    IF(DSOUND)

    Add the following:

    SET (DXSDK_DIR "/home/softcoder/Code/megaglest/trunk/source/win32_deps/Microsoft DirectX SDK (November 2007)")
    SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} "${DXSDK_DIR}/Include")
    INCLUDE_DIRECTORIES("${DXSDK_DIR}/Include")
    LINK_DIRECTORIES("${DXSDK_DIR}/Lib")

    Next run cmake to produce the makefiles for OpenAL which should now properly find direct sound from DirectX:

    cmake .. -DCMAKE_TOOLCHAIN_FILE=../XCompile.txt -DCMAKE_INSTALL_PREFIX=/usr/i586-mingw32msvc

    make

    after running this you should get OpenAL lib’s / DLL’s produced for MingW.

    As a general rule you simply need to point the compiler etc.. the MingW’s and any dependencies need to find your MingW compiled libs.

    For example Compiling lobogg and libvorbis:

    ./configure --host=i586-mingw32msvc --build=i686-pc-linux-gnu --enable-shared --disable-static --libdir=./lib

    make

    LDFLAGS="-L/home/softcoder/Code/megaglest/trunk/source/win32_deps/lib" ./configure --host=i586-mingw32msvc --enable-shared --disable-static --with-ogg-libraries=../lib --with-ogg-includes=../libogg-1.2.1/include

    make

    What should you do if you get lots of:

    undefined reference to x

    linker errors? This typically means you need to order the libs in your project in proper order! Here’s an example from my codeblocks project file (the order does matter):

    <Linker>
              <Add option="-Wl,-subsystem,console" />
              <Add option="-mconsole" />
              <Add library="mingw32" />
              <Add library="ddraw" />
              <Add library="dsound" />
              <Add library="dxguid" />
              <Add library="ws2_32" />
              <Add library="iphlpapi" />
              <Add library="wsock32" />
              <Add library="liblibogg" />
              <Add library="liblibvorbis" />
              <Add library="liblibvorbisfile" />
              <Add library="zlib" />
              <Add library="jpeg" />
              <Add library="liblibpng" />
              <Add library="xerces-c" />
              <Add library="OpenAL32" />
              <Add library="liblibcurl" />
              <Add library="winmm" />
              <Add library="gdi32" />
              <Add library="opengl32" />
              <Add library="glu32" />
              <Add library="SDL" />
              <Add library="SDLmain" />
              <Add library="lua5.1" />
              <Add library="streflop" />
              <Add library="glest" />
              <Add directory="../../source/win32_deps/lib" />
              <Add directory="../../source/win32_deps/xerces-c-src_2_8_0/lib" />
    </Linker>

    Also what should you do if you program always produces stdout.txt and stderror.txt even though the application is a console application? It appears that this can happen due ti SDL taking convtrol of these streams. You can recompile SDL with:

    ./configure --disable-stdio-redirect

    For more details check out: here

    Another item that caused trouble was wxWidgets. I kept getting the following error after running configure:

    ./configure --target=i586-mingw32msvc --host=i586-mingw32msvc

    /home/softcoder/Code/megaglest/trunk/source/win32_deps/wxWidgets-2.8.10/bk-deps i586-mingw32msvc-gcc -c -o wxexpat_xmlparse.o -I./src/expat   -I/home/softcoder/Code/megaglest/trunk/source/win32_deps/wxWidgets-2.8.10/lib/wx/include/i586-mingw32msvc-msw-ansi-release-2.8 -I./include -mthreads -Wall -Wundef -O2 -fno-strict-aliasing -mthreads ./src/expat/lib/xmlparse.c
    ./src/expat/lib/xmlparse.c:97:2: error: #error memmove does not exist on this platform, nor is a substitute available
    ./src/expat/lib/xmlparse.c: In function ‘XML_SetEncoding’:
    ./src/expat/lib/xmlparse.c:888: error: ‘isParamEntity’ undeclared (first use in this function)
    ./src/expat/lib/xmlparse.c:888: error: (Each undeclared identifier is reported only once
    ./src/expat/lib/xmlparse.c:888: error: for each function it appears in.)
    ./src/expat/lib/xmlparse.c:888: error: ‘externalParEntInitProcessor’ undeclared (first use in this function)
    ./src/expat/lib/xmlparse.c: In function ‘XML_SetReturnNSTriplet’:
    ./src/expat/lib/xmlparse.c:1110: error: ‘isParamEntity’ undeclared (first use in this function)
    ./src/expat/lib/xmlparse.c:1110: error: ‘externalParEntInitProcessor’ undeclared (first use in this function)
    ./src/expat/lib/xmlparse.c: In function ‘XML_SetParamEntityParsing’:
    ./src/expat/lib/xmlparse.c:1362: error: ‘isParamEntity’ undeclared (first use in this function)
    ./src/expat/lib/xmlparse.c:1362: error: ‘externalParEntInitProcessor’ undeclared (first use in this function)
    make: *** [wxexpat_xmlparse.o] Error 1

    To fix this issue I had to edit the configure script and add the following:

    ORIGINAL:

    OPTIMISE_CFLAGS=
    if test "$wxUSE_OPTIMISE" = "no" ; then
        if test "$GCC" = yes ; then
                            OPTIMISE_CFLAGS="-O0"
        fi
    else
        if test "$GCC" = yes ; then
            case "${host}" in
                *-pc-os2_emx | *-pc-os2-emx )
                                                    OPTIMISE_CFLAGS="-O2"
                ;;
                *)
                                                                    OPTIMISE_CFLAGS="-O2 -fno-strict-aliasing"
                ;;
            esac
        else
            OPTIMISE_CFLAGS="-O"
        fi
    fi

    FIXED:

    OPTIMISE_CFLAGS=
    if test "$wxUSE_OPTIMISE" = "no" ; then
        if test "$GCC" = yes ; then
                            OPTIMISE_CFLAGS="-O0"
        fi
    else
        if test "$GCC" = yes ; then
            case "${host}" in
                *-pc-os2_emx | *-pc-os2-emx )
                                                    OPTIMISE_CFLAGS="-O2"
                ;;
                *-*-cygwin* | *-*-mingw32* )
                    OPTIMISE_CFLAGS="-O2 -fno-strict-aliasing -DHAVE_MEMMOVE=1 -DXML_DTD"
    
                    echo "=====================> MingW Fix Setup"
                ;;
    
                *)
                                                                    OPTIMISE_CFLAGS="-O2 -fno-strict-aliasing"
                ;;
            esac
        else
            OPTIMISE_CFLAGS="-O"
        fi
    fi

    I re-ran configure and then make compiled everything properly.

    For my project I successfully compiled:

    xerces-c
    lua5.1
    sdl
    opengl
    curl
    openal
    libpng
    jpeg
    zlib
    libogg
    libvorbis


    Part 2: Why is it a good idea to cross compile?

    If your software supports multiple platforms (like many “good” open source projects do), then you already know the answer. It can be a very tedious task to try to maintain code for multiple platforms especially if you cannot easily, quickly compile your code changes for the target platform in one development environment (and operating system). Some people use Virtual Machine Software (Like the highly recommended Virtual Box) but even this approach often leaves you feeling dirty, having to load up some version of Windows in your VM (assuming of course that you have a legit license, etc). All to offer a binary for those poor “entangled” windows users!

    No more! Now we simply target the same code to the Windows platform and it builds the binaries using the MingW cross compiler! Now developers can focus on cross platform code with a purpose, and not worry so much about how to compile for those other platforms. This should open the doors for a broader audience for numerous open source projects (especially where build resources are limited). Add to this the installation of WINE (here) and you can also test the windows binary from your Linux environment. Lovely! This means you may support more users without compromising your coding morals.

    Thanks, and I hope this helps others.