[Olsr-dev] [Commotion-dev] Can't talk between desktop OLSRd and Commotion OpenWRT boxes

Hans-Christoph Steiner (spam-protected)
Thu Mar 14 22:05:57 CET 2013


I don't think there are any errors during compilation but during runtime.  It
seems that with a 0.6.1 through 0.6.5, using -O2 in the build stopping olsrd
from working on his machine.

You can see the build log for the original package that he used when he was
first having the problem here:
https://launchpadlibrarian.net/118314823/buildlog_ubuntu-precise-amd64.olsrd_0.6.3-5~precise_BUILDING.txt.gz

The key error seems to be this, which seems to show up when -O2 is used, but
does not show up when -O2 is removed:

sendto(v4): Invalid argument


Lots more detail here, Mikael has been providing a lot of useful data:
https://lists.chambana.net/pipermail/commotion-dev/2013-March/001175.html


.hc

On 03/14/2013 10:58 AM, Henning Rogge wrote:
> Hi,
> 
> can you maybe post the error message you got during compilation?
> 
> If you don't get any warnings/errors, try this patch to activate them:
> 
> diff --git a/Makefile.inc b/Makefile.inc
> index 4275ad2..a79bc52 100644
> --- a/Makefile.inc
> +++ b/Makefile.inc
> @@ -228,7 +228,7 @@ quote = $(subst .,\.,$(subst /,\/,$1))
> 
>  %.o: %.c
>         @echo "[CC] $<"
> -       @$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
> +       $(CC) -O2 $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
> 
>  # we always need the includes and defines
>  # for legacy since now
> 
> ----------------------
> 
> I tried to compile OLSRd (0.6.4) directly from repository but with -O2 and it
> seems to compile well.
> 
> I used the same distribution (Ubuntu 12.10 64bit) and the same GCC.
> 
> Henning Rogge
> 
> On 03/14/2013 12:39 PM, Mikael Nordfeldth wrote:
>> Hans-Christoph Steiner asked me to post this bug report to the olsr-dev
>> list, originally coming from the commotion-dev list:
>> https://lists.chambana.net/pipermail/commotion-dev/2013-March/001175.html
>>
>> Essentially the problem was that I couldn't run the olsrd in the Ubuntu
>> PPA (at least on Quantal 12.10 64bit).
>> The following post reasons that it is due to the gcc -O2 switch being
>> enabled by a Makefile-patch which was added with the .deb-packaging.
>>
>> So this is a bug report for the .deb for (at least) 0.6.3 in Ubuntu
>> quantal 64bit, as I have not tried it on any other platform. I'd be
>> happy to help with further debugging.
>>
>> 2013-03-08 19:27, Hans-Christoph Steiner wrote:
>>> Right now, Debian squeeze and wheezy have 0.6.2, and Ubuntu has 0.6.1
>>> and 0.6.3:
>>> http://packages.debian.org/search?keywords=olsrd
>>> http://packages.ubuntu.com/search?keywords=olsrd
>>> So the idea is to find out which version of these we can rely on, and
>>> which we
>>> need to use replacements.
>>
>> Gah. This seems way more advanced than what I can explain with my
>> knowledge. Nevertheless, I did find what caused my error, the -O2 gcc
>> optimization switch as patched by Debian package "hardening fixes":
>>
>> 1. I tried compiling various olsrd versions. All worked.
>> 2. I tried compiling 0.6.3-5~quantal from 'apt-get source'. It didn't work.
>> 3. I tried compiling the 0.6.3.orig source (same as above, without
>> debian patches) It worked.
>> 4. None of the patches contained any networking code (except the json
>> plugin, but disabling it didn't have any effect anyway)
>> 5. I found that removing the -O2 switch on line 227 in Makefile.inc, as
>> patched by 310-hardening-fixes.patch resolved my invalid argument
>> sendto(v4) issue:
>>
>>   %.o: %.c
>>          @echo "[CC] $<"
>> -       $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
>> +       $(CC) -O2 $(CFLAGS) $(CPPFLAGS) -fPIE -c -o $@ $<
>>
>>
>> Reverting this (and even leaving the -fPIE there but removing -O2) makes
>> the resulting binary functional.
>>
>>
>> So the specific problem was caused by the -O2 parameter to gcc, I guess
>> making it a compiling/linking issue. I don't know enough about this
>> myself though, so I'm attaching ('O2-opts') the output of what that
>> level of optimizations means if anyone is interested (gcc -c -Q -O2
>> --help=optimizers)
>>
>> More info on my build environment is below:
>>
>> $ gcc -v
>> Using built-in specs.
>> COLLECT_GCC=gcc
>> COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper
>> Target: x86_64-linux-gnu
>> Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro
>> 4.7.2-2ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs
>> --enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr
>> --program-suffix=-4.7 --enable-shared --enable-linker-build-id
>> --with-system-zlib --libexecdir=/usr/lib --without-included-gettext
>> --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7
>> --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
>> --enable-libstdcxx-debug --enable-libstdcxx-time=yes
>> --enable-gnu-unique-object --enable-plugin --enable-objc-gc
>> --disable-werror --with-arch-32=i686 --with-tune=generic
>> --enable-checking=release --build=x86_64-linux-gnu
>> --host=x86_64-linux-gnu --target=x86_64-linux-gnu
>> Thread model: posix
>> gcc version 4.7.2 (Ubuntu/Linaro 4.7.2-2ubuntu1)
>>
>>
>> $ uname -a
>> Linux plexi 3.5.0-25-generic #39-Ubuntu SMP Mon Feb 25 18:26:58 UTC 2013
>> x86_64 x86_64 x86_64 GNU/Linux
>>
>>
>>
> 
> 
> 
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 939 bytes
Desc: OpenPGP digital signature
URL: <http://lists.olsr.org/pipermail/olsr-dev/attachments/20130314/1cd99428/attachment.sig>


More information about the Olsr-dev mailing list