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

Add devcontainer #148

Closed
alexallmont opened this issue Nov 9, 2024 · 1 comment · Fixed by #163
Closed

Add devcontainer #148

alexallmont opened this issue Nov 9, 2024 · 1 comment · Fixed by #163
Assignees

Comments

@alexallmont
Copy link
Contributor

Having recently joining the project, I set up my development environment and hit some issues on MacOS. I switched to Linux and then found a few dependencies and paths had to be set. I have captured this info in a Dockerfile and devcontainer.json which detail the tools anyone will need to spin up a containerised VSCode dev environment. This includes an example launch.json for debugging C++ and python tests (and additionally debugging C++ launched from python). After getting the Linux dev environment working, I had to make a few more to get it working on MacOS too.

This ticket is for tracking my changes for consideration for a PR if it's something you would like to make available to other developers.

(A nice side-effect of these changes is they allow you to run the IDE online through a GitHub codespace too, which can be a very helpful tool for teaching and demonstration)

alexallmont added a commit that referenced this issue Nov 9, 2024
- Installs python, git, gdb for dev environment
- Python venv created in /tools/venv (in container, not on local machine) with build requirements pre-installed.
- vcpkg cloned and setup in /tools/vcpkg. Note the FIXME on VCPKG_FORCE_SYSTEM_BINARIES added to get working on MacOS running a Linux container, as it may need to be made conditional on platform.
- PYTHONPATH and PATH setup so integrated terminal works.
- First draft of developer guide README.md.
- devcontainer.json has cmake and python settings as in Dockerfile
alexallmont added a commit that referenced this issue Nov 9, 2024
- When running a Linux container on MacOS, the mpg123 library fails with REAL_IS_FIXED, which I think means that this distro/arch combination fails to infer it automatically. As a workaround I explicitly set HAVE_FPU. If this is OK, I can remove the FIXME comment, but it's there for now for discussion in PR.
alexallmont added a commit that referenced this issue Nov 9, 2024
- Contains various python and C++ debug scenarios.
- Copy to .vscode/launch.json to use in development.
- See .devcontainer/README.md for full information.
@inakleinbottle
Copy link
Contributor

Good idea. I also encountered a problem debugging on MacOs because using the debugger requires the binary to be signed with the correct entitlements (who knows why debug builds are not automatically constructed in this way).

It might well be worth having several containers defined in the project directory to help people test/debug on the different platforms.

Cross compiling is something that we might eventually need to support in the build system, such as building for Raspberry Pi and other embedded platforms. I don't know how to do this at the moment, but things like this will definitely help.

alexallmont added a commit that referenced this issue Nov 20, 2024
- These flags are automatically set via `CMakePresets.json`.
alexallmont added a commit that referenced this issue Nov 20, 2024
- Added notes on the need to wait while CMake is configuring. This needs to finish for tests to be available.
@alexallmont alexallmont linked a pull request Nov 20, 2024 that will close this issue
alexallmont added a commit that referenced this issue Nov 20, 2024
- It seems that without setting ENV, that vcpkg does not always pick up this variable and setup can fail. Committing here to test on a fresh clone.
alexallmont added a commit that referenced this issue Nov 20, 2024
- Replace FIXME with clearer comment. So far this setting is only required when building containerized on MacOS, presumably because mgp123 wants specific instructions for cross-compilation or embedded work. Here it is fine to set this, as the Linux-on-MacOS target platform will definitely have an FPU.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants