From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 2002:a6b:6315:: with SMTP id p21-v6mr169479iog.43.1530001736456; Tue, 26 Jun 2018 01:28:56 -0700 (PDT) X-Received: by 2002:aca:c6ca:: with SMTP id w193-v6mr74454oif.1.1530001736350; Tue, 26 Jun 2018 01:28:56 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.uzoreto.com!weretis.net!feeder6.news.weretis.net!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!u78-v6no543430itb.0!news-out.google.com!p13-v6ni607itf.0!nntp.google.com!u78-v6no543429itb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 26 Jun 2018 01:28:56 -0700 (PDT) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=124.171.158.113; posting-account=d51RWwoAAADvR-x0zYAtT9z3CRxT1eXo NNTP-Posting-Host: 124.171.158.113 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Problem Building Ada Interface To ImageMagick 7 From: Roger Injection-Date: Tue, 26 Jun 2018 08:28:56 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader02.eternal-september.org comp.lang.ada:53318 Date: 2018-06-26T01:28:56-07:00 List-Id: 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 #include #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.