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 depexts to the package. #25

Open
eriklovlie opened this issue Sep 16, 2018 · 6 comments
Open

Add depexts to the package. #25

eriklovlie opened this issue Sep 16, 2018 · 6 comments

Comments

@eriklovlie
Copy link

Tried to get one of my projects to build on a new computer, but for some reason it failed due to not being linked to libGL. Then I tried the tgls example program "trigl4.ml" and this had the same issue:

$ ocamlfind ocamlopt -linkpkg -package result,tsdl,tgls.tgl4 -o trigl4.native trigl4.ml
$ ldd ./trigl4.native 
	linux-vdso.so.1 (0x00007fffc3b59000)
	libSDL2-2.0.so.0 => /lib64/libSDL2-2.0.so.0 (0x00007f4c1ee6c000)
	libffi.so.6 => /lib64/libffi.so.6 (0x00007f4c1ec63000)
	libm.so.6 => /lib64/libm.so.6 (0x00007f4c1e8cf000)
	libdl.so.2 => /lib64/libdl.so.2 (0x00007f4c1e6cb000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f4c1e30c000)
	libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f4c1e0ed000)
	librt.so.1 => /lib64/librt.so.1 (0x00007f4c1dee5000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f4c1f19b000)

I tried to pass "-lGL" directly and it then worked:

$ ocamlfind ocamlopt -cclib '-lGL' -linkpkg -package result,tsdl,tgls.tgl4 -o trigl4.native trigl4.ml
$ ldd ./trigl4.native 
	linux-vdso.so.1 (0x00007fffc19f5000)
	libSDL2-2.0.so.0 => /lib64/libSDL2-2.0.so.0 (0x00007fc244770000)
	libffi.so.6 => /lib64/libffi.so.6 (0x00007fc244567000)
	libGL.so.1 => /lib64/libGL.so.1 (0x00007fc2442d6000)
	libm.so.6 => /lib64/libm.so.6 (0x00007fc243f42000)
	libdl.so.2 => /lib64/libdl.so.2 (0x00007fc243d3e000)
	libc.so.6 => /lib64/libc.so.6 (0x00007fc24397f000)
	libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fc243760000)
	librt.so.1 => /lib64/librt.so.1 (0x00007fc243558000)
	libGLX.so.0 => /lib64/libGLX.so.0 (0x00007fc243326000)
	libX11.so.6 => /lib64/libX11.so.6 (0x00007fc242fe5000)
	libXext.so.6 => /lib64/libXext.so.6 (0x00007fc242dd3000)
	libGLdispatch.so.0 => /lib64/libGLdispatch.so.0 (0x00007fc242b19000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fc244a9f000)
	libxcb.so.1 => /lib64/libxcb.so.1 (0x00007fc2428f0000)
	libXau.so.6 => /lib64/libXau.so.6 (0x00007fc2426ec000)

Relevant information:

  • OS is fedora 28 (4.18.7-200.fc28.x86_64)
  • opam2 with latest tgls and tsdl:
$ opam config report
# opam config report
# opam-version      2.0.0 
# self-upgrade      no
# system            arch=x86_64 os=linux os-distribution=fedora os-version=28
# solver            builtin-mccs+glpk
# install-criteria  -removed,-count[version-lag,request],-count[version-lag,changed],-changed
# upgrade-criteria  -removed,-count[version-lag,solution],-new
# jobs              4
# repositories      1 (http) (default repo at 96bb9c7c)
# pinned            0
# current-switch    4.07.0
@eriklovlie
Copy link
Author

I'm not a dune/jbuilder expert but this workaround seems to work for now:

(jbuild_version 1)

(executable
 ((name yoyo)
  (ocamlopt_flags (-cclib -lGL))
  (libraries (core_extended tgls.tgl4 tsdl))
  (preprocess (pps (ppx_jane)))
  ))

@dbuenzli
Copy link
Owner

Normally the libraries are automatically configured using the gl package-config package.

Could you maybe try to give me the output of:

pkg-config --libs gl

and if the package doesn't exist, does it maybe live under a different names (see the output of pkg-config --list-all) ?

@eriklovlie
Copy link
Author

It seems this package doesn't exist on fedora 28:

$ pkg-config --list-all | grep -i gl
libglvnd                       libglvnd - Vendor-neutral OpenGL dispatch library vendor interface
xcb-glx                        XCB GLX - XCB GLX Extension
sdl2                           sdl2 - Simple DirectMedia Layer is a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video framebuffer.
egl                            egl - Mesa EGL library
glesv2                         glesv2 - Mesa OpenGL ES 2.0 library
glproto                        GLProto - GL extension headers

@eriklovlie
Copy link
Author

Doh! It is in mesa-libGL-devel:

$ dnf repoquery -l mesa-libGL-devel-0:18.0.5-3.fc28.x86_64
Last metadata expiration check: 0:01:02 ago on Mon 17 Sep 2018 07:58:51 PM CEST.
/usr/include/GL/gl.h
/usr/include/GL/gl_mangle.h
/usr/include/GL/glcorearb.h
/usr/include/GL/glext.h
/usr/include/GL/glx.h
/usr/include/GL/glx_mangle.h
/usr/include/GL/glxext.h
/usr/include/GL/internal
/usr/include/GL/internal/dri_interface.h
/usr/lib64/libglapi.so
/usr/lib64/pkgconfig/dri.pc
/usr/lib64/pkgconfig/gl.pc

@eriklovlie
Copy link
Author

Things are working after installing mesa-libGL-devel and then reinstalling tgls.

@dbuenzli
Copy link
Owner

Ah ! Thanks for the info. I guess the package should maybe declare depexts, though formally they are not needed to compile the package.

@dbuenzli dbuenzli reopened this Sep 17, 2018
@dbuenzli dbuenzli changed the title example program not linked to libGL Add depexts to the package. Sep 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants