> -----Original Message-----
> From: Mats Wichmann [mailto:m...@wichmann.us]
> Sent: Saturday, September 23, 2017 5:35 PM
> To: VanCutsem, Geoffroy <geoffroy.vancut...@intel.com>; iotivity-
> d...@lists.iotivity.org
> Subject: Re: [dev] Building IoTivity 1.3.0 for Linux 32-bit (esp. for arch 
> 'i586' or
> 'i686')
> 
> On 09/22/2017 04:33 PM, VanCutsem, Geoffroy wrote:
> > Hi folks,
> >
> > One of my team member mentioned that IoTivity 1.3.0 does not build
> anymore for some Linux in 32-bit mode (previous versions such as 1.2.1 built
> just fine). Specifically, when the platform.machine() (see [1]) returns
> something like 'i586' or 'i686', it will simply not build. You can override 
> this by
> forcing TARGET_ARCH to 'x86' but I feel that that shouldn't be needed.
> >
> > IoTivity 1.2.x had a mechanism in place so that when the 'default_arch'
> value was not in the 'os_arch_map' list (see [2]), then the very first arch 
> from
> the list for that particular OS was selected. It's a bit rough as for Linux 
> as an
> example, any unrecognized ARM, MIPS architecture would make the build
> system attempt to build for 'x86'. My patch [3] below is therefore a slight
> variation of that logic in that it simply detects if 'i586' or 'i686' was 
> detected
> (for Linux) and if so, it replaces that value by 'x86'. Does that sound like 
> the
> right fix to the problem?
> >
> > [1]
> > https://github.com/iotivity/iotivity/blob/master/build_common/SConscri
> > pt#L68 [2]
> > https://github.com/iotivity/iotivity/blob/1.2-rel/build_common/SConscr
> > ipt#L57
> > [3]
> > diff --git a/build_common/SConscript b/build_common/SConscript index
> > 46a6735..61c5889 100755
> > --- a/build_common/SConscript
> > +++ b/build_common/SConscript
> > @@ -55,6 +55,9 @@ else:
> >      default_arch = platform.machine()
> >      if target_os == 'windows':
> >          default_arch = default_arch.lower()
> > +    if target_os == 'linux':
> > +        if default_arch in ['i586', 'i686']:
> > +         default_arch = 'x86'
> >
> >  target_arch = ARGUMENTS.get('TARGET_ARCH', default_arch) # target
> > arch
> 
> I fired up a 32-bit Ubuntu 16.04 to try this, and there's more trouble... if 
> you
> try to build with this change, the system thinks cross-compilation is
> happening.  Two scripts have this logic:
> 
>         if not target_arch == platform.machine():
>             print '''
> *********************************** Warning
> **********************************
> * You are trying cross build, please make sure cross (%s) libraries are
> * installed!
> ****************************************************************
> **************
> ''' % target_arch
> 
> 
> while that's not a fail as written, just an output message, about the first 
> thing
> tried - building googletest - fails.  I'll try to get to the bottom of it 
> later, I'm
> being told I'm supposed to go have a weekend :)
> 

Interesting, I had not noticed that. Tonny on my team who brought this up to me 
successfully built IoTivity for Linux 32-bit with this patch (at least I 
believe he used the exact same patch). I'll see if we can investigate this on 
our side too. I would expect that if all dependencies are correctly installed, 
this should just be a warning message but things should still build correctly.

Outside of the Tizen build scripts/examples, there is another place where 
'default_arch' is set to platform.machine() and that's in: 
https://github.com/iotivity/iotivity/blob/master/resource/csdk/connectivity/build/SConscript.
 That file in fact duplicates some of what's already in 
https://github.com/iotivity/iotivity/blob/master/build_common/SConscript. It 
has its own version of 'os_arch_map' and 'host_target_map' tables for example. 
I haven't looked at it in details but I suspect this is unnecessary and hence 
sub-optimal.

Geoffroy

_______________________________________________
iotivity-dev mailing list
iotivity-dev@lists.iotivity.org
https://lists.iotivity.org/mailman/listinfo/iotivity-dev

Reply via email to