btConvexHullComputer.cpp not building with LLVM

mslinklater
Posts: 1
Joined: Thu Aug 18, 2005 2:25 pm
Location: Liverpool, UK.

btConvexHullComputer.cpp not building with LLVM

Post by mslinklater »

Hi. I've just started working on an iOS project for a client and I'm finding that if I build Bullet 2.78 with LLVM on Xcode, and target an iOS device the compiler locks solid. I've posted this issue on the Apple dev forum, but was wondering if anyone here is finding this issue ?

If I drop down to GCC or target the emulator things work fine. If I go with LLVM and target a device the compile of btConvexHullComputer.cpp starts but never completes, and I have to kill the build task.

Is this problem isolated to just my project ?

Thanks.
faatal
Posts: 2
Joined: Tue Aug 17, 2010 1:09 am

Re: btConvexHullComputer.cpp not building with LLVM

Post by faatal »

Same problem. XCode 4.1. clang is using around 2 GB and never finishes. I don't have to kill the process, since the stop build button works after several seconds.

The DMul line in each of the functions below is the problem. I commented them out, since it does not matter to the iOS project I am currently updating.

btConvexHullComputer.cpp:
btConvexHullInternal::Int128 btConvexHullInternal::Int128::mul(int64_t a, int64_t b)
btConvexHullInternal::Int128 btConvexHullInternal::Int128::mul(uint64_t a, uint64_t b)
FipS
Posts: 1
Joined: Thu Nov 24, 2011 11:51 am

Re: btConvexHullComputer.cpp not building with LLVM

Post by FipS »

Hi Guys,

I've just come across this issue and found out that the problems seems to be in right bit shifting on uint64_t, in the code below:

Code: Select all

template<typename UWord, typename UHWord> class DMul
{
 private:
    static uint32_t high(uint64_t value)
    {
        return (uint32_t) (value >> 32);
    }
...
So I've made a quick fix, and it compiles fine now, see the changes below:

Code: Select all

template<typename UWord, typename UHWord> class DMul
{
 private:
    static uint32_t high(uint64_t value)
    {
        struct cast_helper
        {
            union
            {
                uint32_t value64;
                struct { uint32_t low, high; } value32;
            };
            cast_helper(uint64_t value) : value64(value) {}
        };
        return cast_helper(value).value32.high;
    }
    ...
Hope it helps...
FipS