Boost logo

Boost Users :

Subject: [Boost-users] arm-elf-gcc 4.0.1 class alignment
From: Pierre-Andre van Leeuwen (pvl_at_[hidden])
Date: 2012-05-28 03:36:48


Hi

Not sure if this belongs on this list or the Boost.Build list, but the problem exists when using Boost as well as building it.

I'm using Boost with the ARM-ELF-GCC toolchain with gcc version 4.0.1. When building the Boost serialization library, I get the following error:
./boost/archive/basic_binary_oarchive.hpp:80: error: invalid application of 'sizeof' to incomplete type 'boost::STATIC_ASSERTION_FAILURE<false>'

It turns out that sizeof(class_id_type ) == 4 in stead of 2, where class_id_type is defined as follows:

class class_id_type {
private:
    typedef int_least16_t base_type;
    base_type t;
...
};

Using a toolchain with a more recent gcc version (arm-none-eabi-gcc 4.4.1) works correctly, but unfortunately I need to get Boost working with the old toolchain as well. I have tried to add __attribute__ ((packed)) to the class declaration, but that breaks as well (cannot bind packed field in operator int_least16_t).
Is there anything I can do to rectify the situation?

My user-config.jam contains the following:

using gcc : armelf : "arm-elf-gcc.exe" :
                <cflags>-nostdlib
                <cxxflags>-DBOOST_NO_INTRINSIC_WCHAR_T
                <cxxflags>-D__OAT_API_VERSION__=637
                <cxxflags>-D__WIP_PLUGIN_VERSION__=543
                <cxxflags>-D__arm
                <cxxflags>-D_LITTLE_ENDIAN
                <cxxflags>-IC:\Program Files (x86)\Sierra Wireless\Embedded Software\com.wavecom.openat.ide.spm.lib.os.model.6.37.0.201202060950_6.37.0.201202060950\resources/ADL/itf
                <cxxflags>-IC:\Program Files (x86)\Sierra Wireless\Embedded Software\com.wavecom.openat.ide.spm.lib.os.model.6.37.0.201202060950_6.37.0.201202060950\resources/ADL/basic
                <cxxflags>-IC:\Program Files (x86)\Sierra Wireless\Embedded Software\com.wavecom.openat.ide.spm.lib.plugin.model.WIP.5.43.0.201202100610_5.43.0.201202100610\resources/WIP/itf
                <cxxflags>-fshort-enums
                <cxxflags>-fdollars-in-identifiers
                <cxxflags>-nostartfiles
                <cxxflags>-fno-strict-aliasing
                <cxxflags>-fno-common
                <cxxflags>-fomit-frame-pointer
                <cxxflags>-mthumb-interwork
                <cxxflags>-mthumb
                <cxxflags>-march=armv5te
                <cxxflags>-msoft-float
                <cxxflags>-mfpu=fpa
                <cxxflags>-mapcs
                <cxxflags>-mno-apcs-stack-check
                <cxxflags>-mlittle-endian
                <architecture>arm
                <address-model>32

;

I'm building boost with the following command .\b2 variant=debug,release link=static threading=single toolset=gcc-armelf --debug-configuration --debug-building --with-serialization stage

Any help will be appreciated.

Pierre-Andre van Leeuwen
Director | Gendac (Pty) Ltd<http://www.gendac.com/>



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net