Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005477OCaml~DO NOT USE (was: OCaml general)public2012-01-13 18:252013-08-31 12:46
Assigned To 
PlatformOSOS Version
Product Version3.12.1 
Target VersionFixed in Version3.13.0+dev 
Summary0005477: ocaml graphics not working on popular Linux distros; ocaml should use pkg-config to get X11 switches
DescriptionThere is now pkg-config support for libx in'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/<arch> or /usr/lib/<arch>/<pkg>, and ocaml fails to find them. Affected distros are Ubuntu Natty and Debian Wheezy so far.
Steps To ReproduceSee e.g. [^]
Additional InformationThe 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.
TagsNo tags attached.
Attached Filespatch file icon configure.x11.patch [^] (790 bytes) 2012-01-15 09:07 [Show Content]
diff file icon configure-x11-gerd.diff [^] (8,040 bytes) 2012-01-17 14:53 [Show Content]
patch file icon configure-x11-trunk.patch [^] (3,787 bytes) 2012-01-31 18:06 [Show Content]

- Relationships
related to 0005453closeddoligez Modules Graphics and labltk not build because of MultiarchSpec 
has duplicate 0005423closeddoligez x11 library path detection by configure fails under certain conditions 

-  Notes
xleroy (administrator)
2012-01-14 20:07

It's a great idea to try pkg-config first. A proposal for a patch would be very welcome.
pveber (reporter)
2012-01-15 09:09

I've attached a first shot (configure.x11.patch). I tried to keep modifications to the minimum.
gerd (reporter)
2012-01-17 14:08

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.
gerd (reporter)
2012-01-17 14:53

Attached my shot at the problem: configure-x11-gerd.diff
xleroy (administrator)
2012-01-17 15:28

Gerd's patch looks good to me. Thanks. To be reviewed and applied.
lefessan (developer)
2012-01-17 21:46

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.
doligez (administrator)
2012-01-31 14:35

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.
mehdi (reporter)
2012-01-31 16:26

"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.
doligez (administrator)
2012-01-31 18:11
edited on: 2012-02-01 22:31

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)

- Issue History
Date Modified Username Field Change
2012-01-13 18:25 gerd New Issue
2012-01-14 20:07 xleroy Note Added: 0006682
2012-01-14 20:07 xleroy Status new => feedback
2012-01-14 20:08 xleroy Relationship added related to 0005453
2012-01-15 09:07 pveber File Added: configure.x11.patch
2012-01-15 09:09 pveber Note Added: 0006686
2012-01-17 14:08 gerd Note Added: 0006693
2012-01-17 14:08 gerd Status feedback => new
2012-01-17 14:53 gerd File Added: configure-x11-gerd.diff
2012-01-17 14:53 gerd Note Added: 0006694
2012-01-17 15:28 xleroy Note Added: 0006696
2012-01-17 15:28 xleroy Status new => confirmed
2012-01-17 21:46 lefessan Note Added: 0006705
2012-01-31 14:35 doligez Note Added: 0006858
2012-01-31 16:26 mehdi Note Added: 0006860
2012-01-31 18:06 doligez File Added: configure-x11-trunk.patch
2012-01-31 18:11 doligez Note Added: 0006862
2012-01-31 18:59 doligez Note Edited: 0006862 View Revisions
2012-02-01 22:31 doligez Note Edited: 0006862 View Revisions
2012-02-02 10:14 doligez Status confirmed => resolved
2012-02-02 10:14 doligez Resolution open => fixed
2012-02-02 10:14 doligez Fixed in Version => 3.13.0+dev
2012-02-12 14:56 protz Relationship added has duplicate 0005423
2013-08-31 12:46 xleroy Status resolved => closed
2017-02-23 16:36 doligez Category OCaml general => -OCaml general
2017-03-03 17:55 doligez Category -OCaml general => -(deprecated) general
2017-03-03 18:01 doligez Category -(deprecated) general => ~deprecated (was: OCaml general)
2017-03-06 17:04 doligez Category ~deprecated (was: OCaml general) => ~DO NOT USE (was: OCaml general)

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker