comp.lang.ada
 help / color / mirror / Atom feed
* Problem Building Ada Interface To ImageMagick 7
@ 2018-06-26  8:28 Roger
  2018-06-26  9:26 ` alby.gamper
  2018-06-26  9:34 ` gautier_niouzes
  0 siblings, 2 replies; 25+ messages in thread
From: Roger @ 2018-06-26  8:28 UTC (permalink / raw)


OSX 10.13.5
GNAT community 2018
XCode 9.4.1

ImageMagic Libraries:
libMagick++-7.Q16HDRI
libMagickCore-7.Q16HDRI

I have been developing some Ada Interfaces To ImageMagick 7 but have come to a problem that I need help with.
I built the ImageMagick libraries with:
CC=clang CXX="clang++ -std=c++11 -stdlib=libc++ -g -O0"  CFLAGS="-g -O0" CXXFLAGS="-g -O0" ./configure --prefix=/opt --with-quantum-depth=16 --disable-dependency-tracking --without-perl
I enabled debugging (-g) to allow me to track through the ImageMagick code , C++ in particular which I find almost impossible to reverse engineer from the source alone.
My C++ capabilities are very limited.

The following code works OK under XCode but crashes (segmentation fault) under GNAT.

#include <string>
#include <stdio.h>
#include "/opt/include/ImageMagick-7/Magick++.h"
#include "Image.h"

using namespace Magick;

int main()
{
  Image   anImage;

  ssize_t  max_length = 0;
  ssize_t  foo_len;
  ssize_t  copied_str_len = 0;
  ssize_t  buff_len = 4096;
  size_t   rows = 0;
  std::string foo("12345678901234567890\n12345678901234567890");
  std::string bf = "";
  char bar[buff_len];

  max_length=sizeof(foo) - 1;
  foo_len=foo.length();
  printf ("foo length %zd bytes.\n", foo_len);

  printf ( "Maximum length: %zd\n", max_length);
  printf ("Rows: %zd\n", rows);
  try {bf = anImage.baseFilename();}
  catch (Error& my_error) {printf ("%s", my_error.what());}
  catch (...) {printf ("Unhandled error\n");}
  printf ("Rows: %zd\n", rows);
    printf ("baseFilename: %s\n", anImage.baseFilename().c_str());

  printf ("Copied string length: %zd\n", copied_str_len);
  printf ("bar: \n%s\n", bar);
}

Under GNAT GPS it produces:
foo length 41 bytes.
Maximum length: 7
Rows: 0
[2018-06-26 18:02:10] process terminated successfully, elapsed time: 00.73s
So it appears to terminate after the first  printf ("Rows: %zd\n", rows);
That is, it terminates during the call to  anImage.baseFilename();

When I run the executable from the terminal:
foo length 41 bytes.
Maximum length: 7
Rows: 0
Segmentation fault: 11

Running the same code under XCode produces.

foo length 41 bytes.
Maximum length: 23
Rows: 0
Rows: 0
baseFilename: 
Copied string length: 0
bar: 

Program ended with exit code: 0
 The code above is a cut down version of my test code.
The complete version works under XCode.

 The problem seems to concern C++ string processing.
A problem that one of my build attempts reported  appeared to concern the string Swap function being unable to handle null parameters.
Unfortunately, I can't recall how I got that information.

I have tried numerous methods to solve this problem but am unable to. It seems that GNAT is using a different C++ compiler to XCode but I've had no success trying to remedy that idea.

Positive advice on how to proceed will be greatly appreciated.


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

* Re: Problem Building Ada Interface To ImageMagick 7
  2018-06-26  8:28 Problem Building Ada Interface To ImageMagick 7 Roger
@ 2018-06-26  9:26 ` alby.gamper
  2018-06-26 11:58   ` Roger
                     ` (2 more replies)
  2018-06-26  9:34 ` gautier_niouzes
  1 sibling, 3 replies; 25+ messages in thread
From: alby.gamper @ 2018-06-26  9:26 UTC (permalink / raw)


On Tuesday, June 26, 2018 at 6:28:57 PM UTC+10, Roger wrote:
> OSX 10.13.5
> GNAT community 2018
> XCode 9.4.1
> 
> ImageMagic Libraries:
> libMagick++-7.Q16HDRI
> libMagickCore-7.Q16HDRI
> 
> I have been developing some Ada Interfaces To ImageMagick 7 but have come to a problem that I need help with.
> I built the ImageMagick libraries with:
> CC=clang CXX="clang++ -std=c++11 -stdlib=libc++ -g -O0"  CFLAGS="-g -O0" CXXFLAGS="-g -O0" ./configure --prefix=/opt --with-quantum-depth=16 --disable-dependency-tracking --without-perl
> I enabled debugging (-g) to allow me to track through the ImageMagick code , C++ in particular which I find almost impossible to reverse engineer from the source alone.
> My C++ capabilities are very limited.
> 
> The following code works OK under XCode but crashes (segmentation fault) under GNAT.
> 
> #include <string>
> #include <stdio.h>
> #include "/opt/include/ImageMagick-7/Magick++.h"
> #include "Image.h"
> 
> using namespace Magick;
> 
> int main()
> {
>   Image   anImage;
> 
>   ssize_t  max_length = 0;
>   ssize_t  foo_len;
>   ssize_t  copied_str_len = 0;
>   ssize_t  buff_len = 4096;
>   size_t   rows = 0;
>   std::string foo("12345678901234567890\n12345678901234567890");
>   std::string bf = "";
>   char bar[buff_len];
> 
>   max_length=sizeof(foo) - 1;
>   foo_len=foo.length();
>   printf ("foo length %zd bytes.\n", foo_len);
> 
>   printf ( "Maximum length: %zd\n", max_length);
>   printf ("Rows: %zd\n", rows);
>   try {bf = anImage.baseFilename();}
>   catch (Error& my_error) {printf ("%s", my_error.what());}
>   catch (...) {printf ("Unhandled error\n");}
>   printf ("Rows: %zd\n", rows);
>     printf ("baseFilename: %s\n", anImage.baseFilename().c_str());
> 
>   printf ("Copied string length: %zd\n", copied_str_len);
>   printf ("bar: \n%s\n", bar);
> }
> 
> Under GNAT GPS it produces:
> foo length 41 bytes.
> Maximum length: 7
> Rows: 0
> [2018-06-26 18:02:10] process terminated successfully, elapsed time: 00.73s
> So it appears to terminate after the first  printf ("Rows: %zd\n", rows);
> That is, it terminates during the call to  anImage.baseFilename();
> 
> When I run the executable from the terminal:
> foo length 41 bytes.
> Maximum length: 7
> Rows: 0
> Segmentation fault: 11
> 
> Running the same code under XCode produces.
> 
> foo length 41 bytes.
> Maximum length: 23
> Rows: 0
> Rows: 0
> baseFilename: 
> Copied string length: 0
> bar: 
> 
> Program ended with exit code: 0
>  The code above is a cut down version of my test code.
> The complete version works under XCode.
> 
>  The problem seems to concern C++ string processing.
> A problem that one of my build attempts reported  appeared to concern the string Swap function being unable to handle null parameters.
> Unfortunately, I can't recall how I got that information.
> 
> I have tried numerous methods to solve this problem but am unable to. It seems that GNAT is using a different C++ compiler to XCode but I've had no success trying to remedy that idea.
> 
> Positive advice on how to proceed will be greatly appreciated.

Hi Roger

GNAT uses the GCC "C/C++" compiler or more specifically GNAT is actually part of GCC (GNU compiler collection"). GNAT community edition 2018 uses gcc version 7.3

As far as I am aware XCode uses the LLVM/CLANG C/C++ compiler

Alex

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

* Re: Problem Building Ada Interface To ImageMagick 7
  2018-06-26  8:28 Problem Building Ada Interface To ImageMagick 7 Roger
  2018-06-26  9:26 ` alby.gamper
@ 2018-06-26  9:34 ` gautier_niouzes
  2018-06-26 11:51   ` Roger
  2018-06-26 13:13   ` Roger
  1 sibling, 2 replies; 25+ messages in thread
From: gautier_niouzes @ 2018-06-26  9:34 UTC (permalink / raw)


Is there something specific you want to do with ImageMagick ?

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

* Re: Problem Building Ada Interface To ImageMagick 7
  2018-06-26  9:34 ` gautier_niouzes
@ 2018-06-26 11:51   ` Roger
  2018-06-26 13:13   ` Roger
  1 sibling, 0 replies; 25+ messages in thread
From: Roger @ 2018-06-26 11:51 UTC (permalink / raw)


On Tuesday, June 26, 2018 at 7:34:57 PM UTC+10, gautier...@hotmail.com wrote:
> Is there something specific you want to do with ImageMagick ?

This is a long drawn out story.
I am involved in providing an Ada interface to OpenGL Ada and have converted many OpenGL tutorials examples to Ada.
Recently I came across an excellent set of tutorials that use ImageMagick to some extent.
This set me off on the track of developing an Ada interface to  ImageMagick.
At the moment the "something specific " is probably just to read an image file which doesn't sound like much I suppose.


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

* Re: Problem Building Ada Interface To ImageMagick 7
  2018-06-26  9:26 ` alby.gamper
@ 2018-06-26 11:58   ` Roger
  2018-06-26 12:35     ` alby.gamper
  2018-06-26 18:58   ` Jacob Sparre Andersen
  2018-06-30  1:25   ` Roger
  2 siblings, 1 reply; 25+ messages in thread
From: Roger @ 2018-06-26 11:58 UTC (permalink / raw)


On Tuesday, June 26, 2018 at 7:26:46 PM UTC+10, alby....@gmail.com wrote:
 
> Hi Roger
> 
> GNAT uses the GCC "C/C++" compiler or more specifically GNAT is actually part of GCC (GNU compiler collection"). GNAT community edition 2018 uses gcc version 7.3
> 
> As far as I am aware XCode uses the LLVM/CLANG C/C++ compiler
> 
> Alex

This confirms what I thought.
What I think need then is some way of telling GNAT to use the LLVM/CLANG C/C++ compiler instead of the GCC "C/C++" compiler.
I've made some attempts to use gprconfig to generate a suitable .cgpr file but so far without success.


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

* Re: Problem Building Ada Interface To ImageMagick 7
  2018-06-26 11:58   ` Roger
@ 2018-06-26 12:35     ` alby.gamper
  2018-06-26 13:43       ` Roger
  0 siblings, 1 reply; 25+ messages in thread
From: alby.gamper @ 2018-06-26 12:35 UTC (permalink / raw)


On Tuesday, June 26, 2018 at 9:58:06 PM UTC+10, Roger wrote:
> On Tuesday, June 26, 2018 at 7:26:46 PM UTC+10, alby....@gmail.com wrote:
>  
> > Hi Roger
> > 
> > GNAT uses the GCC "C/C++" compiler or more specifically GNAT is actually part of GCC (GNU compiler collection"). GNAT community edition 2018 uses gcc version 7.3
> > 
> > As far as I am aware XCode uses the LLVM/CLANG C/C++ compiler
> > 
> > Alex
> 
> This confirms what I thought.
> What I think need then is some way of telling GNAT to use the LLVM/CLANG C/C++ compiler instead of the GCC "C/C++" compiler.
> I've made some attempts to use gprconfig to generate a suitable .cgpr file but so far without success.

Hi Roger

I very recently had an issue with building gprbuild natively on mingw64
and raised an issue on the AdaCore GitHub repo, which has now been resolved.
(with their input / guidance) and I must say relatively quickly, given
time zone differences between Australia and Europe.

Maybe they can assist you in the configuring gprconfig so as to be able to
use LLVM (it should not be that difficult as I believe LLVM/GGC are 
compatible wrt command line arguments! so it should just be a matter of
replacing ggc.exe with the equivalent llvm.exe somewher in their configs

have a look at their Ada Gems/Blogs or the git repo (specifically the 
share/gprconfig/ xml files) for hints/solutions. You may have to tweak
a xml config file to get GANT/gprbuild to use LLVM

Alex


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

* Re: Problem Building Ada Interface To ImageMagick 7
  2018-06-26  9:34 ` gautier_niouzes
  2018-06-26 11:51   ` Roger
@ 2018-06-26 13:13   ` Roger
  2018-06-26 16:28     ` gautier_niouzes
  2018-06-27 12:34     ` Stephen Leake
  1 sibling, 2 replies; 25+ messages in thread
From: Roger @ 2018-06-26 13:13 UTC (permalink / raw)


On Tuesday, June 26, 2018 at 7:34:57 PM UTC+10, gautier...@hotmail.com wrote:
> Is there something specific you want to do with ImageMagick ?

The current specific thing I'm trying to do (in support of a larger project) is to get ImageMagick to read an image file and writing the image to another file.
I am using a simple ImageMagick tutorial to do this.
The tutorial read and write functions work when built as an XCode project but fail as a GNAT GPS project.
The code that I posted constitutes some of my attempts to track the problem.

Following is the tutorial code which builds and runs properly with XCode but fails under GNAT:
//  main.cpp
//  ImageMagick_Test

#include <Magick++.h>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>

using namespace std;
using namespace Magick; 

int main(int argc, const char * argv[]) {
    InitializeMagick(*argv);
    
    // Construct the image object. Seperating image construction from the
    // the read operation ensures that a failure to read the image file
    // doesn't render the image object useless.
    Image image;

    try {
        // Read a file into image object
        image.read( "logo:" );
        
        // Crop the image to specified size (width, height, xOffset, yOffset)
        image.crop( Geometry(100,100, 100, 100) );
        
        // Write the image to a file
        image.write( "../../../../logo.png" );
    }
    catch( Exception &error_ )
    {
        cout << "Caught exception: " << error_.what() << endl;
        return 1;
    } 
    return 0;
}

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

* Re: Problem Building Ada Interface To ImageMagick 7
  2018-06-26 12:35     ` alby.gamper
@ 2018-06-26 13:43       ` Roger
  2018-06-27  2:08         ` Roger
  0 siblings, 1 reply; 25+ messages in thread
From: Roger @ 2018-06-26 13:43 UTC (permalink / raw)


On Tuesday, June 26, 2018 at 10:35:08 PM UTC+10, alby....@gmail.com wrote:
> 
> Hi Roger
> 
> I very recently had an issue with building gprbuild natively on mingw64
> and raised an issue on the AdaCore GitHub repo, which has now been resolved.
> (with their input / guidance) and I must say relatively quickly, given
> time zone differences between Australia and Europe.
> 
> Maybe they can assist you in the configuring gprconfig so as to be able to
> use LLVM (it should not be that difficult as I believe LLVM/GGC are 
> compatible wrt command line arguments! so it should just be a matter of
> replacing ggc.exe with the equivalent llvm.exe somewher in their configs
> 
> have a look at their Ada Gems/Blogs or the git repo (specifically the 
> share/gprconfig/ xml files) for hints/solutions. You may have to tweak
> a xml config file to get GANT/gprbuild to use LLVM
> 
> Alex

Thanks Alex,
I'll try the AdaCore GitHub repo issue request.
As you say it should not be that difficult for those with the right experience.

A strange thing is that gprconfig finds llvm for C in /usr/bin
but only g++ in GNAT for C++  when /usr/bin contains clang, clang++ and g++


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

* Re: Problem Building Ada Interface To ImageMagick 7
  2018-06-26 13:13   ` Roger
@ 2018-06-26 16:28     ` gautier_niouzes
  2018-06-26 17:47       ` Roger
  2018-06-26 18:14       ` Roger
  2018-06-27 12:34     ` Stephen Leake
  1 sibling, 2 replies; 25+ messages in thread
From: gautier_niouzes @ 2018-06-26 16:28 UTC (permalink / raw)


Did you consider GID : https://gen-img-dec.sourceforge.io/ ?...

It's fully in Ada. You don't need to mess with C++ strings, segmentation faults and so on.

You can write a .bmp (example provided with GID) image, or a .pbm, or an uncompressed .png, or a compressed .png via http://png-io.sourceforge.net/ .

HTH
G.

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

* Re: Problem Building Ada Interface To ImageMagick 7
  2018-06-26 16:28     ` gautier_niouzes
@ 2018-06-26 17:47       ` Roger
  2018-06-26 18:14       ` Roger
  1 sibling, 0 replies; 25+ messages in thread
From: Roger @ 2018-06-26 17:47 UTC (permalink / raw)


On Wednesday, June 27, 2018 at 2:28:49 AM UTC+10, gautier...@hotmail.com wrote:
> Did you consider GID : https://gen-img-dec.sourceforge.io/ ?...
> 
> It's fully in Ada. You don't need to mess with C++ strings, segmentation faults and so on.
> 
> You can write a .bmp (example provided with GID) image, or a .pbm, or an uncompressed .png, or a compressed .png via http://png-io.sourceforge.net/ .
> 
> HTH
> G.

Thanks, I'll look into it.

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

* Re: Problem Building Ada Interface To ImageMagick 7
  2018-06-26 16:28     ` gautier_niouzes
  2018-06-26 17:47       ` Roger
@ 2018-06-26 18:14       ` Roger
  2018-06-26 18:38         ` gautier_niouzes
  1 sibling, 1 reply; 25+ messages in thread
From: Roger @ 2018-06-26 18:14 UTC (permalink / raw)


On Wednesday, June 27, 2018 at 2:28:49 AM UTC+10, gautier...@hotmail.com wrote:
> Did you consider GID : https://gen-img-dec.sourceforge.io/ ?...
> 
> It's fully in Ada. You don't need to mess with C++ strings, segmentation faults and so on.
> 
> You can write a .bmp (example provided with GID) image, or a .pbm, or an uncompressed .png, or a compressed .png via http://png-io.sourceforge.net/ .
> 
> HTH
> G.

Looks interesting but unfortunately the downloaded zip file fails to decompress

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

* Re: Problem Building Ada Interface To ImageMagick 7
  2018-06-26 18:14       ` Roger
@ 2018-06-26 18:38         ` gautier_niouzes
  2018-06-27  2:11           ` Roger
  2018-06-27  7:04           ` Dmitry A. Kazakov
  0 siblings, 2 replies; 25+ messages in thread
From: gautier_niouzes @ 2018-06-26 18:38 UTC (permalink / raw)


> Looks interesting but unfortunately the downloaded zip file fails to decompress

Use 7z or zip-ada or any recent unzipper.

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

* Re: Problem Building Ada Interface To ImageMagick 7
  2018-06-26  9:26 ` alby.gamper
  2018-06-26 11:58   ` Roger
@ 2018-06-26 18:58   ` Jacob Sparre Andersen
  2018-06-30  1:25   ` Roger
  2 siblings, 0 replies; 25+ messages in thread
From: Jacob Sparre Andersen @ 2018-06-26 18:58 UTC (permalink / raw)


alby.gamper@gmail.com writes:

> GNAT uses the GCC "C/C++" compiler or more specifically GNAT is
> actually part of GCC (GNU compiler collection"). GNAT community
> edition 2018 uses gcc version 7.3

Yes.  And when you make Ada bindings to C or C++ with GNAT, they are
specific to the GCC ABI's for C and C++.

> As far as I am aware XCode uses the LLVM/CLANG C/C++ compiler

If you want to make a GNAT binding to LLVM compiled C or C++, you will
have to manually handle any ABI differences.

Greetings,

Jacob
-- 
<URL: small-talk://work/hallway-meeting/...>


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

* Re: Problem Building Ada Interface To ImageMagick 7
  2018-06-26 13:43       ` Roger
@ 2018-06-27  2:08         ` Roger
  0 siblings, 0 replies; 25+ messages in thread
From: Roger @ 2018-06-27  2:08 UTC (permalink / raw)


On Tuesday, June 26, 2018 at 11:43:04 PM UTC+10, Roger wrote:

I tried an AdaCore GitHub repo issue request and got an almost instant response.

Although I couldn't get the advice to work, it gave me enough confidence to solve the problem myself.
I simply changed the C++ Driver in the generated config file to clang++ and then after some further additions to my GPS Project settings my code built an ran successfully.

The AdaCore response did advise that they'd hadn't included C++ in their LLVM declaration of the compiler.xml file.
Hopefully, I've provided them with enough information to fully cater for C++.
Thanks for your most valuable advice.

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

* Re: Problem Building Ada Interface To ImageMagick 7
  2018-06-26 18:38         ` gautier_niouzes
@ 2018-06-27  2:11           ` Roger
  2018-06-27  4:55             ` gautier_niouzes
  2018-06-27  7:04           ` Dmitry A. Kazakov
  1 sibling, 1 reply; 25+ messages in thread
From: Roger @ 2018-06-27  2:11 UTC (permalink / raw)


On Wednesday, June 27, 2018 at 4:38:23 AM UTC+10, gautier...@hotmail.com wrote:
> > Looks interesting but unfortunately the downloaded zip file fails to decompress
> 
> Use 7z or zip-ada or any recent unzipper.

I'm not sure what you mean by this.
Can you provide some more detailed instructions?
I have downloaded zip-ada but can't really see how to use it.
Thanks

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

* Re: Problem Building Ada Interface To ImageMagick 7
  2018-06-27  2:11           ` Roger
@ 2018-06-27  4:55             ` gautier_niouzes
  2018-06-27  7:07               ` Roger
  0 siblings, 1 reply; 25+ messages in thread
From: gautier_niouzes @ 2018-06-27  4:55 UTC (permalink / raw)


Back to GID: if you go here

https://sourceforge.net/p/gen-img-dec/code/HEAD/tree/

you can click on "Download Snapshot" and get a .zip file that should be fine.

Alternative site:

https://github.com/svn2github/gid

("Clone or download").

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

* Re: Problem Building Ada Interface To ImageMagick 7
  2018-06-26 18:38         ` gautier_niouzes
  2018-06-27  2:11           ` Roger
@ 2018-06-27  7:04           ` Dmitry A. Kazakov
  2018-06-27  7:12             ` Roger
  2018-06-27  9:59             ` gautier_niouzes
  1 sibling, 2 replies; 25+ messages in thread
From: Dmitry A. Kazakov @ 2018-06-27  7:04 UTC (permalink / raw)


On 2018-06-26 20:38, gautier_niouzes@hotmail.com wrote:
>> Looks interesting but unfortunately the downloaded zip file fails to decompress
> 
> Use 7z or zip-ada or any recent unzipper.

Many older versions of browsers have bugs in downloading archive files. 
Before blaming an archiver, I would try to download the file using wget.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

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

* Re: Problem Building Ada Interface To ImageMagick 7
  2018-06-27  4:55             ` gautier_niouzes
@ 2018-06-27  7:07               ` Roger
  2018-06-27  7:28                 ` gautier_niouzes
  0 siblings, 1 reply; 25+ messages in thread
From: Roger @ 2018-06-27  7:07 UTC (permalink / raw)


On Wednesday, June 27, 2018 at 2:56:00 PM UTC+10, gautier...@hotmail.com wrote:
> Back to GID: if you go here
> 
> https://sourceforge.net/p/gen-img-dec/code/HEAD/tree/
> 
> you can click on "Download Snapshot" and get a .zip file that should be fine.
> 
> Alternative site:
> 
> https://github.com/svn2github/gid
> 
> ("Clone or download").

Thanks,
I've downloaded and built it using GPS.
I just have to learn how to use it.


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

* Re: Problem Building Ada Interface To ImageMagick 7
  2018-06-27  7:04           ` Dmitry A. Kazakov
@ 2018-06-27  7:12             ` Roger
  2018-06-27  9:59             ` gautier_niouzes
  1 sibling, 0 replies; 25+ messages in thread
From: Roger @ 2018-06-27  7:12 UTC (permalink / raw)


On Wednesday, June 27, 2018 at 5:04:19 PM UTC+10, Dmitry A. Kazakov wrote:

> Many older versions of browsers have bugs in downloading archive files. 
> Before blaming an archiver, I would try to download the file using wget.
> 
> -- 
> Regards,
> Dmitry A. Kazakov
> http://www.dmitry-kazakov.de

Thanlks,
However, I have now downloaded successfully in accordance with gautier's instructions.
My browser is Safari 11.1.1.

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

* Re: Problem Building Ada Interface To ImageMagick 7
  2018-06-27  7:07               ` Roger
@ 2018-06-27  7:28                 ` gautier_niouzes
  2018-06-27  8:05                   ` Roger
  0 siblings, 1 reply; 25+ messages in thread
From: gautier_niouzes @ 2018-06-27  7:28 UTC (permalink / raw)


> Thanks,
> I've downloaded and built it using GPS.
> I just have to learn how to use it.

I suggest to begin with:

test/mini.adb

A more elaborated example (but certainly more difficult to understand), which includes handling of transparency (GIF, PNG, TGA), orientation (JPEG) and animation (GIF) is there:

test/to_bmp.adb


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

* Re: Problem Building Ada Interface To ImageMagick 7
  2018-06-27  7:28                 ` gautier_niouzes
@ 2018-06-27  8:05                   ` Roger
  0 siblings, 0 replies; 25+ messages in thread
From: Roger @ 2018-06-27  8:05 UTC (permalink / raw)


On Wednesday, June 27, 2018 at 5:28:03 PM UTC+10, gautier...@hotmail.com wrote:
> I suggest to begin with:
> 
> test/mini.adb
> 
> A more elaborated example (but certainly more difficult to understand), which includes handling of transparency (GIF, PNG, TGA), orientation (JPEG) and animation (GIF) is there:
> 
> test/to_bmp.adb

Thanks for your advice.

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

* Re: Problem Building Ada Interface To ImageMagick 7
  2018-06-27  7:04           ` Dmitry A. Kazakov
  2018-06-27  7:12             ` Roger
@ 2018-06-27  9:59             ` gautier_niouzes
  1 sibling, 0 replies; 25+ messages in thread
From: gautier_niouzes @ 2018-06-27  9:59 UTC (permalink / raw)


I've checked, it's my fault: I tend to use a too recent version of the Zip format (2006) with more compression sub-formats, but which is supported by less archivers.
Some of them support only the Deflate compression sub-format, which corresponds to the Zip format of 1989.

We have a similar situation with Ada: if you program with Ada 2012 you'll have less compilers available and run into compatibility issues when switching compilers...

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

* Re: Problem Building Ada Interface To ImageMagick 7
  2018-06-26 13:13   ` Roger
  2018-06-26 16:28     ` gautier_niouzes
@ 2018-06-27 12:34     ` Stephen Leake
  2018-06-27 12:41       ` Roger
  1 sibling, 1 reply; 25+ messages in thread
From: Stephen Leake @ 2018-06-27 12:34 UTC (permalink / raw)


On Tuesday, June 26, 2018 at 8:13:03 AM UTC-5, Roger wrote:
> On Tuesday, June 26, 2018 at 7:34:57 PM UTC+10, gautier...@hotmail.com wrote:
> > Is there something specific you want to do with ImageMagick ?
> 
> The current specific thing I'm trying to do (in support of a larger project) is to get ImageMagick to read an image file and writing the image to another file.

One way to do this is to use gnat.os_lib spawn, and run the imagemagick executable. For example, I have this:

   procedure To_Jpeg (I : in Cursor)
   is
      use GNAT.OS_Lib;
      Filename     : constant String  := Element (I);
      Ext_First    : constant Integer := Filename'Last - 3;
      Jpg_Filename : constant String  := Filename (Filename'First .. Ext_First - 1) & ".jpg";
      Success      : Boolean;
   begin
      --  Calling 64 bit cygwin 'convert' from 32 bit native GNAT
      --  screws up, so we use a 32 bit native install of ImageMagick.
      Spawn ("d:/Apps/ImageMagick-7.0.3-Q8/magick.exe",
             (new String'("convert"),
              new String'(Filename),
              new String'("-quality"),
              new String'("50"), -- good for fine text, reasonably small
              new String'(Jpg_Filename)), Success);

      if not Success then
         raise Ada.Text_IO.Use_Error with "convert failed";
      end if;

      File_Names.Replace_Element (I, Jpg_Filename);
   end To_Jpeg;

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

* Re: Problem Building Ada Interface To ImageMagick 7
  2018-06-27 12:34     ` Stephen Leake
@ 2018-06-27 12:41       ` Roger
  0 siblings, 0 replies; 25+ messages in thread
From: Roger @ 2018-06-27 12:41 UTC (permalink / raw)


Thanks for the suggestion which I hope to try.
However, I am using a Mac, so it might not be as easy.


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

* Re: Problem Building Ada Interface To ImageMagick 7
  2018-06-26  9:26 ` alby.gamper
  2018-06-26 11:58   ` Roger
  2018-06-26 18:58   ` Jacob Sparre Andersen
@ 2018-06-30  1:25   ` Roger
  2 siblings, 0 replies; 25+ messages in thread
From: Roger @ 2018-06-30  1:25 UTC (permalink / raw)



I have solved the problem. The code that I referred to now builds and runs without problem.
In order to build C++ programs with GNAT via GNAT GPS, LLVM compilers must be used.
However, gprconfig included in AdaCore's Community version of GNAT 2018 did not fully support LLVM.
AdaCore have now fixed that.
To use C++ with AdaCore GNAT 2018, the latest version of gprbuild needs to be downloaded from https://github.com/AdaCore/gprbuild.
The downloaded gprbuild then should be built and installed in GNAT 2018.
gprconfig will then provide selections for LLVM for both C and C++ which can be used to generate a default.cpgr file suitable for inclusion in gprbuild instructions.

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

end of thread, other threads:[~2018-06-30  1:25 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-26  8:28 Problem Building Ada Interface To ImageMagick 7 Roger
2018-06-26  9:26 ` alby.gamper
2018-06-26 11:58   ` Roger
2018-06-26 12:35     ` alby.gamper
2018-06-26 13:43       ` Roger
2018-06-27  2:08         ` Roger
2018-06-26 18:58   ` Jacob Sparre Andersen
2018-06-30  1:25   ` Roger
2018-06-26  9:34 ` gautier_niouzes
2018-06-26 11:51   ` Roger
2018-06-26 13:13   ` Roger
2018-06-26 16:28     ` gautier_niouzes
2018-06-26 17:47       ` Roger
2018-06-26 18:14       ` Roger
2018-06-26 18:38         ` gautier_niouzes
2018-06-27  2:11           ` Roger
2018-06-27  4:55             ` gautier_niouzes
2018-06-27  7:07               ` Roger
2018-06-27  7:28                 ` gautier_niouzes
2018-06-27  8:05                   ` Roger
2018-06-27  7:04           ` Dmitry A. Kazakov
2018-06-27  7:12             ` Roger
2018-06-27  9:59             ` gautier_niouzes
2018-06-27 12:34     ` Stephen Leake
2018-06-27 12:41       ` Roger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox