Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to build chipmunk on arm32 #216

Open
captain0xff opened this issue Jan 30, 2022 · 1 comment
Open

Unable to build chipmunk on arm32 #216

captain0xff opened this issue Jan 30, 2022 · 1 comment

Comments

@captain0xff
Copy link

captain0xff commented Jan 30, 2022

Hello. I am trying to build chipmunk on termux in my arm 32 phone. But I get the following errors and warnings.

Chipmunk2D/src/cpHastySpace.c:236:4: error: Cannot use CP_USE_DOUBLES on 32 bit ARM.
                #error Cannot use CP_USE_DOUBLES on 32 bit ARM.
                 ^
Chipmunk2D/src/cpHastySpace.c:239:10: error: unknown type name 'float64_t'
        typedef float64_t cpFloat_t;
                ^
Chipmunk2D/src/cpHastySpace.c:240:10: error: unknown type name 'float64x2_t'
        typedef float64x2_t cpFloatx2_t;
                ^
Chipmunk2D/src/cpHastySpace.c:289:26: warning: excess elements in scalar initializer [-Wexcess-initializers]
        return (cpFloatx2_t){x, y};
                                ^
Chipmunk2D/src/cpHastySpace.c:297:27: warning: implicit declaration of function 'vld1q_f64' is invalid in C99 [-Wimplicit-function-declaration]
        cpFloatx2_t surface_vr = vld((cpFloat_t *)&arb->surface_vr);
                                 ^
Chipmunk2D/src/cpHastySpace.c:241:14: note: expanded from macro 'vld'
        #define vld vld1q_f64
                    ^
Chipmunk2D/src/cpHastySpace.c:309:21: warning: implicit declaration of function 'vmulq_f64' is invalid in C99 [-Wimplicit-function-declaration]
                cpFloatx2_t r1p = vmul(vrev(r1), perp);
                                  ^
Chipmunk2D/src/cpHastySpace.c:248:15: note: expanded from macro 'vmul'
        #define vmul vmulq_f64
                     ^
Chipmunk2D/src/cpHastySpace.c:309:26: error: first two arguments to '__builtin_shufflevector' must be vectors
                cpFloatx2_t r1p = vmul(vrev(r1), perp);
                                       ^~~~~~~~
Chipmunk2D/src/cpHastySpace.c:255:20: note: expanded from macro 'vrev'
        #define vrev(__a) __builtin_shufflevector(__a, __a, 1, 0)
                          ^                       ~~~~~~~~
Chipmunk2D/src/cpHastySpace.c:310:26: error: first two arguments to '__builtin_shufflevector' must be vectors
                cpFloatx2_t r2p = vmul(vrev(r2), perp);
                                       ^~~~~~~~
Chipmunk2D/src/cpHastySpace.c:255:20: note: expanded from macro 'vrev'
        #define vrev(__a) __builtin_shufflevector(__a, __a, 1, 0)
                          ^                       ~~~~~~~~
Chipmunk2D/src/cpHastySpace.c:316:21: warning: implicit declaration of function 'vaddq_f64' is invalid in C99 [-Wimplicit-function-declaration]
                cpFloatx2_t vb1 = vadd(vBias_a, vmul_n(r1p, vget_lane(wBias, 0)));
                                  ^
Chipmunk2D/src/cpHastySpace.c:245:15: note: expanded from macro 'vadd'
        #define vadd vaddq_f64
                     ^
Chipmunk2D/src/cpHastySpace.c:316:35: warning: implicit declaration of function 'vmulq_n_f64' is invalid in C99 [-Wimplicit-function-declaration]
                cpFloatx2_t vb1 = vadd(vBias_a, vmul_n(r1p, vget_lane(wBias, 0)));
                                                ^
Chipmunk2D/src/cpHastySpace.c:249:17: note: expanded from macro 'vmul_n'
        #define vmul_n vmulq_n_f64
                       ^
Chipmunk2D/src/cpHastySpace.c:316:47: warning: implicit declaration of function 'vgetq_lane_f64' is invalid in C99 [-Wimplicit-function-declaration]
                cpFloatx2_t vb1 = vadd(vBias_a, vmul_n(r1p, vget_lane(wBias, 0)));
                                                            ^
Chipmunk2D/src/cpHastySpace.c:251:20: note: expanded from macro 'vget_lane'
        #define vget_lane vgetq_lane_f64
                          ^
Chipmunk2D/src/cpHastySpace.c:318:21: warning: implicit declaration of function 'vsubq_f64' is invalid in C99 [-Wimplicit-function-declaration]
                cpFloatx2_t vbr = vsub(vb2, vb1);
                                  ^
Chipmunk2D/src/cpHastySpace.c:246:15: note: expanded from macro 'vsub'
        #define vsub vsubq_f64
                     ^
Chipmunk2D/src/cpHastySpace.c:327:25: warning: implicit declaration of function 'vpaddq_f64' is invalid in C99 [-Wimplicit-function-declaration]
                cpFloatx2_t vbn_vrn = vpadd(vmul(vbr, n), vmul(vr, n));
                                      ^
Chipmunk2D/src/cpHastySpace.c:247:16: note: expanded from macro 'vpadd'
        #define vpadd vpaddq_f64
                      ^
Chipmunk2D/src/cpHastySpace.c:332:12: warning: implicit declaration of function 'vmaxq_f64' is invalid in C99 [-Wimplicit-function-declaration]
                jbn_jn = vmax(vadd(jOld, jbn_jn), vdup_n(0.0));
                         ^
Chipmunk2D/src/cpHastySpace.c:254:15: note: expanded from macro 'vmax'
        #define vmax vmaxq_f64
                     ^
Chipmunk2D/src/cpHastySpace.c:332:37: warning: implicit declaration of function 'vdupq_n_f64' is invalid in C99 [-Wimplicit-function-declaration]
                jbn_jn = vmax(vadd(jOld, jbn_jn), vdup_n(0.0));
                                                  ^
Chipmunk2D/src/cpHastySpace.c:242:17: note: expanded from macro 'vdup_n'
        #define vdup_n vdupq_n_f64
                       ^
Chipmunk2D/src/cpHastySpace.c:335:24: error: first two arguments to '__builtin_shufflevector' must be vectors
                cpFloatx2_t t = vmul(vrev(n), perp);
                                     ^~~~~~~
Chipmunk2D/src/cpHastySpace.c:255:20: note: expanded from macro 'vrev'
        #define vrev(__a) __builtin_shufflevector(__a, __a, 1, 0)
                          ^                       ~~~~~~~~
Chipmunk2D/src/cpHastySpace.c:339:23: error: scalar initializer cannot be empty
                cpFloatx2_t jtOld = {}; jtOld = vset_lane(con->jtAcc, jtOld, 0);
                                    ^~
Chipmunk2D/src/cpHastySpace.c:339:35: warning: implicit declaration of function 'vsetq_lane_f64' is invalid in C99 [-Wimplicit-function-declaration]
                cpFloatx2_t jtOld = {}; jtOld = vset_lane(con->jtAcc, jtOld, 0);
                                                ^
Chipmunk2D/src/cpHastySpace.c:252:20: note: expanded from macro 'vset_lane'
        #define vset_lane vsetq_lane_f64
                          ^
Chipmunk2D/src/cpHastySpace.c:340:23: error: first two arguments to '__builtin_shufflevector' must be vectors
                cpFloatx2_t jtMax = vrev(vmul_n(jbn_jn, friction));
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Chipmunk2D/src/cpHastySpace.c:255:20: note: expanded from macro 'vrev'
        #define vrev(__a) __builtin_shufflevector(__a, __a, 1, 0)
                          ^                       ~~~~~~~~
Chipmunk2D/src/cpHastySpace.c:342:13: warning: implicit declaration of function 'vnegq_f64' is invalid in C99 [-Wimplicit-function-declaration]
                jt = vmax(vneg(jtMax), vmin(vadd(jtOld, jt), jtMax));
                          ^
Chipmunk2D/src/cpHastySpace.c:250:15: note: expanded from macro 'vneg'
        #define vneg vnegq_f64
                     ^
Chipmunk2D/src/cpHastySpace.c:342:26: warning: implicit declaration of function 'vminq_f64' is invalid in C99 [-Wimplicit-function-declaration]
                jt = vmax(vneg(jtMax), vmin(vadd(jtOld, jt), jtMax));
                                       ^
Chipmunk2D/src/cpHastySpace.c:253:15: note: expanded from macro 'vmin'
        #define vmin vminq_f64
                     ^
Chipmunk2D/src/cpHastySpace.c:349:33: error: first two arguments to '__builtin_shufflevector' must be vectors
                cpFloatx2_t jBiasCross = vmul(vrev(jBias), nperp);
                                              ^~~~~~~~~~~
Chipmunk2D/src/cpHastySpace.c:255:20: note: expanded from macro 'vrev'
        #define vrev(__a) __builtin_shufflevector(__a, __a, 1, 0)
                          ^                       ~~~~~~~~
Chipmunk2D/src/cpHastySpace.c:357:29: error: first two arguments to '__builtin_shufflevector' must be vectors
                cpFloatx2_t jCross = vmul(vrev(j), nperp);
                                          ^~~~~~~
Chipmunk2D/src/cpHastySpace.c:255:20: note: expanded from macro 'vrev'
        #define vrev(__a) __builtin_shufflevector(__a, __a, 1, 0)
                          ^                       ~~~~~~~~
Chipmunk2D/src/cpHastySpace.c:365:3: warning: implicit declaration of function 'vst1q_f64' is invalid in C99 [-Wimplicit-function-declaration]
                vst((cpFloat_t *)&a->v_bias, vBias_a);
                ^
Chipmunk2D/src/cpHastySpace.c:243:14: note: expanded from macro 'vst'
        #define vst vst1q_f64
                    ^
Chipmunk2D/src/cpHastySpace.c:367:3: warning: implicit declaration of function 'vst1q_lane_f64' is invalid in C99 [-Wimplicit-function-declaration]
                vst_lane((cpFloat_t *)&a->w_bias, wBias, 0);
                ^
Chipmunk2D/src/cpHastySpace.c:244:19: note: expanded from macro 'vst_lane'
        #define vst_lane vst1q_lane_f64
                         ^
15 warnings and 10 errors generated.
error: command '/data/data/com.termux/files/usr/bin/arm-linux-androideabi-clang' failed with exit code 1
@slembcke
Copy link
Owner

slembcke commented Feb 3, 2022

The code in cpHastySpace.c is all optional code for multithreading and Arm Neon SIMD optimizations. It might be that the particular toolchain you are using doesn't enable Neon and some of the ifdefs need to change? That file gets included by CMake here: https://github.com/slembcke/Chipmunk2D/blob/master/src/CMakeLists.txt#L1

You can just delete that file without losing any significant functionality. Try that first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants