2023-12-28T17:58:12Z Theo Buehler <[email protected]>: > I could use a set of eyes on this for the case that I'm missing something. > > Newer libcxx pulls in ctype.h which defines _L and _C to flag values, that > doesn't work well with the existing code. This results in this kind of error: > > c++: warning: argument unused during compilation: '-s' > [-Wunused-command-line-argument] > /tmp/pobj/irrlamb-1.0.1/irrlamb-1.0.1r613/src/ode/src/lcp.cpp:382:33: error: > expected ')' > dReal *_pairslh, dReal *_L, dReal *_d, > ^ > /usr/include/ctype.h:46:12: note: expanded from macro '_L' > #define _L 0x02 > ^ > > Index: Makefile > =================================================================== > RCS file: /cvs/ports/games/irrlamb/Makefile,v > diff -u -p -r1.19 Makefile > --- Makefile 26 Sep 2023 09:41:37 -0000 1.19 > +++ Makefile 28 Dec 2023 17:50:24 -0000 > @@ -3,6 +3,7 @@ COMMENT = third person, 3D physics game > DISTNAME = irrlamb-$Vr613-src > PKGNAME = irrlamb-$V > CATEGORIES = games x11 > +REVISION = 0 > > # GPLv3+ > PERMIT_PACKAGE = Yes > @@ -36,6 +37,8 @@ SSE_FLAGS = -msse -mfpmath=sse > SSE_FLAGS = > .endif > SUBST_VARS += SSE_FLAGS > + > +FIX_CRLF_FILES += ./src/ode/src/lcp.cpp > > post-extract: > rm -rf ${WRKSRC}/src/irrlicht > Index: patches/patch-src_ode_src_lcp_cpp > =================================================================== > RCS file: patches/patch-src_ode_src_lcp_cpp > diff -N patches/patch-src_ode_src_lcp_cpp > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ patches/patch-src_ode_src_lcp_cpp 28 Dec 2023 13:48:57 -0000 > @@ -0,0 +1,58 @@ > +Avoid conflict with ctype.h's _C and _L macros > + > +Index: src/ode/src/lcp.cpp > +--- src/ode/src/lcp.cpp.orig > ++++ src/ode/src/lcp.cpp > +@@ -274,7 +274,7 @@ void swapProblem (ATYPE A, dReal pairsbx[PBX__MAX], dR > + #ifdef DEBUG_LCP > + > + static > +-void checkFactorization (ATYPE A, dReal *_L, dReal *_d, > ++void checkFactorization (ATYPE A, dReal *_l, dReal *_d, > + unsigned nC, unsigned *C, unsigned nskip) > + { > + unsigned i, j; > +@@ -291,7 +291,7 @@ void checkFactorization (ATYPE A, dReal *_L, dReal *_d > + // printf ("A2=\n"); A2.print(); printf ("\n"); > + > + // compute A3 = L*D*L' > +- dMatrix L (nC, nC, _L, nskip, 1); > ++ dMatrix L (nC, nC, _l, nskip, 1); > + dMatrix D (nC, nC); > + for (i = 0; i < nC; i++) D(i, i) = 1.0 / _d[i]; > + L.clearUpperTriangle(); > +@@ -379,9 +379,9 @@ struct dLCP { > + unsigned *const m_p, *const m_C; > + > + dLCP (unsigned _n, unsigned _nskip, unsigned _nub, dReal *_Adata, dReal > *_pairsbx, dReal *_w, > +- dReal *_pairslh, dReal *_L, dReal *_d, > ++ dReal *_pairslh, dReal *_l, dReal *_d, > + dReal *_Dell, dReal *_ell, dReal *_tmp, > +- bool *_state, int *_findex, unsigned *_p, unsigned *_C, dReal > **Arows); > ++ bool *_state, int *_findex, unsigned *_p, unsigned *_c, dReal > **Arows); > + unsigned getNub() const { return m_nub; } > + void transfer_i_to_C (unsigned i); > + void transfer_i_to_N (unsigned /*i*/) { m_nN++; } // because we > can assume C and N span 1:i-1 > +@@ -409,9 +409,9 @@ struct dLCP { > + > + > + dLCP::dLCP (unsigned _n, unsigned _nskip, unsigned _nub, dReal *_Adata, > dReal *_pairsbx, dReal *_w, > +- dReal *_pairslh, dReal *_L, dReal *_d, > ++ dReal *_pairslh, dReal *_l, dReal *_d, > + dReal *_Dell, dReal *_ell, dReal *_tmp, > +- bool *_state, int *_findex, unsigned *_p, unsigned *_C, dReal > **Arows): > ++ bool *_state, int *_findex, unsigned *_p, unsigned *_c, dReal > **Arows): > + m_n(_n), m_nskip(_nskip), m_nub(_nub), m_nC(0), m_nN(0), > + # ifdef ROWPTRS > + m_A(Arows), > +@@ -419,8 +419,8 @@ dLCP::dLCP (unsigned _n, unsigned _nskip, unsigned _nu > + m_A(_Adata), > + #endif > + m_pairsbx(_pairsbx), m_w(_w), m_pairslh(_pairslh), > +- m_L(_L), m_d(_d), m_Dell(_Dell), m_ell(_ell), m_tmp(_tmp), > +- m_state(_state), m_findex(_findex), m_p(_p), m_C(_C) > ++ m_L(_l), m_d(_d), m_Dell(_Dell), m_ell(_ell), m_tmp(_tmp), > ++ m_state(_state), m_findex(_findex), m_p(_p), m_C(_c) > + { > + dxtSetZero<PBX__MAX>(m_pairsbx + PBX_X, m_n); > + Slightly unrelated, but I'm having a similar issue with a OrocosKDL[1] port I'm working on (port not attached as I'm using the phone, sorry). I opened an issue[2] where I posted the log of a build with GCC where you can see similar errors. Compiling with base clang returned the same " > error: expected ')'" errors though.
I did some research and I found a project that had a similar issue[3] (7 year old issue, so not sure it's still relevant). They fixed it by renaming the relevant macros which, to be honest, seems like a hacky solution to me. I've been meaning to try the same approach with the OrocosKDL port but I haven't had the time. [0] https://github.com/orocos/orocos_kinematics_dynamics [1] https://github.com/orocos/orocos_kinematics_dynamics/issues/454 [3] https://github.com/3dfxdev/EDGE/pull/29
