From 1a578d9a3c08e9f9d6a7bdae4118985d0ef3cf8a Mon Sep 17 00:00:00 2001 From: SWS-Chipkin Date: Thu, 3 Dec 2026 13:11:53 -0700 Subject: [PATCH 1/2] Update CAS BACnet Stack submodule to 6.x 83e04a2d (6.1.2) --- CHANGELOG.md | 4 ++++ submodules/cas-bacnet-stack | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b7cef7b..7e7262a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this example. The format is based on ## [Unreleased] +### Changed + +- Updated to CAS BACnet Stack 6.x `83e04a2d` (6.1.2, 2026-12-02). + ## [1.2.1] - 2026-11-02 Built on CAS BACnet Stack 6.x (`1e7dffe2b`). diff --git a/submodules/cas-bacnet-stack b/submodules/cas-bacnet-stack index 1e7dffe..83e04a2 160000 --- a/submodules/cas-bacnet-stack +++ b/submodules/cas-bacnet-stack @@ -1 +1 @@ -Subproject commit 1e7dffe2b8f4c2e74463e78749653abe2d4c85da +Subproject commit 83e04a2d9bbc8ec944c2474eac906f65e8a08a66 From beeeb947d80211891d600ce956af3bfedb25697b Mon Sep 17 00:00:00 2001 From: SWS-Chipkin Date: Thu, 3 Dec 2026 19:52:54 -0700 Subject: [PATCH 2/2] Find the stack library in the submodule's dist/ (stack 6.1.2 moved it from bin/) Stack 6.1.2 (#5077) installs the library into dist/ instead of bin/, so the CI workflow failed after the stack build and the example could not find the library at run time. The workflow, the run-time search and the docs now use dist/. CHANGELOG updated. --- .github/workflows/release.yml | 16 ++++++++-------- .gitignore | 2 +- AGENTS.md | 6 +++--- CHANGELOG.md | 1 + README.md | 16 ++++++++-------- TUTORIAL.md | 2 +- cgobridge/stack.go | 10 +++++----- cgobridge/stack_adapter.c | 2 +- main.go | 2 +- 9 files changed, 29 insertions(+), 28 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a37388e..171e83f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,11 +3,11 @@ # publishing. # # Two stages: (1) build the CAS BACnet Stack shared library from the stack submodule into -# submodules/cas-bacnet-stack/bin/ with the stack's CMake, its only build (the windows-x64-dll -# preset on Windows, linux-x64-release-shared on Linux, then `cmake --install` into bin/ - +# submodules/cas-bacnet-stack/dist/ with the stack's CMake, its only build (the windows-x64-dll +# preset on Windows, linux-x64-release-shared on Linux, then `cmake --install` into dist/ - # README "Build"), then (2) `go build` this project with cgo. The executable loads the library # at run time (the stack's own adapter in DLL mode): it has no load-time dependency on it, and -# finds it next to itself or, in this checkout, in submodules/cas-bacnet-stack/bin/. +# finds it next to itself or, in this checkout, in submodules/cas-bacnet-stack/dist/. # # THE STACK LIBRARY IS NEVER RELEASED. It is built here only to compile and test the example. # A release ships the example's executable and docs; the "Package" step fails if any @@ -77,7 +77,7 @@ jobs: install: mingw-w64-x86_64-gcc path-type: inherit - - name: Build the CAS BACnet Stack library (Windows - CMake preset windows-x64-dll, into the submodule's bin/) + - name: Build the CAS BACnet Stack library (Windows - CMake preset windows-x64-dll, into the submodule's dist/) if: runner.os == 'Windows' shell: pwsh working-directory: submodules/cas-bacnet-stack @@ -88,9 +88,9 @@ jobs: if ($LASTEXITCODE -ne 0) { throw "windows-x64-dll build failed" } cmake --install build-windows-x64-dll --config Release if ($LASTEXITCODE -ne 0) { throw "windows-x64-dll install failed" } - Get-ChildItem bin\CASBACnetStack_x64_Release.dll + Get-ChildItem dist\CASBACnetStack_x64_Release.dll - - name: Build the CAS BACnet Stack library (Linux - CMake preset linux-x64-release-shared, into the submodule's bin/) + - name: Build the CAS BACnet Stack library (Linux - CMake preset linux-x64-release-shared, into the submodule's dist/) if: runner.os == 'Linux' shell: bash working-directory: submodules/cas-bacnet-stack @@ -100,7 +100,7 @@ jobs: cmake --preset linux-x64-release-shared cmake --build --preset linux-x64-release-shared cmake --install build-linux-x64-release-shared - ls -la bin/libCASBACnetStack_x64_Release.so + ls -la dist/libCASBACnetStack_x64_Release.so - name: go vet + go build (CGO_ENABLED=1) shell: bash @@ -174,7 +174,7 @@ jobs: # Rule 2b: the released executable, run where there is no stack library, must say so # clearly and exit 1 - never an OS loader error. It runs from an empty folder outside - # this checkout, so the development fallback (submodules/cas-bacnet-stack/bin/) is not found. + # this checkout, so the development fallback (submodules/cas-bacnet-stack/dist/) is not found. - name: Packaged executable without the stack library - clear message, exit 1 shell: bash run: | diff --git a/.gitignore b/.gitignore index c4c1e46..f4720f3 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,7 @@ bacnet-b-ss-go *.out # The CAS BACnet Stack library is never committed (and never released): build it -# from the submodule into submodules/cas-bacnet-stack/bin/ (README "Build"). +# from the submodule into submodules/cas-bacnet-stack/dist/ (README "Build"). *.dll *.so *.so.* diff --git a/AGENTS.md b/AGENTS.md index 2a9ef13..62497c1 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -67,11 +67,11 @@ go vet . ./cgobridge ./common `go build` does not build the stack's shared library - that is the separate CMake step in README "Build". CMake is the stack's only build: it no longer has `projects/msvs/` or `projects/linux/` (removed before `6.x` @ `29b83de6`). -`cmake --install` puts the library in the submodule's `bin/`, where the example +`cmake --install` puts the library in the submodule's `dist/`, where the example loads it from. Always a customer-interface build, never the test-tool library. A gcc must be on `PATH` for cgo (MinGW-w64 on Windows). Do not use `./...`: it walks into the submodule's own Go files. **Never commit or release the stack's -DLL / `.so`** - it lives in the submodule's `bin/` (gitignored there), and +DLL / `.so`** - it lives in the submodule's `dist/` (gitignored there), and `git ls-files | grep -iE '\.(dll|so|node|lib|a)$'` must print nothing. ## Run @@ -82,7 +82,7 @@ DLL / `.so`** - it lives in the submodule's `bin/` (gitignored there), and The stack library is loaded at run time (the stack's `adapters/cpp/` in DLL mode, compiled in place by `cgobridge/stack_adapter.c`) from the executable's folder, -else from `submodules/cas-bacnet-stack/bin/`; without it the program prints the +else from `submodules/cas-bacnet-stack/dist/`; without it the program prints the series' missing-library message (rule 2b) and exits 1. Interactive commands: `h`, `q`, `u`, `d`, each followed by Enter. diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e7262a..ea04fbd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ All notable changes to this example. The format is based on ### Changed - Updated to CAS BACnet Stack 6.x `83e04a2d` (6.1.2, 2026-12-02). +- The stack library is now found in the submodule's `dist/` folder, where 6.1.2's `cmake --install` puts it (it was `bin/`). The CI workflow, the run-time search and the build instructions all use `dist/`. ## [1.2.1] - 2026-11-02 diff --git a/README.md b/README.md index 13d28b4..e33a54a 100644 --- a/README.md +++ b/README.md @@ -171,7 +171,7 @@ This is a **self-contained** project. It ships: - `submodules/cas-bacnet-stack/` - the **CAS BACnet Stack as a git submodule** (private; requires a license - see above). cgo includes its `source/CASBACnetStackDLL.h` in place; its CMake build produces the shared - library, which `cmake --install` puts in its own `bin/` folder. + library, which `cmake --install` puts in its own `dist/` folder. ## Prerequisites @@ -199,7 +199,7 @@ Already cloned without `--recursive`? Run `git submodule update --init --recursi ### 1. Build the CAS BACnet Stack library from the submodule -The library goes into the submodule's own `bin/` folder, where the example +The library goes into the submodule's own `dist/` folder, where the example finds it at run time when it is run from this checkout. Do not commit it to this repository (it is gitignored, and never part of a release). @@ -207,7 +207,7 @@ The stack has **one build, CMake** (`CMakeLists.txt` and `CMakePresets.json` in the submodule; its README's "Building and testing" and AGENTS.md "Building" list the presets). Each preset builds into `submodules/cas-bacnet-stack/build-/`, and `cmake --install -build-` copies the library into the submodule's `bin/`, under exactly +build-` copies the library into the submodule's `dist/`, under exactly the name the example loads. It is a customer-interface build (no test-tool exports). Run the commands from the submodule's folder, because `cmake --preset` reads `CMakePresets.json` from the current directory. @@ -220,7 +220,7 @@ Visual Studio 2022). PowerShell or a Developer Prompt: cd submodules\cas-bacnet-stack cmake --preset windows-x64-dll cmake --build --preset windows-x64-dll-release -cmake --install build-windows-x64-dll --config Release # -> bin\CASBACnetStack_x64_Release.dll +cmake --install build-windows-x64-dll --config Release # -> dist\CASBACnetStack_x64_Release.dll cd ..\.. ``` @@ -234,11 +234,11 @@ static-library name and stays in the build tree; the example does not need it cd submodules/cas-bacnet-stack cmake --preset linux-x64-release-shared cmake --build --preset linux-x64-release-shared -cmake --install build-linux-x64-release-shared # -> bin/libCASBACnetStack_x64_Release.so +cmake --install build-linux-x64-release-shared # -> dist/libCASBACnetStack_x64_Release.so cd ../.. ``` -The stack's own `.gitignore` already ignores `build-*/` and `bin/`, so the +The stack's own `.gitignore` already ignores `build-*/` and `dist/`, so the submodule stays clean. Only the **Release** library is used: the adapter loads `CASBACnetStack_x64_Release` (`BACNET_LIB_FILE`). @@ -267,7 +267,7 @@ The executable loads the stack library at run time (not the operating system at start-up), from the first of these folders that has it: 1. the **run directory** - the folder that holds the executable; -2. in a development checkout, `submodules/cas-bacnet-stack/bin/` (found by +2. in a development checkout, `submodules/cas-bacnet-stack/dist/` (found by looking upwards from the executable's folder) - so `build/BACnetExampleBSS` in this checkout needs no set-up. @@ -382,7 +382,7 @@ The scripts are the C++ edition's `tests/`, with this port's default port | `failure_modes_test.py` | **The Failure Modes.** Breaks the simulated sensor wire: `Reliability` `open-loop`, `Status_Flags` FAULT, a frozen reading; repairs it: all clear, the reading moves. Then the errors for an unknown object / property / array index, and the Reject for a WriteProperty. | Run them all after the build (the executable finds the library in the -submodule's `bin/`, see [Run](#run)): +submodule's `dist/`, see [Run](#run)): ```bash python tests/run_wire_tests.py # default --exe build/BACnetExampleBSS(.exe), --port 47822 diff --git a/TUTORIAL.md b/TUTORIAL.md index 81bb127..01d5cf4 100644 --- a/TUTORIAL.md +++ b/TUTORIAL.md @@ -233,7 +233,7 @@ callbacks in `property_dispatch.go`.) | Symptom | Cause / fix | |---------|-------------| -| `ERROR: This example cannot run without the CAS BACnet Stack library.` (exit code 1) | The stack library is in none of the folders the message lists. Build it from the submodule (README "Build", step 1) and put it next to the executable, or run the executable from this checkout (it also looks in `submodules/cas-bacnet-stack/bin/`). | +| `ERROR: This example cannot run without the CAS BACnet Stack library.` (exit code 1) | The stack library is in none of the folders the message lists. Build it from the submodule (README "Build", step 1) and put it next to the executable, or run the executable from this checkout (it also looks in `submodules/cas-bacnet-stack/dist/`). | | `Error: failed to load the CAS BACnet Stack from : ...` | The library was found but could not be used: a different architecture (it must be x64), a stack from another major version (`stack API major version ...`), or a missing export (`missing export: ...` - a wrong or corrupt build). Rebuild it from the submodule at this Stack Pin. | | `go build`: `cgo: C compiler "gcc" not found` | cgo needs a gcc. On Windows install MinGW-w64 (MSYS2) and put its `bin` on `PATH`. | | `go build`: `CASBACnetStackDLL.h: No such file or directory` | Submodules not checked out: `git submodule update --init --recursive`. | diff --git a/cgobridge/stack.go b/cgobridge/stack.go index 3a6c197..7446f86 100644 --- a/cgobridge/stack.go +++ b/cgobridge/stack.go @@ -14,7 +14,7 @@ // BACnet Stack"). Nothing from the stack is copied into this repository. // // FindStackLibrary() looks for the library in the executable's folder first, -// then, for a development checkout, in submodules/cas-bacnet-stack/bin/ above +// then, for a development checkout, in submodules/cas-bacnet-stack/dist/ above // it (where README "Build" builds it). // // cgo cannot call a C function-pointer variable from Go, so each stack call @@ -79,7 +79,7 @@ func StackLibraryFileName() string { // FindStackLibrary looks for the stack library in the run directory (the // folder that holds this executable) and then, for a development checkout, in -// submodules/cas-bacnet-stack/bin/ in that folder or one of its parents. +// submodules/cas-bacnet-stack/dist/ in that folder or one of its parents. // It returns the folder it was found in ("" if none) and every folder it // looked in, in order. func FindStackLibrary() (found string, searched []string) { @@ -94,9 +94,9 @@ func FindStackLibrary() (found string, searched []string) { runDirectory := filepath.Dir(executable) candidates = append(candidates, runDirectory) for directory, level := runDirectory, 0; level < 3; level++ { - bin := filepath.Join(directory, "submodules", "cas-bacnet-stack", "bin") - if info, err := os.Stat(bin); err == nil && info.IsDir() { - candidates = append(candidates, bin) + dist := filepath.Join(directory, "submodules", "cas-bacnet-stack", "dist") + if info, err := os.Stat(dist); err == nil && info.IsDir() { + candidates = append(candidates, dist) break } parent := filepath.Dir(directory) diff --git a/cgobridge/stack_adapter.c b/cgobridge/stack_adapter.c index 622890f..7c2f368 100644 --- a/cgobridge/stack_adapter.c +++ b/cgobridge/stack_adapter.c @@ -24,7 +24,7 @@ // Where the library is loaded from: the adapter opens BACNET_LIB_FILE. // - Windows: the default, the bare name "CASBACnetStack_x64_Release.dll", which // LoadLibrary looks for in the executable's folder first. For the submodule -// bin/ fallback, cgobridge_load_stack() adds that folder with SetDllDirectory. +// dist/ fallback, cgobridge_load_stack() adds that folder with SetDllDirectory. // - Linux: the default is "./libCASBACnetStack_x64_Release.so", relative to the // CURRENT directory, not the executable's - so this file defines // BACNET_LIB_FILE (the adapter's documented override) as the full path the diff --git a/main.go b/main.go index b1dcb2f..30103ae 100644 --- a/main.go +++ b/main.go @@ -260,7 +260,7 @@ func run() int { // does not include. It is loaded at run time (cgobridge, through the stack's // own adapter in DLL mode - LoadBACnetFunctions() in the C++ edition), from // the folder that holds this executable or, in a development checkout, from - // submodules/cas-bacnet-stack/bin/. No other BACnetStack_* call may come + // submodules/cas-bacnet-stack/dist/. No other BACnetStack_* call may come // before it. --help and --version still work without it. arguments := os.Args[1:] stackFolder, searchedFolders := cgobridge.FindStackLibrary()