Comments (5)
Well that's a whole new error i've never seen before.
I however simply get:
- docker build -t mlx42-test .
- docker run -it mlx42-test
Failed to initialize GLFW
Which makes sense as there is no display to launch with docker, even with MLX_HEADLESS
it won't work as a "Window" context is needed.
from mlx42.
Yes, there was a lot of work to overcome 'Failed to initialize GLFW' for me too :D I used xquartz and
echo 'first start docker desktop yourself, else this will not work'
export DISPLAY=127.0.0.1:0
xhost + 127.0.0.1
export BUILDKIT_PROGRESS=plain
docker build --build-arg CACHEBUST=$(date +%s) -t mlx42-app .
docker run --rm -it -e DISPLAY=host.docker.internal:0 \
-e LIBGL_ALWAYS_SOFTWARE=1 \
-e LIBGL_ALWAYS_INDIRECT=1 \
-v /tmp/.X11-unix:/tmp/.X11-unix mlx42-app
- not everything is relevant, but maybe this works
from mlx42.
Ok so this took a bit of digging but I found a docker file that handles exactly all of this stuff.
I suggest forking: https://github.com/BoundfoxStudios/docker-opengl
FROM boundfoxstudios/opengl:latest
# Install necessary dependencies
RUN apk update && apk add --no-cache gcc g++ make openssl-dev cmake git bash glfw-dev mesa-dev git
# Clone the repo
RUN git clone https://github.com/codam-coding-college/MLX42.git /MLX42
# Copy your minilibx.c file
COPY minilibx.c /tmp
# Set the working directory
WORKDIR /tmp
# Build the project
RUN cd /MLX42 && \
cmake -B build && \
cmake --build build -j4
# Set the default command to compile and run your program
CMD gcc /tmp/minilibx.c -g /MLX42/build/libmlx42.a -I/MLX42/include -ldl -lglfw -pthread -lm && ./a.out
I modified the .c
file to just print the address:
# include "MLX42/MLX42.h"
# include <stdio.h>
# include <stdlib.h>
# define WIDTH 512
# define HEIGHT 512
int main(void)
{
mlx_t *mlx;
mlx_set_setting(MLX_HEADLESS, true);
if (!(mlx = mlx_init(WIDTH, HEIGHT, "MLX42", true)))
{
puts(mlx_strerror(mlx_errno));
return(EXIT_FAILURE);
}
printf("mlx_init: %p\n", mlx);
}
And instead of an error now you get:
Starting Xvfb
Waiting for Xvfb (PID: 7) to be ready...
Xvfb is running.
mlx_init: 0xffff915dd1b0
Waiting for Xvfb (PID: 7) to shut down...
from mlx42.
I tested it with the program in the README.md
, seems to work perfectly fine!
If this works for you too i'll add it to the readme or create a Docker example so in the future others can look into how to make it work with Docker and avoid doing all this annoying Xvfb non-sense.
from mlx42.
I assume for now, yes, if not, please re-open.
from mlx42.
Related Issues (20)
- [BUG] Double free cause by mlx_freen when executing mlx_terminate HOT 3
- [BUG] Address sanitizer reports leaks HOT 2
- Arm64 compatibility (Apple Silicon) HOT 1
- [BUG] mlx_update_matrix ignores passed width and height HOT 1
- [REQUEST] better resize control on Mac OS X
- [REQUEST] Document "don't care" option for mlx_set_window_limit HOT 1
- [REQUEST] HOT 2
- Yo! Some docs would be bussin' [REQUEST] HOT 1
- [BUG] Issues finding the glfw header file, Compile Error and as small Makefile example issues HOT 1
- [BUG] can't draw on the image/window HOT 2
- [BUG] doesn't work with X11 redirection on Linux VM on MacOS HOT 4
- [REQUEST] Update README example HOT 1
- [BUG] Leaks on mlx_init (glfw) HOT 5
- Pixel color incorrect - appears cyan instead of white, possible red channel rendering issue
- All mlx_images_to_window show the same image HOT 2
- MLX last commit failed some unit tests and the project has incorrect rendering HOT 4
- [BUG] when compiling gives GLSL error message HOT 3
- [BUG] Unable to use MLX as a submodule HOT 6
- [BUG] Error messages while compiling HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mlx42.