caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] camlimages problems on mac
@ 2012-11-07 12:52 Samuel Hornus
  2012-11-07 13:20 ` Alan Schmitt
  2012-11-07 14:43 ` Pierre-Etienne Meunier
  0 siblings, 2 replies; 7+ messages in thread
From: Samuel Hornus @ 2012-11-07 12:52 UTC (permalink / raw)
  To: O Caml


Hello,

When installing camlimages 4.0.1 with MacPort (Mac OS X 10.7.5, Latest MacPorts),
the resulting camlimages has no support for JPEG, PNG, PPM, XPM, etc… which makes it sort of useless.

When compiling the source using omake, the same happens. It can find the header files, but can't find specific functions inside.

The source code for camlimages seems perhaps outdated w.r.t. changes in the API of libpng, libjpg, giflib, tifflib, etc… 

Could anyone confirms this dire state of affairs? Is there a "modernizer" patch floating around? or some work in progress? Is it the same on Linux?

Thank you,
Samuel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Caml-list] camlimages problems on mac
  2012-11-07 12:52 [Caml-list] camlimages problems on mac Samuel Hornus
@ 2012-11-07 13:20 ` Alan Schmitt
  2012-11-07 14:04   ` Samuel Hornus
  2012-11-07 14:43 ` Pierre-Etienne Meunier
  1 sibling, 1 reply; 7+ messages in thread
From: Alan Schmitt @ 2012-11-07 13:20 UTC (permalink / raw)
  To: Samuel Hornus; +Cc: O Caml

Samuel Hornus <samuel.hornus@inria.fr> writes:

> Hello,
>
> When installing camlimages 4.0.1 with MacPort (Mac OS X 10.7.5, Latest MacPorts),
> the resulting camlimages has no support for JPEG, PNG, PPM, XPM, etc…
> which makes it sort of useless.
>
> When compiling the source using omake, the same happens. It can find
> the header files, but can't find specific functions inside.
>
> The source code for camlimages seems perhaps outdated w.r.t. changes
> in the API of libpng, libjpg, giflib, tifflib, etc…
>
> Could anyone confirms this dire state of affairs? Is there a
> "modernizer" patch floating around? or some work in progress? Is it
> the same on Linux?

I just tried to configure it using godi, and this is what is supported
on my system:

External libraries: lablgtk2 bmp ppm png jpeg tiff freetype(2) ps

Most of my image libraries are installed through homebrew (I see for
instance "jpeg" or "libpng", I don't know where the ppm support comes
from).

To get support for gifs, I installed giflib (still through homebrew).

After doing this, camlimages seems to compile fine.

Alan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Caml-list] camlimages problems on mac
  2012-11-07 13:20 ` Alan Schmitt
@ 2012-11-07 14:04   ` Samuel Hornus
  2012-11-07 14:22     ` AW: " Gerd Stolpmann
  2012-11-07 14:30     ` Alan Schmitt
  0 siblings, 2 replies; 7+ messages in thread
From: Samuel Hornus @ 2012-11-07 14:04 UTC (permalink / raw)
  To: O Caml

On Nov7, 2012, at 14:20 , Alan Schmitt wrote:

> Samuel Hornus <samuel.hornus@inria.fr> writes:
> 
>> Hello,
>> 
>> When installing camlimages 4.0.1 with MacPort (Mac OS X 10.7.5, Latest MacPorts),
>> the resulting camlimages has no support for JPEG, PNG, PPM, XPM, etc…
>> which makes it sort of useless.
> I just tried to configure it using godi, and this is what is supported
> on my system:
> 
> External libraries: lablgtk2 bmp ppm png jpeg tiff freetype(2) ps
> 
> Most of my image libraries are installed through homebrew (I see for
> instance "jpeg" or "libpng", I don't know where the ppm support comes
> from).
> 
> To get support for gifs, I installed giflib (still through homebrew).
> 
> After doing this, camlimages seems to compile fine.

The compilation goes without a hitch here as well (both using omake or macports), but the support for most of the image file formats are automatically disabled after examining the third-party' header files, so you get an OCaml exception at runtime. There is a piece of code (from camlimages) that dumps what is actually supported (see below). Does your camlimages actually has support for  jpeg or png ?
Thank you Alan for your answer,
Sam

 let capabilities () = let open Format in
  let supported b = if b then "supported" else "not supported" in
  printf "*******************************************************@.";
  printf "Camlimages library capabilities currently available@.";
  printf "bmp\t: %s@." (supported Camlimages.lib_bmp);
  printf "ppm\t: %s@." (supported Camlimages.lib_ppm);
  printf "gif\t: %s@." (supported Camlimages.lib_gif);
  printf "jpeg\t: %s@." (supported Camlimages.lib_jpeg);
  printf "tiff\t: %s@." (supported Camlimages.lib_tiff);
  printf "png\t: %s@." (supported Camlimages.lib_png);
  printf "xpm\t: %s@." (supported Camlimages.lib_xpm);
  printf "xv thumbnails\t: %s@." (supported Camlimages.lib_xvthumb);
  printf "postscript\t: %s@." (supported Camlimages.lib_ps);
  printf "freetype\t: %s@." (supported Camlimages.lib_freetype);
  printf "*******************************************************@.";;

Mine shows:
bmp	: supported
ppm	: supported (* but crashes anyway: Fatal error: exception Images.Wrong_file_type *)
gif	: not supported
jpeg	: not supported
tiff	: not supported
png	: not supported
xpm	: supported (* but crashes anyway: Fatal error: exception Images.Wrong_file_type *)
xv thumbnails	: supported
postscript	: supported
freetype	: supported


^ permalink raw reply	[flat|nested] 7+ messages in thread

* AW: [Caml-list] camlimages problems on mac
  2012-11-07 14:04   ` Samuel Hornus
@ 2012-11-07 14:22     ` Gerd Stolpmann
  2012-11-07 14:30     ` Alan Schmitt
  1 sibling, 0 replies; 7+ messages in thread
From: Gerd Stolpmann @ 2012-11-07 14:22 UTC (permalink / raw)
  To: Samuel Hornus; +Cc: O Caml

Am 07.11.2012 15:04:51 schrieb(en) Samuel Hornus:
> On Nov7, 2012, at 14:20 , Alan Schmitt wrote:
> 
> > Samuel Hornus <samuel.hornus@inria.fr> writes:
> >
> >> Hello,
> >>
> >> When installing camlimages 4.0.1 with MacPort (Mac OS X 10.7.5,  
> Latest MacPorts),
> >> the resulting camlimages has no support for JPEG, PNG, PPM, XPM,  
> etc…
> >> which makes it sort of useless.
> > I just tried to configure it using godi, and this is what is  
> supported
> > on my system:
> >
> > External libraries: lablgtk2 bmp ppm png jpeg tiff freetype(2) ps
> >
> > Most of my image libraries are installed through homebrew (I see for
> > instance "jpeg" or "libpng", I don't know where the ppm support  
> comes
> > from).
> >
> > To get support for gifs, I installed giflib (still through  
> homebrew).
> >
> > After doing this, camlimages seems to compile fine.
> 
> The compilation goes without a hitch here as well (both using omake  
> or macports), but the support for most of the image file formats are  
> automatically disabled after examining the third-party' header files,  
> so you get an OCaml exception at runtime. There is a piece of code  
> (from camlimages) that dumps what is actually supported (see below).  
> Does your camlimages actually has support for  jpeg or png ?
> Thank you Alan for your answer,
> Sam

I guess the reason Alan was successful is that the camlimages version  
shipped with GODI is still 2.20 (plus patches). That's simply because  
the build system uses omake since 4.0, and we haven't found time to  
update and verify the package (which is a bit of work because of the  
long list of external dependencies), and the differences between 2.20  
and 4.0 are otherwise small.

Gerd

> 
>  let capabilities () = let open Format in
>   let supported b = if b then "supported" else "not supported" in
>   printf "*******************************************************@.";
>   printf "Camlimages library capabilities currently available@.";
>   printf "bmp\t: %s@." (supported Camlimages.lib_bmp);
>   printf "ppm\t: %s@." (supported Camlimages.lib_ppm);
>   printf "gif\t: %s@." (supported Camlimages.lib_gif);
>   printf "jpeg\t: %s@." (supported Camlimages.lib_jpeg);
>   printf "tiff\t: %s@." (supported Camlimages.lib_tiff);
>   printf "png\t: %s@." (supported Camlimages.lib_png);
>   printf "xpm\t: %s@." (supported Camlimages.lib_xpm);
>   printf "xv thumbnails\t: %s@." (supported Camlimages.lib_xvthumb);
>   printf "postscript\t: %s@." (supported Camlimages.lib_ps);
>   printf "freetype\t: %s@." (supported Camlimages.lib_freetype);
>   printf "*******************************************************@.";;
> 
> Mine shows:
> bmp	: supported
> ppm	: supported (* but crashes anyway: Fatal error: exception  
> Images.Wrong_file_type *)
> gif	: not supported
> jpeg	: not supported
> tiff	: not supported
> png	: not supported
> xpm	: supported (* but crashes anyway: Fatal error: exception  
> Images.Wrong_file_type *)
> xv thumbnails	: supported
> postscript	: supported
> freetype	: supported
> 
> 
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
> 

