Menu

#35 universal build fails: error: expected value in expression

v1.0 (example)
closed-fixed
nobody
None
5
2014-09-01
2013-08-17
No

Building liblo 0.27 on OS X as a universal binary (i.e. for both i386 and x86_64 architectures simultaneously) fails at build time with:

In file included from address.c:44:
In file included from ../lo/lo.h:28:
../lo/lo_endian.h:121:5: error: expected value in expression
#if 
    ^
1 error generated.

It builds fine non-universally (i.e. for just the single architecture x86_64) but the universal build worked fine in liblo 0.26 so this is a regression.

Are you checking endianness at configure time and then using the result of that check at build time? That doesn't work on OS X when building for multiple architectures simultaneously since the architectures might be of different endianness or bitness. Instead use preprocessor flags in your source code and dispense with a configure-time check. e.g. instead of your custom LO_BIGENDIAN check that you substitute at configure time, use the standard __BIG_ENDIAN__ pre-processor check.

1 Attachments

Discussion

  • Stephen Sinclair

    Is __BIG_ENDIAN__ really cross-platform? I'll look into it. I'm not aware of universal builds working in 0.26, I always built it twice and used lipo.

     

    Last edit: Stephen Sinclair 2013-08-17
  • Ryan Carsten Schmidt

    I am not certain how cross-platform __BIG_ENDIAN__ is since I only use Macs. But we have patched many projects in MacPorts to use __BIG_ENDIAN__.

    We can build twice and lipo if we must, it's just that so many other projects work fine when built for multiple architectures simultaneously that I have to believe it would be possible for liblo also. We can also maintain our own patches to use __BIG_ENDIAN__ for liblo, if it cannot be solved in a cross-platform way.

    I checked 0.26 again. It looks like its configure script was built with an older version of autoconf which was not aware of universal builds, so it just reports:

    checking whether byte ordering is bigendian... no
    

    So, probably, an i386 ppc universal build of liblo would have compiled ok but been faulty.

     
  • Stephen Sinclair

    I may have a fix to allow __BIG_ENDIAN__ to override configure-time LO_BIGENDIAN, my only worry is that this could break cross-compilation targets. Trying to find a good way to test this, then I'll push it.

     
  • Stephen Sinclair

    Ok, it should be fixed now. Universal build works with gcc and clang. (Note, --disable-dependency-tracking must be specified when using gcc.)

    Fixed in d1a741cb111c77c4a63d7f02c189ba1c3f09e474

     
  • Stephen Sinclair

    • status: open --> closed-fixed
     

Log in to post a comment.