ttshivhula / minilibx

Minilibx for linux systems

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue with minilibx

Tsudarov opened this issue · comments

commented

Salut, j'ai suivis les instructions pour la minilibx sur ubuntu, mais quand j'éssaye de la compiler, voici ce que j'obtient dernierement:

Package libbsd was not found in the pkg-config search path.
Perhaps you should add the directory containing `libbsd.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libbsd', required by 'mlx', not found
gcc -o mlx-test main.o 
main.o : Dans la fonction « expose_win2 » :
main.c:(.text+0x3f) : référence indéfinie vers « mlx_put_image_to_window »
main.o : Dans la fonction « color_map_1 » :
main.c:(.text+0x219) : référence indéfinie vers « mlx_pixel_put »
main.o : Dans la fonction « color_map_2 » :
main.c:(.text+0x38f) : référence indéfinie vers « mlx_get_color_value »
main.o : Dans la fonction « expose_win1 » :
main.c:(.text+0x1b) : référence indéfinie vers « mlx_put_image_to_window »
main.o : Dans la fonction « expose_win2 » :
main.c:(.text+0x62) : référence indéfinie vers « mlx_put_image_to_window »
main.o : Dans la fonction « key_win3 » :
main.c:(.text+0x168) : référence indéfinie vers « mlx_destroy_window »
main.o : Dans la fonction « main » :
main.c:(.text.startup+0x45) : référence indéfinie vers « mlx_init »
main.c:(.text.startup+0xa8) : référence indéfinie vers « mlx_new_window »
main.c:(.text.startup+0x12b) : référence indéfinie vers « mlx_clear_window »
main.c:(.text.startup+0x174) : référence indéfinie vers « mlx_new_image »
main.c:(.text.startup+0x1a1) : référence indéfinie vers « mlx_get_data_addr »
main.c:(.text.startup+0x274) : référence indéfinie vers « mlx_put_image_to_window »
main.c:(.text.startup+0x2b0) : référence indéfinie vers « mlx_destroy_image »
main.c:(.text.startup+0x2f9) : référence indéfinie vers « mlx_new_image »
main.c:(.text.startup+0x32a) : référence indéfinie vers « mlx_get_data_addr »
main.c:(.text.startup+0x3fd) : référence indéfinie vers « mlx_put_image_to_window »
main.c:(.text.startup+0x450) : référence indéfinie vers « mlx_string_put »
main.c:(.text.startup+0x47a) : référence indéfinie vers « mlx_string_put »
main.c:(.text.startup+0x4c4) : référence indéfinie vers « mlx_xpm_file_to_image »
main.c:(.text.startup+0x4f3) : référence indéfinie vers « mlx_get_data_addr »
main.c:(.text.startup+0x575) : référence indéfinie vers « mlx_put_image_to_window »
main.c:(.text.startup+0x59a) : référence indéfinie vers « mlx_put_image_to_window »
main.c:(.text.startup+0x5e0) : référence indéfinie vers « mlx_new_window »
main.c:(.text.startup+0x5fd) : référence indéfinie vers « mlx_new_image »
main.c:(.text.startup+0x62c) : référence indéfinie vers « mlx_get_data_addr »
main.c:(.text.startup+0x691) : référence indéfinie vers « mlx_new_window »
main.c:(.text.startup+0x6ad) : référence indéfinie vers « mlx_expose_hook »
main.c:(.text.startup+0x6c2) : référence indéfinie vers « mlx_mouse_hook »
main.c:(.text.startup+0x6d7) : référence indéfinie vers « mlx_key_hook »
main.c:(.text.startup+0x6ec) : référence indéfinie vers « mlx_expose_hook »
main.c:(.text.startup+0x701) : référence indéfinie vers « mlx_mouse_hook »
main.c:(.text.startup+0x716) : référence indéfinie vers « mlx_key_hook »
main.c:(.text.startup+0x72b) : référence indéfinie vers « mlx_key_hook »
main.c:(.text.startup+0x74b) : référence indéfinie vers « mlx_hook »
main.c:(.text.startup+0x763) : référence indéfinie vers « mlx_loop »
collect2: error: ld returned 1 exit status
Makefile.gen:20: recipe for target 'mlx-test' failed
make[1]: *** [mlx-test] Error 1
make[1] : on quitte le répertoire « /home/teowned/Bureau/fractol/mlx_cust_lib/minilibx/test »
Makefile:17: recipe for target 'do_configure' failed
make: *** [do_configure] Error 2

La premiere ligne étant : Package libbsd was not found in the pkg-config search path.
j'ai pourtant fait 1erement comme indiqué, mit le path du dossier minilibx dans PKG_CONFIG_PATH dans .zshrc

puis j'ai suivis tester ce script d'install :
https://github.com/BinaryBenji/Minilibx_Installer/blob/master/mlx_install.sh
de changer dans le makefile le fait quelle utilisais la minilibx macos mais celle ci que je venais d'installer dans dev/null

puis j'ai essayé PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
puis PKG_CONFIG_PATH=/usr/lib/pkgconfig
J'ai aussi essayé de telecharger libbsd.pc et de le mettre dans le path que j'ai configuré dans .zshrc mais rien ne fait :/

Tu aurais une idée ?

Hey you need
sudo apt-get install libssl-dev

Tell me if that resolves the issue because I am running this library on Arch Linux and can't fix the issue since I've never experienced it.

commented

Nope it did'nt :/

Are you running Ubuntu or Bash on Windows? because if you are on Windows this won't work.

commented

Ubuntu :)

@TeoWneD did you install libssl-dev? Because I compiled this library successfully on Ubuntu. And if you did install libssl-dev show make the error you get when you try to compile the library.

You need this package installed libbsd

To install run

./configure
make
sudo make install
commented

i downloaded libssl-dev libbsd-dev, your minilibx, compiled it with :
make && sudo make install it compiled
and put the right path into PKG_CONFIG_PATH
i changed my makefile to replace my macos minilibx by yours
but when i try to compile my project i have :
main.o : Dans la fonction « ft_fractal_launcher_2 » :
/home/teowned/Bureau/42/fractoldesktop/main.c:18 : référence indéfinie vers « ft_strcmp »
/home/teowned/Bureau/42/fractoldesktop/main.c:24 : référence indéfinie vers « ft_strcmp »
/home/teowned/Bureau/42/fractoldesktop/main.c:26 : référence indéfinie vers « ft_strcmp »
/home/teowned/Bureau/42/fractoldesktop/main.c:28 : référence indéfinie vers « ft_strcmp »
main.o : Dans la fonction « ft_fractal_launcher » :
/home/teowned/Bureau/42/fractoldesktop/main.c:37 : référence indéfinie vers « ft_strcmp »
main.o:/home/teowned/Bureau/42/fractoldesktop/main.c:39 : encore plus de références indéfinies suivent vers « ft_strcmp »
main.o : Dans la fonction « main » :
/home/teowned/Bureau/42/fractoldesktop/main.c:78 : référence indéfinie vers « mlx_hook »
/home/teowned/Bureau/42/fractoldesktop/main.c:79 : référence indéfinie vers « mlx_hook »
/home/teowned/Bureau/42/fractoldesktop/main.c:80 : référence indéfinie vers « mlx_hook »
/home/teowned/Bureau/42/fractoldesktop/main.c:82 : référence indéfinie vers « mlx_loop »
/home/teowned/Bureau/42/fractoldesktop/main.c:65 : référence indéfinie vers « ft_strcmp »
/home/teowned/Bureau/42/fractoldesktop/main.c:65 : référence indéfinie vers « ft_strcmp »
/home/teowned/Bureau/42/fractoldesktop/main.c:66 : référence indéfinie vers « ft_strcmp »
/home/teowned/Bureau/42/fractoldesktop/main.c:67 : référence indéfinie vers « ft_strcmp »
/home/teowned/Bureau/42/fractoldesktop/main.c:67 : référence indéfinie vers « ft_strcmp »
main.o:/home/teowned/Bureau/42/fractoldesktop/main.c:68 : encore plus de références indéfinies suivent vers « ft_strcmp »
init.o : Dans la fonction « init_env » :
/home/teowned/Bureau/42/fractoldesktop/init.c:29 : référence indéfinie vers « mlx_init_win »
/home/teowned/Bureau/42/fractoldesktop/init.c:30 : référence indéfinie vers « mlx_init_pic »
init.o : Dans la fonction « mlx_help_display » :
/home/teowned/Bureau/42/fractoldesktop/init.c:37 : référence indéfinie vers « mlx_string_put »
/home/teowned/Bureau/42/fractoldesktop/init.c:39 : référence indéfinie vers « mlx_string_put »
/home/teowned/Bureau/42/fractoldesktop/init.c:41 : référence indéfinie vers « mlx_string_put »
/home/teowned/Bureau/42/fractoldesktop/init.c:43 : référence indéfinie vers « mlx_string_put »
/home/teowned/Bureau/42/fractoldesktop/init.c:45 : référence indéfinie vers « mlx_string_put »
init.o:/home/teowned/Bureau/42/fractoldesktop/init.c:47 : encore plus de références indéfinies suivent vers « mlx_string_put »
maths_fractoil.o : Dans la fonction « fractol_fractoil_math » :
/home/teowned/Bureau/42/fractoldesktop/maths_fractoil.c:30 : référence indéfinie vers « mlx_img_drwpoint »
/home/teowned/Bureau/42/fractoldesktop/maths_fractoil.c:30 : référence indéfinie vers « mlx_img_drwpoint »
maths_mandelbrot.o : Dans la fonction « fractol_mandelbrot_math » :
/home/teowned/Bureau/42/fractoldesktop/maths_mandelbrot.c:32 : référence indéfinie vers « mlx_img_drwpoint »
/home/teowned/Bureau/42/fractoldesktop/maths_mandelbrot.c:32 : référence indéfinie vers « mlx_img_drwpoint »
maths_tricorne.o : Dans la fonction « fractol_tricorne_math » :
/home/teowned/Bureau/42/fractoldesktop/maths_tricorne.c:32 : référence indéfinie vers « mlx_img_drwpoint »
maths_tricorne.o:/home/teowned/Bureau/42/fractoldesktop/maths_tricorne.c:32 : encore plus de références indéfinies suivent vers « mlx_img_drwpoint »
events.o : Dans la fonction « fractol_redraw » :
/home/teowned/Bureau/42/fractoldesktop/events.c:47 : référence indéfinie vers « ft_bzero »
/home/teowned/Bureau/42/fractoldesktop/events.c:49 : référence indéfinie vers « mlx_clear_window »
/home/teowned/Bureau/42/fractoldesktop/events.c:50 : référence indéfinie vers « mlx_init_pic »
/home/teowned/Bureau/42/fractoldesktop/events.c:47 : référence indéfinie vers « ft_bzero »
/home/teowned/Bureau/42/fractoldesktop/events.c:49 : référence indéfinie vers « mlx_clear_window »
/home/teowned/Bureau/42/fractoldesktop/events.c:50 : référence indéfinie vers « mlx_init_pic »
maths_xxx.o : Dans la fonction « fractol_xxx_math » :
/home/teowned/Bureau/42/fractoldesktop/maths_xxx.c:33 : référence indéfinie vers « mlx_img_drwpoint »
/home/teowned/Bureau/42/fractoldesktop/maths_xxx.c:33 : référence indéfinie vers « mlx_img_drwpoint »
tool.o : Dans la fonction « fractol_event_expose » :
/home/teowned/Bureau/42/fractoldesktop/tool.c:54 : référence indéfinie vers « mlx_put_image_to_window »
tool.o : Dans la fonction « ft_exit » :
/home/teowned/Bureau/42/fractoldesktop/tool.c:47 : référence indéfinie vers « ft_putendl »
tool.o : Dans la fonction « ft_usage » :
/home/teowned/Bureau/42/fractoldesktop/tool.c:20 : référence indéfinie vers « ft_putstr »
/home/teowned/Bureau/42/fractoldesktop/tool.c:25 : référence indéfinie vers « ft_putstr »
/home/teowned/Bureau/42/fractoldesktop/tool.c:26 : référence indéfinie vers « ft_putendl »
tool.o : Dans la fonction « fractol_mlx_put_loop » :
/home/teowned/Bureau/42/fractoldesktop/tool.c:62 : référence indéfinie vers « mlx_put_image_to_window »
/home/teowned/Bureau/42/fractoldesktop/tool.c:65 : référence indéfinie vers « mlx_expose_hook »
collect2: error: ld returned 1 exit status
Makefile:31: recipe for target 'fractol' failed
make: *** [fractol] Error 1

here is my makefile lib line
LIB = -L libft -lft -L /home/teowned/Bureau/42/fractoldesktop/mlx_cust_lib/minilibx -lmlx -L mlx_cust_lib -lcustmlx

mlx cust lib is a custom library of few mlx fonction

Having same issue trying to use minilibx on LTS Ubuntu,
after running :

$ sudo apt-get install libssl-dev
$ ./configure
$ make
$ sudo make install

if i run a test.c file with minilib functions ->
$ gcc -L minilib/ test.c

i get errors "undefined reference" to 'mlx_init', 'mlx_new_window', 'mlx_loop'

tried all the flags in https://achedeuzot.me/2014/12/20/installer-la-minilibx/ also

Having same issue trying to use minilibx on LTS Ubuntu,
after running :

$ sudo apt-get install libssl-dev
$ ./configure
$ make
$ sudo make install

if i run a test.c file with minilib functions ->
$ gcc -L minilib/ test.c

i get errors "undefined reference" to 'mlx_init', 'mlx_new_window', 'mlx_loop'

tried all the flags in https://achedeuzot.me/2014/12/20/installer-la-minilibx/ also

Instead of linking like that try

gcc test.c -lmlx -lXext -lX11

There seems to be an issue with Ubuntu and clang and also with the -O3 flag. I fixed it by recompiling using gcc without the -O3 flag and it's working now.

Having same issue trying to use minilibx on LTS Ubuntu,
after running :
$ sudo apt-get install libssl-dev
$ ./configure
$ make
$ sudo make install
if i run a test.c file with minilib functions ->
$ gcc -L minilib/ test.c
i get errors "undefined reference" to 'mlx_init', 'mlx_new_window', 'mlx_loop'
tried all the flags in https://achedeuzot.me/2014/12/20/installer-la-minilibx/ also

Instead of linking like that try

gcc test.c -lmlx -lXext -lX11

That work for me, thank you