-- 
------------------------------------------------------------
Gerd Stolpmann, Darmstadt, Germany    gerd@gerd-stolpmann.de
Creator of GODI and camlcity.org.
Contact details:        http://www.camlcity.org/contact.html
Company homepage:       http://www.gerd-stolpmann.de
------------------------------------------------------------

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Caml-list] camlimages problems on mac
  2012-11-07 14:04   ` Samuel Hornus
  2012-11-07 14:22     ` AW: " Gerd Stolpmann
@ 2012-11-07 14:30     ` Alan Schmitt
  1 sibling, 0 replies; 7+ messages in thread
From: Alan Schmitt @ 2012-11-07 14:30 UTC (permalink / raw)
  To: Samuel Hornus; +Cc: O Caml

Samuel Hornus <samuel.hornus@inria.fr> writes:

> On Nov7, 2012, at 14:20 , Alan Schmitt wrote:
>
>> Samuel Hornus <samuel.hornus@inria.fr> writes:
>> 
>>> Hello,
>>> 
>>> When installing camlimages 4.0.1 with MacPort (Mac OS X 10.7.5, Latest MacPorts),
>>> the resulting camlimages has no support for JPEG, PNG, PPM, XPM, etc…
>>> which makes it sort of useless.
>> I just tried to configure it using godi, and this is what is supported
>> on my system:
>> 
>> External libraries: lablgtk2 bmp ppm png jpeg tiff freetype(2) ps
>> 
>> Most of my image libraries are installed through homebrew (I see for
>> instance "jpeg" or "libpng", I don't know where the ppm support comes
>> from).
>> 
>> To get support for gifs, I installed giflib (still through homebrew).
>> 
>> After doing this, camlimages seems to compile fine.
>
> The compilation goes without a hitch here as well (both using omake or
> macports), but the support for most of the image file formats are
> automatically disabled after examining the third-party' header files,
> so you get an OCaml exception at runtime. There is a piece of code
> (from camlimages) that dumps what is actually supported (see below).
> Does your camlimages actually has support for jpeg or png ?

Yes:

*******************************************************
Camlimages library capabilities currently available
bmp	: supported
ppm	: supported
gif	: supported
jpeg	: supported
tiff	: supported
png	: supported
xpm	: not supported
xv thumbnails	: supported
postscript	: supported
freetype	: supported
*******************************************************

Alan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Caml-list] camlimages problems on mac
  2012-11-07 12:52 [Caml-list] camlimages problems on mac Samuel Hornus
  2012-11-07 13:20 ` Alan Schmitt
@ 2012-11-07 14:43 ` Pierre-Etienne Meunier
  2012-11-13 11:28   ` Samuel Hornus
  1 sibling, 1 reply; 7+ messages in thread
From: Pierre-Etienne Meunier @ 2012-11-07 14:43 UTC (permalink / raw)
  To: Samuel Hornus; +Cc: O Caml

[-- Attachment #1: Type: text/plain, Size: 639 bytes --]

A while ago, I sent Pierre Weis a patch to make camlimages compatible with the new versions of libpng. I do not know if he used it, but please find it attached. This should solve the first problem. Next, there is a bug in omake, which prevents the libraries from being detected properly. The "dummy" version of the files get used instead of the correct ones. A friend of mine, Florian Hatat, sent a correction for ubuntu. We did not test it on mac.

Maybe some ocamlbuild expert could write some tags to make camlimages compile with ocamlbuild ? This library is really useful, only the build system is hard to use.

Cheers,
Pierre


[-- Attachment #2: png.diff --]
[-- Type: application/octet-stream, Size: 2042 bytes --]

--- src/pngwrite.c.old	2011-06-22 20:04:32.000000000 +0200
+++ src/pngwrite.c	2012-10-19 09:26:26.000000000 +0200
@@ -62,7 +62,7 @@
   }
 
   /* error handling */
-  if (setjmp(png_ptr->jmpbuf)) {
+  if (setjmp(png_jmpbuf(png_ptr))) {
     /* Free all of the memory associated with the png_ptr and info_ptr */
     png_destroy_write_struct(&png_ptr, &info_ptr);
     fclose(fp);
@@ -171,7 +171,7 @@
   }
 
   /* error handling */
-  if (setjmp(png_ptr->jmpbuf)) {
+  if (setjmp(png_jmpbuf(png_ptr))) {
     /* Free all of the memory associated with the png_ptr and info_ptr */
     png_destroy_write_struct(&png_ptr, &info_ptr);
     fclose(fp);
--- src/pngread.c.old	2011-06-22 20:04:32.000000000 +0200
+++ src/pngread.c	2012-10-19 09:26:36.000000000 +0200
@@ -69,7 +69,7 @@
   }
 
   /* error handling */
-  if (setjmp(png_ptr->jmpbuf)) {
+  if (setjmp(png_jmpbuf(png_ptr))) {
     /* Free all of the memory associated with the png_ptr and info_ptr */
     png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
     fclose(fp);
@@ -134,7 +134,7 @@
     png_set_rows(png_ptr, info_ptr, row_pointers);
 
     /* Later, we can return something */
-    if (setjmp(png_ptr->jmpbuf)) {
+    if (setjmp(png_jmpbuf(png_ptr))) {
       /* Free all of the memory associated with the png_ptr and info_ptr */
       png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
       fclose(fp);
@@ -243,7 +243,7 @@
   }
 
   /* error handling */
-  if (setjmp(png_ptr->jmpbuf)) {
+  if (setjmp(png_jmpbuf(png_ptr))) {
     /* Free all of the memory associated with the png_ptr and info_ptr */
     png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
     fclose(fp);
@@ -302,7 +302,7 @@
     png_set_rows(png_ptr, info_ptr, row_pointers);
 
     /* Later, we can return something */
-    if (setjmp(png_ptr->jmpbuf)) {
+    if (setjmp(png_jmpbuf(png_ptr))) {
       /* Free all of the memory associated with the png_ptr and info_ptr */
       png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
       fclose(fp);

[-- Attachment #3: Type: text/plain, Size: 954 bytes --]





Em 07/11/2012, às 09:52, Samuel Hornus escreveu:

> 
> Hello,
> 
> When installing camlimages 4.0.1 with MacPort (Mac OS X 10.7.5, Latest MacPorts),
> the resulting camlimages has no support for JPEG, PNG, PPM, XPM, etc… which makes it sort of useless.
> 
> When compiling the source using omake, the same happens. It can find the header files, but can't find specific functions inside.
> 
> The source code for camlimages seems perhaps outdated w.r.t. changes in the API of libpng, libjpg, giflib, tifflib, etc… 
> 
> Could anyone confirms this dire state of affairs? Is there a "modernizer" patch floating around? or some work in progress? Is it the same on Linux?
> 
> Thank you,
> Samuel
> -- 
> Caml-list mailing list.  Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Caml-list] camlimages problems on mac
  2012-11-07 14:43 ` Pierre-Etienne Meunier
@ 2012-11-13 11:28   ` Samuel Hornus
  0 siblings, 0 replies; 7+ messages in thread
From: Samuel Hornus @ 2012-11-13 11:28 UTC (permalink / raw)
  To: O Caml


Merci Pierre-Étienne ! With your patch, I was able to compile camlimages with full support for all file formats. I also noticed that MacPorts actually applies the same patch, yet the MacPorts version does not work. I suspect that's because the MacPorts' patch fails to add -I/opt/local/include and -L/opt/local/lib to the OMakefile before compiling.
-- 
Sam

On Nov7, 2012, at 15:43 , Pierre-Etienne Meunier wrote:

> A while ago, I sent Pierre Weis a patch to make camlimages compatible with the new versions of libpng. I do not know if he used it, but please find it attached. This should solve the first problem. Next, there is a bug in omake, which prevents the libraries from being detected properly. The "dummy" version of the files get used instead of the correct ones. A friend of mine, Florian Hatat, sent a correction for ubuntu. We did not test it on mac.
> 
> Maybe some ocamlbuild expert could write some tags to make camlimages compile with ocamlbuild ? This library is really useful, only the build system is hard to use.
> 
> Cheers,
> Pierre
> 
> <png.diff>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-11-13 11:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-07 12:52 [Caml-list] camlimages problems on mac Samuel Hornus
2012-11-07 13:20 ` Alan Schmitt
2012-11-07 14:04   ` Samuel Hornus
2012-11-07 14:22     ` AW: " Gerd Stolpmann
2012-11-07 14:30     ` Alan Schmitt
2012-11-07 14:43 ` Pierre-Etienne Meunier
2012-11-13 11:28   ` Samuel Hornus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).