Hi,

> http://build-failures.rhaalovely.net//powerpc/2019-05-19/misc/openbabel.log
> http://build-failures.rhaalovely.net/arm/2019-04-30/misc/openbabel.log
> http://build-failures.rhaalovely.net/aarch64/2019-06-09/misc/openbabel.log

It's a typical narrowing error we've here.

Upstream has fixes [0] for it, and once applied, it builds fine on
macppc [1] and amd64. 'make test' passes as well.

Comments/feedback are welcome!

Charlène.


[0] https://github.com/openbabel/openbabel/pull/1744
[1] http://0x0.st/zeBS.txt


Index: Makefile
===================================================================
RCS file: /cvs/ports/misc/openbabel/Makefile,v
retrieving revision 1.26
diff -u -p -u -p -r1.26 Makefile
--- Makefile    24 Oct 2018 14:28:08 -0000      1.26
+++ Makefile    16 Jun 2019 07:04:56 -0000
@@ -4,7 +4,7 @@ COMMENT=        chemistry file translation prog
 
 V=             2.2.3
 DISTNAME=      openbabel-${V}
-REVISION=      7
+REVISION=      8
 CATEGORIES=    misc
 
 SUBST_VARS=    V
Index: patches/patch-src_formats_pngformat_cpp
===================================================================
RCS file: patches/patch-src_formats_pngformat_cpp
diff -N patches/patch-src_formats_pngformat_cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_formats_pngformat_cpp     16 Jun 2019 07:04:56 -0000
@@ -0,0 +1,18 @@
+$OpenBSD$
+
+Fix the build on archs where char is unsigned by default (arm,ppc)
+see:
+https://github.com/openbabel/openbabel/commit/e26491017efefdc6aaf73d4d49f284f4e9436244
+
+Index: src/formats/pngformat.cpp
+--- src/formats/pngformat.cpp.orig
++++ src/formats/pngformat.cpp
+@@ -120,7 +120,7 @@ bool PNGFormat::ReadMolecule(OBBase* pOb, OBConversion
+   if(pConv->IsFirstInput())
+     count=0;
+ 
+-  const char pngheader[] = {-119,80,78,71,13,10,26,10,0};
++  const unsigned char pngheader[] = {137,80,78,71,13,10,26,10,0};
+   char readbytes[9];
+   ifs.read(readbytes, 8);
+   
Index: patches/patch-src_formats_yasaraformat_cpp
===================================================================
RCS file: patches/patch-src_formats_yasaraformat_cpp
diff -N patches/patch-src_formats_yasaraformat_cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_formats_yasaraformat_cpp  16 Jun 2019 07:04:56 -0000
@@ -0,0 +1,27 @@
+$OpenBSD$
+
+fix narrowing conversion errors on archs where char is unsigned by default
+(arm, ppc), see 
+https://github.com/openbabel/openbabel/pull/1744
+
+Index: src/formats/yasaraformat.cpp
+--- src/formats/yasaraformat.cpp.orig
++++ src/formats/yasaraformat.cpp
+@@ -478,7 +478,7 @@ bool YOBFormat::WriteMolecule(OBBase* pOb, OBConversio
+ 
+   //  bool hetatom;
+   char buffer[32],/*resname[4],*/atomname[5];
+-  char double1[8]={0,0,0,0,0,0,-16,0x3f};
++  unsigned char double1[8]={0,0,0,0,0,0,0xf0,0x3f};
+   //   char *str;
+   int i,j,/*m,q,*/pos;
+   int /*resno,chainNum,link,linktype,*/atoms,element,links/*,chain*/;
+@@ -506,7 +506,7 @@ bool YOBFormat::WriteMolecule(OBBase* pOb, OBConversio
+   mem_set(buffer,0,8);
+   for (i=0;i<4;i++)
+   { for (j=0;j<4;j++)
+-    { if (i==j) ofs.write(double1,8);
++    { if (i==j) ofs.write((char*)double1,8);
+       else ofs.write(buffer,8); } }
+   storeint32le(buffer,MOB_INFOEND);
+   storeint32le(&buffer[4],MOB_INFOENDSIZE);

Reply via email to