Skip to content

Generated interrogate wrapper is not deterministic on macOS #1651

Description

@el-dee

Description

On macOS, the generated interrogate_wrapper.cpp is not deterministic, leading to a non-reproducible build. On Linux, the exact same build is perfectly reproductible

Steps to Reproduce

Interrogate is called with the following parameters (I removed the app include directories and files for clarity):

/Library/Developer/Panda3D/bin/interrogate -v -fnames -string -refcount -assert -python-native -S/Library/Developer/Panda3D/include/parser-inc -S/Library/Developer/Panda3D/include/ -srcdir . -oc interrogate_wrapper.cpp -od interrogate.in -module cosmonium_engine -library cosmonium_engine -nomangle -DINTERROGATE -DCPPPARSER -D__STDC__=1 -D__cplusplus=201103L files....files

SOURCE_DATE_EPOCH is set to a static value and PYTHONHASHSEED is set to 0

The diff of two generated interrogate_wrapper.cpp is as follow :

diff -r source-old/interrogate_wrapper.cpp source/interrogate_wrapper.cpp
1470,1471d1469
<   {"CollisionHandlerQueue", nullptr},
< #define Dtool_Ptr_CollisionHandlerQueue (imports[0].type)
1473c1471,1473
< #define Dtool_Ptr_CollisionEntry (imports[1].type)
---
> #define Dtool_Ptr_CollisionEntry (imports[0].type)
>   {"CollisionHandlerQueue", nullptr},
> #define Dtool_Ptr_CollisionHandlerQueue (imports[1].type)
1478,1479d1477
<   {"BoundingBox", nullptr},
< #define Dtool_Ptr_BoundingBox (imports[4].type)
1481c1479,1481
< #define Dtool_Ptr_NodePathCollection (imports[5].type)
---
> #define Dtool_Ptr_NodePathCollection (imports[4].type)
>   {"BoundingBox", nullptr},
> #define Dtool_Ptr_BoundingBox (imports[5].type)
1496,1497d1495
<   {"LPoint2d", nullptr},
< #define Dtool_Ptr_LPoint2d (imports[13].type)
1499c1497,1499
< #define Dtool_Ptr_LVector3d (imports[14].type)
---
> #define Dtool_Ptr_LVector3d (imports[13].type)
>   {"LQuaterniond", nullptr},
> #define Dtool_Ptr_LQuaterniond (imports[14].type)
1501a1502,1505
>   {"LMatrix4d", nullptr},
> #define Dtool_Ptr_LMatrix4d (imports[16].type)
>   {"LPoint2d", nullptr},
> #define Dtool_Ptr_LPoint2d (imports[17].type)
1503,1505c1507
< #define Dtool_Ptr_LVecBase4i (imports[16].type)
<   {"LQuaterniond", nullptr},
< #define Dtool_Ptr_LQuaterniond (imports[17].type)
---
> #define Dtool_Ptr_LVecBase4i (imports[18].type)
1507,1509c1509
< #define Dtool_Ptr_LVecBase4d (imports[18].type)
<   {"LMatrix4d", nullptr},
< #define Dtool_Ptr_LMatrix4d (imports[19].type)
---
> #define Dtool_Ptr_LVecBase4d (imports[19].type)
1516,1521d1515
< // CollisionHandlerQueue
< #ifndef LINK_ALL_STATIC
< #else
< extern struct Dtool_PyTypedObject Dtool_CollisionHandlerQueue;
< static struct Dtool_PyTypedObject *const Dtool_Ptr_CollisionHandlerQueue = &Dtool_CollisionHandlerQueue;
< #endif
1527a1522,1527
> // CollisionHandlerQueue
> #ifndef LINK_ALL_STATIC
> #else
> extern struct Dtool_PyTypedObject Dtool_CollisionHandlerQueue;
> static struct Dtool_PyTypedObject *const Dtool_Ptr_CollisionHandlerQueue = &Dtool_CollisionHandlerQueue;
> #endif
1540,1545d1539
< // BoundingBox
< #ifndef LINK_ALL_STATIC
< #else
< extern struct Dtool_PyTypedObject Dtool_BoundingBox;
< static struct Dtool_PyTypedObject *const Dtool_Ptr_BoundingBox = &Dtool_BoundingBox;
< #endif
1557a1552,1557
> // BoundingBox
> #ifndef LINK_ALL_STATIC
> #else
> extern struct Dtool_PyTypedObject Dtool_BoundingBox;
> static struct Dtool_PyTypedObject *const Dtool_Ptr_BoundingBox = &Dtool_BoundingBox;
> #endif
1606,1617d1605
< // LPoint2d
< #ifndef LINK_ALL_STATIC
< inline static LPoint2d *Dtool_Coerce_LPoint2d(PyObject *args, LPoint2d &coerced) {
<   nassertr(Dtool_Ptr_LPoint2d != nullptr, nullptr);
<   nassertr(Dtool_Ptr_LPoint2d->_Dtool_Coerce != nullptr, nullptr);
<   return ((LPoint2d *(*)(PyObject *, LPoint2d &))Dtool_Ptr_LPoint2d->_Dtool_Coerce)(args, coerced);
< }
< #else
< extern struct Dtool_PyTypedObject Dtool_LPoint2d;
< static struct Dtool_PyTypedObject *const Dtool_Ptr_LPoint2d = &Dtool_LPoint2d;
< extern LPoint2d *Dtool_Coerce_LPoint2d(PyObject *args, LPoint2d &coerced);
< #endif
1629a1618,1629
> // LQuaterniond
> #ifndef LINK_ALL_STATIC
> inline static LQuaterniond *Dtool_Coerce_LQuaterniond(PyObject *args, LQuaterniond &coerced) {
>   nassertr(Dtool_Ptr_LQuaterniond != nullptr, nullptr);
>   nassertr(Dtool_Ptr_LQuaterniond->_Dtool_Coerce != nullptr, nullptr);
>   return ((LQuaterniond *(*)(PyObject *, LQuaterniond &))Dtool_Ptr_LQuaterniond->_Dtool_Coerce)(args, coerced);
> }
> #else
> extern struct Dtool_PyTypedObject Dtool_LQuaterniond;
> static struct Dtool_PyTypedObject *const Dtool_Ptr_LQuaterniond = &Dtool_LQuaterniond;
> extern LQuaterniond *Dtool_Coerce_LQuaterniond(PyObject *args, LQuaterniond &coerced);
> #endif
1641a1642,1665
> // LMatrix4d
> #ifndef LINK_ALL_STATIC
> inline static LMatrix4d *Dtool_Coerce_LMatrix4d(PyObject *args, LMatrix4d &coerced) {
>   nassertr(Dtool_Ptr_LMatrix4d != nullptr, nullptr);
>   nassertr(Dtool_Ptr_LMatrix4d->_Dtool_Coerce != nullptr, nullptr);
>   return ((LMatrix4d *(*)(PyObject *, LMatrix4d &))Dtool_Ptr_LMatrix4d->_Dtool_Coerce)(args, coerced);
> }
> #else
> extern struct Dtool_PyTypedObject Dtool_LMatrix4d;
> static struct Dtool_PyTypedObject *const Dtool_Ptr_LMatrix4d = &Dtool_LMatrix4d;
> extern LMatrix4d *Dtool_Coerce_LMatrix4d(PyObject *args, LMatrix4d &coerced);
> #endif
> // LPoint2d
> #ifndef LINK_ALL_STATIC
> inline static LPoint2d *Dtool_Coerce_LPoint2d(PyObject *args, LPoint2d &coerced) {
>   nassertr(Dtool_Ptr_LPoint2d != nullptr, nullptr);
>   nassertr(Dtool_Ptr_LPoint2d->_Dtool_Coerce != nullptr, nullptr);
>   return ((LPoint2d *(*)(PyObject *, LPoint2d &))Dtool_Ptr_LPoint2d->_Dtool_Coerce)(args, coerced);
> }
> #else
> extern struct Dtool_PyTypedObject Dtool_LPoint2d;
> static struct Dtool_PyTypedObject *const Dtool_Ptr_LPoint2d = &Dtool_LPoint2d;
> extern LPoint2d *Dtool_Coerce_LPoint2d(PyObject *args, LPoint2d &coerced);
> #endif
1654,1665d1677
< // LQuaterniond
< #ifndef LINK_ALL_STATIC
< inline static LQuaterniond *Dtool_Coerce_LQuaterniond(PyObject *args, LQuaterniond &coerced) {
<   nassertr(Dtool_Ptr_LQuaterniond != nullptr, nullptr);
<   nassertr(Dtool_Ptr_LQuaterniond->_Dtool_Coerce != nullptr, nullptr);
<   return ((LQuaterniond *(*)(PyObject *, LQuaterniond &))Dtool_Ptr_LQuaterniond->_Dtool_Coerce)(args, coerced);
< }
< #else
< extern struct Dtool_PyTypedObject Dtool_LQuaterniond;
< static struct Dtool_PyTypedObject *const Dtool_Ptr_LQuaterniond = &Dtool_LQuaterniond;
< extern LQuaterniond *Dtool_Coerce_LQuaterniond(PyObject *args, LQuaterniond &coerced);
< #endif
1677,1688d1688
< #endif
< // LMatrix4d
< #ifndef LINK_ALL_STATIC
< inline static LMatrix4d *Dtool_Coerce_LMatrix4d(PyObject *args, LMatrix4d &coerced) {
<   nassertr(Dtool_Ptr_LMatrix4d != nullptr, nullptr);
<   nassertr(Dtool_Ptr_LMatrix4d->_Dtool_Coerce != nullptr, nullptr);
<   return ((LMatrix4d *(*)(PyObject *, LMatrix4d &))Dtool_Ptr_LMatrix4d->_Dtool_Coerce)(args, coerced);
< }
< #else
< extern struct Dtool_PyTypedObject Dtool_LMatrix4d;
< static struct Dtool_PyTypedObject *const Dtool_Ptr_LMatrix4d = &Dtool_LMatrix4d;
< extern LMatrix4d *Dtool_Coerce_LMatrix4d(PyObject *args, LMatrix4d &coerced);

and the resulting .o files are different (A diff using objdump -d reveals different offsets)

Environment

  • Operating system: mac0S 14.1
  • System architecture: x86_64
  • Panda3D version: d9052ba
  • Installation method: built from source
  • Python version (if using Python): N/A
  • Compiler (if using C++): Xcode 15 (AppleClang 15.0.0.15000309)

Metadata

Metadata

Assignees

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions