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

ocaml graphics not working on popular Linux distros; ocaml should use pkg-config to get X11 switches #5477

Closed
vicuna opened this issue Jan 13, 2012 · 9 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Jan 13, 2012

Original bug ID: 5477
Reporter: gerd
Status: closed (set by @xavierleroy on 2013-08-31T10:46:22Z)
Resolution: fixed
Priority: normal
Severity: block
Version: 3.12.1
Fixed in version: 3.13.0+dev
Category: ~DO NOT USE (was: OCaml general)
Has duplicate: #5423
Related to: #5453
Monitored by: @protz mehdi pveber @glondu @hcarty

Bug description

There is now pkg-config support for libx in x.org's version of X for some time. This is a more reliable way for finding libx than searching in hard-coded locations, as it is currently done in Ocaml's configure script.

The problem becomes now more urgent because distributions have started to ship multiarch binaries/libraries which are no longer stored at the classic places. The libraries are now in /usr/lib/ or /usr/lib//, and ocaml fails to find them. Affected distros are Ubuntu Natty and Debian Wheezy so far.

Steps to reproduce

See e.g. http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=619344

Additional information

The suggested fix is to try "pkg-config --libs x11" before starting to search possible places for libx.

pkg-config is supported for X11 since around 2005, and is now even widely available.

File attachments

@vicuna
Copy link
Author

vicuna commented Jan 14, 2012

Comment author: @xavierleroy

It's a great idea to try pkg-config first. A proposal for a patch would be very welcome.

@vicuna
Copy link
Author

vicuna commented Jan 15, 2012

Comment author: pveber

I've attached a first shot (configure.x11.patch). I tried to keep modifications to the minimum.

@vicuna
Copy link
Author

vicuna commented Jan 17, 2012

Comment author: gerd

Looking at Philippe's patch. On my system the two pkg-config commands output the empty string. I think this is not properly handled: "test -f $dir/X11/X.h" does not work when $dir is empty. Same with the library test. I think the proper way to go is to just believe pkg-config when it exits with code 0, and not testing the existence of files. A meaningful test would be compiling a test program with the flags.

Also, we should be prepared that pkg-config is not available, and just use the old code then.

Philippe: I don't understand the sed.

@vicuna
Copy link
Author

vicuna commented Jan 17, 2012

Comment author: gerd

Attached my shot at the problem: configure-x11-gerd.diff

@vicuna
Copy link
Author

vicuna commented Jan 17, 2012

Comment author: @xavierleroy

Gerd's patch looks good to me. Thanks. To be reviewed and applied.

@vicuna
Copy link
Author

vicuna commented Jan 17, 2012

Comment author: @lefessan

The patch requires some work, to be applied to trunk (it is based on 3.12.1).

In the meantime, maybe some developers could try it on their systems, to be sure it does not break working configuration.

I tested it on Linux amd64/Ubuntu 10.10 Maverick, and it worked for me.

@vicuna
Copy link
Author

vicuna commented Jan 31, 2012

Comment author: @damiendoligez

There is an obvious typo in Gerd's patch: if pkg-config returns without error, then it sets the variable "X11_include" with a capital X, a variable that is not used anywhere else.

So I'm surprised it works on Ubuntu.

@vicuna
Copy link
Author

vicuna commented Jan 31, 2012

Comment author: mehdi

"pkg-config --cflags x11" returns an empty string on Debian Wheezy and Ubuntu 11.xx (and probably 10.xx too… I didn't test other versions). So that might explain it.

@vicuna
Copy link
Author

vicuna commented Jan 31, 2012

Comment author: @damiendoligez

I have adapted Gerd's patch to trunk and removed the bug. Tested on MacOSX 10.6. It selects macports' X11 library in preference to Apple's but that works just as well.

Tested also on 32-bit Ubuntu 11.04.
And also on 32-bit Windows7/cygwin.

Committed to trunk [3.13.0] (commit 12110)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant