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

mlx_new_window segfault, mlx_init returns 0 #40

Open
njaros opened this issue Jan 26, 2022 · 3 comments
Open

mlx_new_window segfault, mlx_init returns 0 #40

njaros opened this issue Jan 26, 2022 · 3 comments

Comments

@njaros
Copy link

njaros commented Jan 26, 2022

Hi !

My code :

int main(int ac, char **av)
{
void *mlx;
void *win;

(void)ac;
(void)av;
mlx = mlx_init();
win = mlx_new_window(mlx, 1920, 1080, "Hello world!");
mlx_loop(mlx);

}

makefile commands :
gcc -Wall -Wextra -Werror -O3 -c test.c -o test.o
gcc -o test test.o lib/libmlx_Linux.a lib/libft.a -L/usr/lib -lXext -lX11 -lm -lz

I do valgrind ./test
It returns :
==4182== Process terminating with default action of signal 11 (SIGSEGV)
==4182== Access not within mapped region at address 0x20
==4182== at 0x10CA33: mlx_new_window (in /mnt/c/Users/nicol/OneDrive/Bureau/projets/fdf/test)
==4182== by 0x10A697: main (in /mnt/c/Users/nicol/OneDrive/Bureau/projets/fdf/test)
==4182== If you believe this happened as a result of a stack
==4182== overflow in your program's main thread (unlikely but
==4182== possible), you can try to increase the size of the
==4182== main thread stack using the --main-stacksize= flag.
==4182== The main thread stack size used in this run was 8388608.

Any idea ?

@njaros njaros changed the title Hello, this minilibx segfault in Linux Hello, mlx_new_window segfault (Linux) Jan 26, 2022
@njaros njaros changed the title Hello, mlx_new_window segfault (Linux) Hello, mlx_new_window segfault Jan 26, 2022
@njaros
Copy link
Author

njaros commented Jan 26, 2022

When I execute the test program included in the minilibx :

./mlx-test
MinilibX Test Program
=> Local Endian : 0
=> Connection ... !! KO !!

Seems like mlx_init returns 0
If I don't found the bug quickly I'll have to create a hackintosh just for this project :(

@njaros njaros changed the title Hello, mlx_new_window segfault Hello, mlx_new_window segfault, mlx_init returns 0 Jan 26, 2022
@njaros njaros changed the title Hello, mlx_new_window segfault, mlx_init returns 0 mlx_new_window segfault, mlx_init returns 0 Jan 26, 2022
@UnWaDo
Copy link

UnWaDo commented Feb 17, 2022

In case it's still a problem, the mlx_init() function may return NULL if it failed to gain display
You should check your mlx variable for NULL

The reason why it works this way in your case depends on system: do you use pure Linux/VM/WSL?

@njaros
Copy link
Author

njaros commented Feb 21, 2022

Hello,
I just retried today,
I didn't see i had to go to WSL2.
Now it's ok. I feel a bit stupid ^^
Thx !

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

No branches or pull requests

2 participants