Skip to content Skip to sidebar Skip to footer

Cross-Compiling Swiften Library For ARM-embedded With SCons Makery

Swiften is a XMPP client library and my objective was to build it for a ARM-embedded target running Linux. I hacked my way to a successful cross-compile with little knowledge of S

Solution 1:

Brady's answer is correct, regarding how you'd do it in plain SCons. I'd just like to mention that the top-level SConstruct of Swiften already provides arguments like "cc=" and "cxx=" for using local toolchains. You might want to inspect the ouput of scons -h for a complete list of available options.

In addition, the SConscript for the OpenSSL build expects the sources to be located in the relative folder named "openssl", not "openssl-1.0.1c" as in your case. Maybe that's where your build problems are mainly coming from.


Solution 2:

I left a comment above regarding the cross-compilation. Its already been answered in the link provided, but basically you just need to set the appropriate construction variables: CC, CXX, LINK, etc.

As for a "Clean way to integrate OpenSSL into the build" this can be performed simply by adding library and include paths appropriately as follows replacing the quoted values appropriately: (without having to copy/move the original files)

# This sets the location of the OpenSSL Include paths
env.Append(CPPPATH="path/to/openssl/includes")

# This sets the location of the OpenSSL Libraries
env.Append(LIBPATH="path/to/openssl/libraries")

# These are the OpenSSL libraries to be linked into the binary
env.Append(LIBS=["OpenSSL_lib", "OpenSSL_lib2"])

Solution 3:

The choice of compiler, and additional flags, can all be set in Swift's config.py file. A snippet from config.py using a custom compiler and flags is below (the one I use on one of my dev boxes):

cc = link = "/usr/local/llvm-git/bin/clang"
cxx = "/usr/local/llvm-git/bin/clang++"

bothflags = " -std=c++11 -stdlib=libc++ -nostdinc++"
cxxflags = bothflags + " -I/usr/local/libcxx/include -Wno-deprecated"
linkflags = bothflags + " -L/usr/local/libcxx/lib"

This should work for cross-compiling in the same manner.

To use a bundled openssl, you should just be able to extract into 3rdParty/OpenSSL, and add openssl_force_bundled = True to your config.py. You should not need to fiddle with setting include paths to this yourself. It's conceivable that this is tied to a particular openssl release as I've not compiled a bundled openssl since 1.0.0a, but if it doesn't work with the current version it's probably a bug that ought to be fixed. You could also cross-compile openssl yourself and use openssl='/path/to/openssl', but that's a little more of a nuisance for you.


Post a Comment for "Cross-Compiling Swiften Library For ARM-embedded With SCons Makery"