Skip to content

[util] Remove patch that results in building with NDEBUG causing ODR issues#8539

Merged
PeterJohnson merged 1 commit intowpilibsuite:2027from
bzlmodRio:remove_ndebug_patch
Jan 3, 2026
Merged

[util] Remove patch that results in building with NDEBUG causing ODR issues#8539
PeterJohnson merged 1 commit intowpilibsuite:2027from
bzlmodRio:remove_ndebug_patch

Conversation

@pjreiniger
Copy link
Contributor

This was discovered by @virtuald when trying to build robotpy.

Semiwrap / meson / robotpy define NDEBUG when building their software in all modes, while allwplib only does it when building debug. This causes the size of DenseMap to differ between the shared libraries built here, and the extension modules built in mostrobotpy, causing segfaults when you try to execute code that uses DenseMap. This is not a problem with the robotpy code in allwpilib, because bazel uses the exact same compiler flags when building the shared libraries and pybind11 extensions. #TeamBuildEverythingFromSource

Some offline chats:


class Foo(wpilib.OpModeRobotBase):
    pass

f = Foo()
sz = f.getSize()
pysz = f.pyGetSize()

print("sizes", sz, pysz)

I added a getSize to wpilib and to semiwrap and recompiled it and it prints out:
sizes 136 128

hm, the problem is in DenseMap:
wpilib
Total 136
m_opModes: offset=16 size=32
m_notifier: offset=48 size=8
m_opModeMutex: offset=56 size=64
m_activeOpMode: offset=120 size=16
python
Total 128
m_opModes: offset=16 size=24
m_notifier: offset=40 size=8
m_opModeMutex: offset=48 size=64
m_activeOpMode: offset=112 size=16

@PeterJohnson PeterJohnson merged commit 32cd2dd into wpilibsuite:2027 Jan 3, 2026
45 checks passed
@pjreiniger pjreiniger deleted the remove_ndebug_patch branch January 15, 2026 06:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2027 2027 target component: wpiutil Utility library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants