Skip to content
Jeffrey Carpenter edited this page Aug 21, 2026 · 37 revisions

scratchpad

nomlib-builder

docker images

  • i8degrees/nomlib-builder:0.13.1-amd64

  • i8degrees/nomlib-builder:0.13.1-amd64-libs

nomlib-builder

amd64/libs

  • cleanup after each build, i.e.:
    • make distclean || make clean

osx

  1. git clone git@github.com:i8degrees/nomlib.git
  2. download existing deps from nomlib.479831.xyz/frs -- common and osx
  3. extract to third-party/common and third-party/osx
  4. mkdir build && cd build
  5. cmake -DDEBUG=on -DDEBUG_ASSERT=on -DEXAMPLES=on -DNOM_BUILD_TESTS=off -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 -DCMAKE_INSTALL_PREFIX=$HOME/Library/Frameworks ..

x86_64-apple-darwin22.4-clang x86_64-apple-darwin22.4-clang++

windows

cmake -S $(pwd) -B $(pwd)/build --preset build-debug-clang-cl ...

clang-cl

linux

cmake -S $(pwd) -B $(pwd)/build --preset build-debug-clang-linux

cmake -S/app --preset debug-clang-linux
cmake --build /app/build/debug-clang-linux
cmake --build /app/build/debug-clang-linux --target help
cmake --build /app/build/debug-clang-linux --target device_info

macos

docker run --rm -it -v /home/jeff/Projects/nomlib.git:/app
-v nomlib-libs:/app/vendor
i8degrees/nomlib-builder:0.13.1-amd64-macos

cmake -S/app -B/app/build.osx.test.2 -DFRAMEWORK=off -DEXAMPLES=on
-DNOM_BUILD_TESTS=off -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9
-DCMAKE_TOOLCHAIN_FILE=/app/cmake/toolchains/osxcross.cmake
-DNOMLIB_DEPS_DIR=/app/third-party/osx
-DSDL2_LIBRARY=/app/third-party/osx/SDL2.framework
-DSDL2_INCLUDE_DIR=/app/third-party/osx/SDL2.framework/Headers/
-DSDL2_IMAGE_LIBRARY=/app/third-party/osx/SDL2_image.framework/
-DSDL2_IMAGE_INCLUDE_DIR=/app/third-party/osx/SDL2_image.framework/Headers
-DSDL2_TTF_LIBRARY=/app/third-party/osx/SDL2_ttf.framework/
-DSDL2_TTF_INCLUDE_DIR=/app/third-party/osx/SDL2_ttf.framework/Headers
-DLIBROCKET_CORE_LIBRARY=/app/third-party/osx/librocket/lib/libRocketCore.1.dylib
-DLIBROCKET_CONTROLS_LIBRARY=/app/third-party/osx/librocket/lib/libRocketControls.1.dylib
-DLIBROCKET_DEBUGGER_LIBRARY=/app/third-party/osx/librocket/lib/libRocketDebugger.1.dylib
-DLIBROCKET_CORE_INCLUDE_DIR=/app/third-party/osx/librocket/include
-DLIBROCKET_CONTROLS_INCLUDE_DIR=/app/third-party/osx/librocket/include
-DLIBROCKET_DEBUGGER_INCLUDE_DIR=/app/third-party/osx/librocket/include

SDL2_IMAGE_INCLUDE_DIR:PATH=/usr/local/osxcross/target/macports/pkgs/opt/local/include/SDL2/SDL_image.h SDL2_IMAGE_LIBRARY:FILEPATH=/usr/local/osxcross/target/macports/pkgs/opt/local/lib/libSDL2_image-2.0.0.dylib SDL2_INCLUDE_DIR:PATH=/usr/local/osxcross/target/macports/pkgs/opt/local/include/SDL2 SDL2_LIBRARY:STRING=/usr/local/osxcross/target/macports/pkgs/opt/local/lib/libSDL2.dylib SDL2_TTF_INCLUDE_DIR:PATH=/usr/local/osxcross/target/macports/pkgs/opt/local/include/SDL2/SDL_ttf.h SDL2_TTF_LIBRARY:FILEPATH=/usr/local/osxcross/target/macports/pkgs/opt/local/lib/libSDL2_ttf-2.0.0.dylib

MacOSX11.1.sdk

NOMLIB_DEPS_DIR=$2 # script arg
# "$HOME/Projects/nomlib.git/third-party/vcpkg_vendor.zip"
BUILD_DIR=$1 # script arg
# ~/Projects/nomlib.git/build/debug/
mkdir $BUILD_DIR && cd $BUILD_DIR
bsdtar -xf ~/Projects/nomlib.git/third-party/vcpkg_vendor.zip --strip-components 1

VCPKG_ROOT=/home/jeff/.local/share/vcpkg VCPKG_OVERLAY_PORTS=$VCPKG_ROOT/ports/librocket VCPKG_TARGET_TRIPLET=x64-linux CMAKE_TOOLCHAIN_FILE=/home/jeff/.local/share/vcpkg/scripts/buildsystems/vcpkg.cmake

  • fix link errors by investigating the API (diff) for the two method calls:
/usr/bin/ld: CMakeFiles/libRocketDataGridTest.dir/datagrid/CardsPageDataSource.cpp.o: undefined reference to symbol '_ZN6Rocket8Controls10DataSource15NotifyRowChangeERKNS_4Core10StringBaseIcEE'
/usr/bin/ld: /home/jeff/Projects/nomlib.git/build/release/vcpkg_installed/x64-linux-dynamic/lib/libRocketControls.so.1: error adding symbols: DSO missing from command line

/usr/bin/ld: CMakeFiles/libRocketTest.dir/libRocketTest.cpp.o: undefined reference to symbol '_ZN6Rocket4Core7Element11SetPropertyERKNS0_10StringBaseIcEERKNS0_8PropertyE'
/usr/bin/ld: /home/jeff/Projects/nomlib.git/build/release/vcpkg_installed/x64-linux-dynamic/lib/libRocketCore.so.1: error adding symbols: DSO missing from command line
  • investigate why libRocket is returning custom for its version

  • file bug for renderfont example, the given file path should be transformed into an absolute path, or we should append the current working directory to the path that is given;

    • add cwd.currentPath() to file path
  • file bug for resolving ImageDiffTest errors due to resources path; add + "tests" + p.native()

    • const std::string RESOURCES_PATH = cwd.currentPath() + p.native() + "Resources" + p.native() + "tests" + p.native() + "ImageDiffTest" + p.native();
  • We must rethink nom::init() with the automatic current working directory path being set is what produces errors like the above and also seen in nom_font exe and likely others

    • The existing implementation is correct for when the executable is executed from within an isolated bundle, i.e.: MacOSX application or framework, or AppImage / Flatpak, but otherwise breaks for when the exe is operating within a global filesystem space such as when running from a terminal

cmake -S . --preset release-static cmake -S . --preset release-dynamic

cmake --build build/release-static --target all cmake --build build/release-dynamic --target all

cmake --install build/release-static
--component Runtime --component Development --component Documentation
--component Core

cmake --install build/release-dynamic
--component Runtime --component Development --component Documentation
--component Core

  • move unused cmake modules at cmake/modules/ to Resources/CMake or so

  • remove cmake/toolchains/vcpkg.cmake

  • add init_nom_cmdline_args function using TCLAP (privately)

  • add example with three cmdline args -- input & output filename and rescale algo (hqx or scale2x) -- for rescaling an image

  • pull latest gamecontrollerdb.txt from db in a FetchContent call inside vendor/CMakeLists.txt and add it to Resources/SharedSupport for redistribution

  • add license to licenses

  • wiki.git/patches/microtar.cmake

  • wiki.git/patches/CPackConfig.cmake

  • see if this accomplishes what we want!

Automatically copy dependencies into the install target

directory for executables. Requires CMake 3.14

X_VCPKG_APPLOCAL_DEPS_INSTALL=ON

  • macosx VCPKG_PREFER_SYSTEM_LIBS=ON

  • we need to update our libRocket v1.3.0.1 fork by creating a patch that removes the i386 arch out of OSX_ARCHITECTURES in Build/CMakeLists.txt; we fail to build nomlib on our MacOSX buildbox when building libRocket as a dynamic shared library with the debug-dynamic-osx cmake preset

  • as part of the BUILD_DOCS option, we should consider adding adding the documentation files of (at minimum) tclap

  • file a bug report on our JSON serialization and de-serialization classes missing several top-level fields of vcpkg.json that can be seen in both the parsing output and when we save the output to a file -- testme.json -- as of this writing

  • append to the end of existing git sha 35f888a --

Thanks to our nom_jsonpp example, we caught a bug in the serialization of an array value within an object when trying to parse the inventory.json test file at Resources/tests/serializers/json/inventory.json.

build/debug-dyn/bin/nom_jsonpp build/debug-dyn/bin/inventory.json
ERROR: Could not serialize values; an array cannot exist within another array.
INFO: Stubbed function bool nom::JsonCppSerializer::write_object(const Value &, Json::Value &) const was called
ERROR: Could not serialize values; invalid object?
ERROR: Could not serialize the source object.
  • patches/JsonCppSerializer.patch

  • investigate why we do not see the unused param / function warnings on Linux whereas we do on MacOSX -- I believe that we must have the wrong CXX flag applied for this, or that some flag(s) are applied only under MacOSX?

  • consider adding the detected OS stamp for the platform when using the visual unit testing framework -- we could do this as a comment, or better yet, introduce a new field named os_stamp or such with an option for modifying it by the end-user

  • update our library targets back to using the full semantic version for the VERSION target property

  • update our unit test library targets back to using the full semantic version for the VERSION target property

  • relocate library targets from tests/CMakeLists.txt to src

    • tests/include -> include/nomlib/tests
    • tests/src/* -> tests
    • Resources/tests -> tests/Resources
  • integrate .clang-tidy and .clang-format

xcodebuild cflags

fmessage-length\=135 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit\=0 -fcolor-diagnostics -std\=c++11 -stdlib\=libc++ -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-return-type -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wno-float-conversion -Wno-non-literal-null-conversion -Wno-objc-literal-conversion -Wshorten-64-to-32 -Wno-newline-eof -Wno-c++11-extensions -Wno-implicit-fallthrough -DCMAKE_INTDIR\=\"Debug\" -Dnomlib_audio_EXPORTS -isysroot /Volumes/Developer/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk -fasm-blocks -fstrict-aliasing -Wdeprecated-declarations -Winvalid-offsetof -g -Wno-sign-conversion -Wno-infinite-recursion -Wno-move -Wno-comma -Wno-block-capture-autoreleasing -Wno-strict-prototypes -Wno-range-loop-analysis -Wno-semicolon-before-method-body

macosx xcode gen

[macosx] building nomlib examples (and probably tests) are broken when using xcode generator due to missing dependencies, i.e.: libSDL2-image late into the build cycle (post build copy phase). I believe that if we were to NOT copy the dependencies that are shown in examples/<nom_app_ex>/CMakeLists.txt when the Xcode generator is detected.

additionally, the code signing build phase appears to be failing, perhaps due to a lack of explicit setting like we do in the library targets (see framework properties setup)

once we finish the packaging scripts (cmake) for Darwin, most of these issues are expected to be resolved, or at least resolvable.

[macosx] building nomlib's tests are broken when using the Xcode generator due to an unknown mixup with googletest's static archive lib being filed as libgtestd.a whereas it should be libgtest.a - without the debug lib suffix.

  • macosx xcode gen issues described above are solved

  • waypipe --video hwenc --compress zstd ssh jeff@scorpio.home.arpa env SDL_VIDEODRIVER=wayland /home/jeff/Projects/nomlib.git/build/debug/bin/nom_GameOfLife

  • confirmation that nomlib can be compiled with g++ (GCC) 15.2.1 20260209 (on Manjaro KDE Linux)

    • cmake -S . --preset debug-dynamic -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=g++
  • create example that can be used to test spritesheets made with our custom exporter script made for TexturePacker

gdb

(gdb) set args -i Resources/tests/audio/ALAudioTest/audio-channel-front-center.wav
(gdb) break src/actions/PlayAudioSource.cpp:94
(gdb) break examples/nom_sfx/audio.cpp:324
(gdb) run
(gdb) bt full
Thread 1 "nom_sfx" hit Breakpoint 1.2, nom::PlayAudioSource::PlayAudioSource (this=0x5555555dc730, dev=0x5555558d3ed0,
    filename=0x55555559b150 "Resources/tests/audio/ALAudioTest/audio-channel-front-center.wav")
    at /home/jeff/Projects/nomlib.git/src/actions/PlayAudioSource.cpp:94
94      NOM_LOG_INFO(NOM_LOG_CATEGORY_APPLICATION, "elapsed_seconds: ", this->audible_[buffer_idx]->elapsed_seconds);
(gdb) print this->audible_
$1 = std::vector of length 33, capacity 64 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
  0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x5555558d5060}

(gdb) bt full
#0  nom::PlayAudioSource::PlayAudioSource (this=0x5555555dc730, dev=0x5555558d3ed0,
    filename=0x55555559b150 "Resources/tests/audio/ALAudioTest/audio-channel-front-center.wav")
    at /home/jeff/Projects/nomlib.git/src/actions/PlayAudioSource.cpp:94
        buffer = 0x5555558d5060
        buffer_idx = 0
        samples_per_second = 48000
        num_channels = 1
        channel_format = 3
        metadata = {frame_count = 68545, sample_count = 68545, sample_rate = 48000, channel_count = 1, duration = 1.42802083,
          total_bytes = 137090, channel_format = 3, seekable = true, tags = {title = 0x7ffff7efa1ac "",
            copyright = 0x7ffff7efa1ac "", software = 0x555555922dd8 "Lavf62.3.100 (libsndfile-1.2.2)", artist = 0x7ffff7efa1ac "",
            comment = 0x555555922dc0 "sound-theme-freedesktop", date = 0x7ffff7efa1ac "", album = 0x7ffff7efa1ac "",
            license = 0x7ffff7efa1ac "", track_number = 0x7ffff7efa1ac "", genre = 0x7ffff7efa1ac ""}}
#1  0x0000555555563a66 in nom::create_action<nom::PlayAudioSource, nom::audio::IOAudioEngine*&, char const*> (
    args=@0x7fffffffb280: 0x55555559b150 "Resources/tests/audio/ALAudioTest/audio-channel-front-center.wav",
    args=@0x7fffffffb280: 0x55555559b150 "Resources/tests/audio/ALAudioTest/audio-channel-front-center.wav")
    at /home/jeff/Projects/nomlib.git/include/nomlib/actions/IActionObject.hpp:231
No locals.
#2  0x000055555555fa1a in main (argc=3, argv=0x7fffffffcbb8) at /home/jeff/Projects/nomlib.git/examples/nom_sfx/audio.cpp:243
        args = {audio_input = "Resources/tests/audio/ALAudioTest/audio-channel-front-center.wav", use_null_interface = false,
          use_music_interface = false, audio_volume = 100, audio_loops = 1}
        audio_thread = {_M_id = {_M_thread = 0}}
        elapsed = {_vptr$Timer = 0x7ffff77fa970 <vtable for nom::Timer+16>, elapsed_ticks = 0, paused_ticks = 0,
          timer_paused = false, timer_started = false, static _vtable$ = <optimized out>}
        evt_handler = {events_ = std::deque with 0 elements, event_watchers_ = std::vector of length 0, capacity 0,
          max_events_count_ = 0, joystick_event_handler_ = 0x0, joystick_event_type_ = nom::EventHandler::NO_EVENT_HANDLER}
        request = {name = 0x0, engine = 0x55555557625e "openal", sample_rate = 44100, num_mono_sources = 128,
          num_stereo_sources = 127, refresh_rate = 0, sync_context = false, flags = 0}
        dev = 0x5555558d3ed0
        buffer = 0x5555555dc030
        RES_FILENAME = 0x5555555761e4 "audio.json"
        master_gain = 100
        pitch = 1
        audio_pos = {static null = {static null = <same as static member of an already seen type>, static zero = {
              static null = <same as static member of an already seen type>,
              static zero = <same as static member of an already seen type>, x = 0, y = 0, z = 0}, x = -1, y = -1, z = -1},
          static zero = <same as static member of an already seen type>, x = 0, y = 0, z = 0}
        audio_velocity = {static null = {static null = <same as static member of an already seen type>, static zero = {
              static null = <same as static member of an already seen type>,
              static zero = <same as static member of an already seen type>, x = 0, y = 0, z = 0}, x = -1, y = -1, z = -1},
          static zero = <same as static member of an already seen type>, x = 0, y = 0, z = 0}
        ACTION_FADE_DISPLACEMENT = 100
        ACTION_DURATION = 1
        ACTION_TIMING_CURVE = {<std::_Maybe_unary_or_binary_function<float, float, float, float, float>> = {<No data fields>}, <std::_Function_base> = {static _M_max_size = 16, static _M_max_align = 8, _M_functor = {_M_unused = {
                _M_object = 0x7ffff7f5ef40 <nom::Linear::ease_in(float, float, float, float)>,
                _M_const_object = 0x7ffff7f5ef40 <nom::Linear::ease_in(float, float, float, float)>,
                _M_function_pointer = 0x7ffff7f5ef40 <nom::Linear::ease_in(float, float, float, float)>,
                _M_member_pointer = (void (std::_Undefined_class::*)(std::_Undefined_class * const)) 0x7ffff7f5ef40 <nom::Linear::ease_in(float, float, float, float)>}, _M_pod_data = "@\357\365\367\377\177\000\000\000\000\000\000\000\000\000"},
            _M_manager = 0x7ffff7f63290 <std::_Function_handler<float (float, float, float, float), float (*)(float, float, float, float)>::_M_manager(std::_Any_data&, std::_Any_data const&, std::_Manager_operation)>},
          _M_invoker = 0x7ffff7f63240 <std::_Function_handler<float (float, float, float, float), float (*)(float, float, float, float)>::_M_invoke(std::_Any_data const&, float&&, float&&, float&&, float&&)>}
        ACTION_SPEED = 1
        audio_player = {static DEBUG_CLASS_NAME = 0x7ffff7f9a32d "[ActionPlayer]:", player_state_ = nom::ActionPlayer::RUNNING,
          actions_ = std::map with 0 elements, free_list_ = std::deque with 0 elements}
        playback_action = <error reading variable: Cannot access memory at address 0x12>
        last_delta = 32767
        playback_state = 4155468423
        info = {frame_count = 15, sample_count = 140737348856578, sample_rate = 4153084935, channel_count = 32767,
          duration = 2.1019477e-44, total_bytes = 140737348856594, channel_format = 4153085187, seekable = 255, tags = {
            title = 0xe <error: Cannot access memory at address 0xe>, copyright = 0x7ffff7af6b22 "alGetListeneri",
            software = 0x7ffff78b0ddf <alGetListeneri(ALenum, ALint*)> "UH\211\345H\203\3540\211}\334H\211u\320dH\213\004%(",
            artist = 0xf <error: Cannot access memory at address 0xf>, comment = 0x7ffff7af6b31 "alGetListener3i",
            date = 0x7ffff78b0ebb <alGetListener3i(ALenum, ALint*, ALint*, ALint*)> "UH\211\345H\203\354@\211}\334H\211u\320H\211U\310H\211M\300dH\213\004%(", album = 0xf <error: Cannot access memory at address 0xf>, license = 0x7ffff7af6b41 "alGetListeneriv",
            track_number = 0x7ffff78b0fb7 <alGetListeneriv(ALenum, ALint*)> "UH\211\345H\203\3540\211}\334H\211u\320dH\213\004%(",
            genre = 0xc <error: Cannot access memory at address 0xc>}}
        playback_pos = 4.59163468e-41
        playback_eof = false
# using laura_ff1-s16.wav, a 93.995s sound source for streaming
Thread 1 "nom_sfx" hit Breakpoint 2, main (argc=3, argv=0x7fffffffcbc8)
    at /home/jeff/Projects/nomlib.git/examples/nom_sfx/audio.cpp:324
324         audio_player.update(elapsed_delta);
(gdb) c
Continuing.
[ALSOFT] (EE) Wait timeout... buffer size too low?
INFO: !! NULLPTR !!
INFO: [PlayAudioSource]: BEGIN at 0

Thread 1 "nom_sfx" hit Breakpoint 1, nom::PlayAudioSource::next_frame (this=0x5555555dc720, delta_time=0)
    at /home/jeff/Projects/nomlib.git/src/actions/PlayAudioSource.cpp:229
229       return this->update(delta_time, 0.0f, 0.0f, this->duration());
(gdb) c
Continuing.
[ALSOFT] (EE) Wait timeout... buffer size too low?

Thread 1 "nom_sfx" received signal SIGSEGV, Segmentation fault.
0x00007ffff7f965ca in nom::PlayAudioSource::update (this=0x5555555dc720, t=0, b=0 '\000', c=0, d=93.9943771)
    at /home/jeff/Projects/nomlib.git/src/actions/PlayAudioSource.cpp:160
160       int16* samples = NOM_SCAST(int16*, this->audible_[current_frame]->samples);

ttcards

static build

libRocket_DIR=/home/jeff/Projects/nomlib.git/build/release/vcpkg_installed/x64-linux/share/libRocket
nomlib_DIR=/usr/local/lib/cmake/nomlib
cmake --preset debug-clang \
    -DCMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake \
    -DVCPKG_OVERLAY_PORTS=$HOME/Projects/vcpkg-ports.git/ports

dynamic build

libRocket_DIR=/home/jeff/Projects/nomlib.git/build/release-dynamic/vcpkg_installed/x64-linux-dynamic/share/libRocket
nomlib_DIR=/usr/local/lib/cmake/nomlib
cmake --preset debug-clang \
    -DCMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake \
    -DVCPKG_OVERLAY_PORTS=$HOME/Projects/vcpkg-ports.git/ports

mkdir build && cd build cmake .. -G "Visual Studio 17 2022" -T "ClangCL" cmake --build . --config Release

NOMLIB_RESOURCES_DIR -> NOM_EXAMPLES_RESOURCES_DIR
NOM_EXAMPLES_RESOURCES_DIR -> ${PROJECT_SOURCE_DIR}/Resources/examples
EXAMPLES_INSTALL_DIR -> "${CMAKE_INSTALL_DATAROOTDIR}/nomlib"
NOMLIB_SHARED_SUPPORT_DIR -> ${PROJECT_SOURCE_DIR}/Resources/SharedSupport

NOM_TESTS_RESOURCES_DIR -> ${PROJECT_SOURCE_DIR}/Resources/tests
cloc . --config=.clocsettings --yaml --report=report.yaml

additional tools

Clone this wiki locally