Overview
Features
Download
Documentation
Community
Add-Ons & Services

Cross compiling for Freescale MCF53XX

Please post support and help requests here.

Cross compiling for Freescale MCF53XX

Postby fnchooft » 24 Sep 2012, 21:16

Good Afternoon,

I have been using POCO for some time now on Linux (very nice API), but I would also like to use it on the freescale-platform.
I have been trying to cross-compile the lib using the tool-chain downloaded from https://sourcery.mentor.com/GNUToolchain/package9493/public/m68k-uclinux/freescale-coldfire-2011.09-23-m68k-uclinux-i686-pc-linux-gnu.tar.bz2.

After some minor tweaks, such as changing fork() to vfork(), adding some flags for SQLite3 to compile, the lib compiles without much problems.
Also I removed some SharedClasses, such as (NamedEvent NamedMutex SharedMemory SharedLibrary) as I was reading the forum for IPhone-specific compilations.

This is my configuration statement: (The config file FREESCALE5329 can be found inside the attached diff-file)

./configure --config=FREESCALE5329 --omit=Data/MySQL,Data/ODBC,Crypto,NetSSL_OpenSSL,PageCompiler --static --no-sharedmemory --no-fpenvironment --no-sharedlibs --no-wstring --no-tests --no-samples

I have attached a diff-file which shows the configuration that I am using, plus the alterations that I made to the source-code.

The real problem starts when I try to link a simple program against the static libraries that have been created. Here i run into errors such as:

/home/user/amb2012/freescale-coldfire-2011.09/bin/m68k-uclinux-g++ -o config_test config_test.o --start-group /home/user/amb2012/poco-1.4.4-all/lib/Linux/FS5329/libPocoXML.a /home/user/amb2012/poco-1.4.4-all/lib/Linux/FS5329/libPocoUtil.a /home/user/amb2012/poco-1.4.4-all/lib/Linux/FS5329/libPocoFoundation.a --end-group -lpthread

/home/user/amb2012/poco-1.4.4-all/lib/Linux/FS5329/libPocoUtil.a(AbstractConfiguration.o): In function `Poco::Util::AbstractConfiguration::~AbstractConfiguration()':
AbstractConfiguration.cpp:(.text+0x1fa): undefined reference to `__sync_sub_and_fetch_4'
AbstractConfiguration.cpp:(.text+0x294): undefined reference to `__sync_sub_and_fetch_4'
AbstractConfiguration.cpp:(.text+0x32a): undefined reference to `__sync_sub_and_fetch_4'


Also the libraries seem to be shot, since I am getting:
XMLConfiguration.cpp:(.text+0x382): undefined reference to `typeinfo for Poco::XML::Element'
XMLConfiguration.cpp:(.text+0x388): undefined reference to `typeinfo for Poco::XML::Node'
XMLConfiguration.cpp:(.text+0x3a2): undefined reference to `Poco::XML::Element::getAttribute(std::string const&) const'
XMLConfiguration.cpp:(.text+0x3cc): undefined reference to `Poco::XML::Element::getAttribute(std::string const&) const'
XMLConfiguration.cpp:(.text+0x43a): undefined reference to `typeinfo for Poco::XML::Element'
XMLConfiguration.cpp:(.text+0x442): undefined reference to `typeinfo for Poco::XML::Node'

I placed the libs between a start- and end-group in the hope this would resolve it.


I must confess that I do not have extensive experience with cross-compiling, maybe I am overlooking something very basic here.
Any direction would be greatly appreciated,

Kind regards,

Fabian
fnchooft
 
Posts: 4
Joined: 24 Sep 2012, 20:43

Re: Cross compiling for Freescale MCF53XX

Postby guenter » 26 Sep 2012, 01:32

When linking statically, the order of libraries matters. Util depends on XML (unless you configure with --poquito), so you'll have to put it in this order: Util XML Foundation.
Regarding the undefined symbols issue: compile with -DPOCO_NO_GCC_ATOMICS (add this to SYSFLAGS in your build configuration).
guenter
 
Posts: 1132
Joined: 11 Jul 2006, 16:27
Location: Austria

Re: Cross compiling for Freescale MCF53XX

Postby fnchooft » 26 Sep 2012, 02:33

Good Evening Guenter,
Thank you for the info, I will try it tomorrow.
It would be great to have the library running on our embedded systems.

Herzlichen Dank,

Fabian
fnchooft
 
Posts: 4
Joined: 24 Sep 2012, 20:43

Re: Cross compiling for Freescale MCF53XX

Postby fnchooft » 01 Oct 2012, 19:25

Good afternoon,

I tried your solution by adding -DPOCO_NO_GCC_ATOMICS.

Unfortunately there seems to be another error now further along in the compilation process:

In file included from include/Poco/SharedPtr.h:45:0,
from include/Poco/TextEncoding.h:44,
from include/Poco/ASCIIEncoding.h:44,
from src/ASCIIEncoding.cpp:37:
include/Poco/AtomicCounter.h:137:11: error: 'FastMutex' does not name a type

Any idea what is going on here?

Kind regards,

Fabian
fnchooft
 
Posts: 4
Joined: 24 Sep 2012, 20:43

Re: Cross compiling for Freescale MCF53XX

Postby guenter » 01 Oct 2012, 20:13

Re-download the 1.4.4 sources or fix the AtomicCounter.h header and move the #include "Poco/Mutex.h" out of the #ifdef block:

Code: Select all
#include "Poco/Foundation.h"
#if POCO_OS == POCO_OS_WINDOWS_NT
#include "Poco/UnWindows.h"
#elif POCO_OS == POCO_OS_MAC_OS_X
#include <libkern/OSAtomic.h>
#elif ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2) || __GNUC__ > 4) && (defined(__x86_64__) || defined(__i386__))
#if !defined(POCO_HAVE_GCC_ATOMICS) && !defined(POCO_NO_GCC_ATOMICS)
#define POCO_HAVE_GCC_ATOMICS
#endif
#elif ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3) || __GNUC__ > 4)
#if !defined(POCO_HAVE_GCC_ATOMICS) && !defined(POCO_NO_GCC_ATOMICS)
#define POCO_HAVE_GCC_ATOMICS
#endif
#endif // POCO_OS
#include "Poco/Mutex.h"


Due to a config management/file release snafu, the original TAR archives did not include that final fix. Correct TAR archives have been uploaded a few days after the original release, and we'll also soon have a 1.4.4p1 release containing a few more fixes.
guenter
 
Posts: 1132
Joined: 11 Jul 2006, 16:27
Location: Austria

Re: Cross compiling for Freescale MCF53XX

Postby fnchooft » 02 Oct 2012, 15:01

Hi Guenter,

Thank you again for all the help, I was able to compile the lib and compile against it successfully.
I just ran the first test-application on one of our freescale-testboards.
I can send you a diff if you want for this platform plus the alterations I needed to make substituting fork with vfork etc.

Thanks again, looking forward to putting the library to work,
Kind regards,

Herzlichen Dank nochmals,

Fabian
fnchooft
 
Posts: 4
Joined: 24 Sep 2012, 20:43


Return to Support

Who is online

Users browsing this forum: No registered users and 3 guests