A quick guide on how to setup X11 forwarding on macOS when using docker containers requiring a DISPLAY. Works on both Intel and M1 macs!
This guide was tested on:
- macOS Catalina 10.15.4
- docker desktop 2.2.0.5 (43884) - stable release
- XQuartz 2.7.11 (xorg-server 1.18.4)
- Macbook Pro (Intel)
Suppose you need to add a section to an ELF binary to contain information gathered at compile time, but to be used at link time or run time. Here's how to add a section named .okdata
and either populate it with data either after or before emitting the ELF binary.
In this case, you'll add file’s contents to an already existing binary. objcopy
copies and translates object files, such that adding a new section is a matter of writing that new section’s contents into the ELF file.
(Optional) Create a simple program’s object file.
{ | |
// See https://go.microsoft.com/fwlink/?LinkId=733558 | |
// for the documentation about the tasks.json format | |
"version": "2.0.0", | |
"options": { | |
"env": { | |
"OPENOCD_SCRIPTS": "${workspaceRoot}\\..\\OpenOCD-20170609\\share\\openocd\\scripts" | |
} | |
}, | |
"tasks": [ |
{ | |
tokens=[ | |
space='regexp:\s+' | |
identifier='regexp:[a-zA-Z][a-zA-Z0-9_]*' | |
integer-constant='regexp:\d+' | |
character-constant='regexp:[a-zA-Z]' | |
floating-constant='regexp:[+-]?([0-9]*[.])?[0-9]+f' | |
enumeration-constant='regexp:[a-zA-Z][a-zA-Z0-9_]*' // Same as identifier | |
] |
- Install XQuartz: https://www.xquartz.org/
- Launch XQuartz. Under the XQuartz menu, select Preferences
- Go to the security tab and ensure "Allow connections from network clients" is checked.
- Run
xhost + ${hostname}
to allow connections to the macOS host * - Setup a HOSTNAME env var
export HOSTNAME=`hostname`
* - Add the following to your docker-compose:
environment:
Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.
- Follow standard conventions.
- Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
- Boy scout rule. Leave the campground cleaner than you found it.
- Always find root cause. Always look for the root cause of a problem.
--- | |
# Notes: | |
# Sample project C code is not presently written to produce a release artifact. | |
# As such, release build options are disabled. | |
# This sample, therefore, only demonstrates running a collection of unit tests. | |
:project: | |
:use_exceptions: FALSE | |
:use_test_preprocessor: TRUE |