Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamically linking the MSVC runtime causes segfault on start in acquire-python #255

Open
aliddell opened this issue Jun 17, 2024 · 0 comments
Assignees

Comments

@aliddell
Copy link
Member

Steps to reproduce:

  • Set MSVC_RUNTIME_LIBRARY to "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL" in src/CMakeLists.txt and tests/CMakeLists.txt. (You'll want to do this in examples/ as well if you're building these, but that's not strictly necessary to reproduce.)
  • Build on Windows.
  • Run the acquire-driver-zarr tests and verify that they run without incident: ctest -L acquire-driver-zarr or run them from your favorite IDE.
  • In acquire-python - build.rs, comment out the call to fetch_acquire_driver with "acquire-driver-zarr" as the second argument (lines 61-65 right now).
  • Copy the acquire-driver-zarr DLL to acquire-python/python/acquire and build and install acquire-python in some environment.
  • Run the following script in that environment:
import acquire
from acquire import Runtime, DeviceKind

from pathlib import Path
from tempfile import mkdtemp
from time import sleep

if __name__ == "__main__":
    runtime = Runtime()
    props = runtime.get_configuration()
    dm = runtime.device_manager()

    props.video[0].camera.identifier = dm.select(
        DeviceKind.Camera, "simulated.*empty.*"
    )
    props.video[0].camera.settings.shape = (33, 47)
    props.video[0].storage.identifier = dm.select(DeviceKind.Storage, "Zarr")
    props.video[0].max_frame_count = 4
    props.video[0].storage.settings.filename = str(
        Path(mkdtemp()) / "scratch_2.zarr"
    )
    props.video[0].storage.settings.pixel_scale_um = (0.5, 4)

    # configure storage dimensions
    dimension_x = acquire.StorageDimension(
        name="x", kind="Space", array_size_px=33, chunk_size_px=33
    )
    assert dimension_x.shard_size_chunks == 0

    dimension_y = acquire.StorageDimension(
        name="y", kind="Space", array_size_px=47, chunk_size_px=47
    )
    assert dimension_y.shard_size_chunks == 0

    dimension_z = acquire.StorageDimension(
        name="z", kind="Space", array_size_px=0, chunk_size_px=4
    )
    assert dimension_z.shard_size_chunks == 0

    props.video[0].storage.settings.acquisition_dimensions = [
        dimension_x,
        dimension_y,
        dimension_z,
    ]

    props = runtime.set_configuration(props)

    runtime.start()
    runtime.stop()

You will crash immediately after runtime.start().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog
Development

No branches or pull requests

2 participants