Page MenuHome GnuPG

AIX: libgcrypt-1.7.8 compile errors
Closed, ResolvedPublic

Description

build with ibm's xlc throws an error and stops.

/usr/bin/ksh ../libtool  --tag=CC   --mode=compile xlc_r -D_LARGE_FILES -DHAVE_CONFIG_H -I. -I..    -I/opt/freeware/include -qmaxmem=16384 -qlanglvl=extc99 -qbitfields=unsigned -qhalt=s -DSYSV -D_AIX -D_AIX32 -D_AIX41 -D_AIX43 -D_AIX51 -D_AIX52 -D_AIX53 -D_AIX61 -D_AIX71 -D_ALL_SOURCE -DFUNCPROTO=15 -O -I/opt/freeware/include -c -o libgcrypt_la-visibility.lo `test -f 'visibility.c' || echo './'`visibility.c
libtool: compile:  xlc_r -D_LARGE_FILES -DHAVE_CONFIG_H -I. -I.. -I/opt/freeware/include -qmaxmem=16384 -qlanglvl=extc99 -qbitfields=unsigned -qhalt=s -DSYSV -D_AIX -D_AIX32 -D_AIX41 -D_AIX43 -D_AIX51 -D_AIX52 -D_AIX53 -D_AIX61 -D_AIX71 -D_ALL_SOURCE -DFUNCPROTO=15 -O -I/opt/freeware/include -c visibility.c -Wp,-qmakedep=gcc,-MF.deps/libgcrypt_la-visibility.TPlo  -DPIC -o .libs/libgcrypt_la-visibility.o
"visibility.c", line 61.1: 1506-343 (S) Redeclaration of gcry_error_from_errno differs from previous declaration on line 192 of "gcrypt.h".
"visibility.c", line 61.1: 1506-050 (I) Return type "unsigned int" in redeclaration is not compatible with the previous return type "enum {...}".
"visibility.c", line 1178.1: 1506-343 (S) Redeclaration of gcry_md_extract differs from previous declaration on line 1293 of "gcrypt.h".
"visibility.c", line 1178.1: 1506-050 (I) Return type "enum {...}" in redeclaration is not compatible with the previous return type "unsigned int".
Makefile:798: recipe for target 'libgcrypt_la-visibility.lo' failed
gmake[2]: *** [libgcrypt_la-visibility.lo] Error 1
gmake[2]: Leaving directory '/opt/freeware/src/packages/BUILD/libgcrypt-1.7.8/src'
Makefile:477: recipe for target 'all-recursive' failed
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory '/opt/freeware/src/packages/BUILD/libgcrypt-1.7.8'
Makefile:408: recipe for target 'all' failed
gmake: *** [all] Error 2
error: Bad exit status from /var/tmp/rpm-tmp.aflaab (%build)

spec file

Name: libgcrypt
Version: 1.7.8
Release: 1
Source0: ftp://ftp.gnupg.org/gcrypt/%{name}/%{name}-%{version}.tar.bz2
Source1: ftp://ftp.gnupg.org/gcrypt/%{name}/%{name}-%{version}.tar.bz2.sig
Source2: %{name}.so.11-aix32
Source3: %{name}.so.11-aix64
Patch0: %{name}-%{version}-aix.patch
Group: System Environment/Libraries
License: LGPL
Summary: A general-purpose cryptography library.
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: libgpg-error-devel >= 1.27-1, pkg-config
Requires: libgpg-error >= 1.27-1

%ifos aix5.1
BuildRequires: prngd
Requires: prngd
Requires: AIX-rpm >= 5.1.0.0
Requires: AIX-rpm < 5.2.0.0
%else
Requires: AIX-rpm >= 5.2.0.0
%endif

%description
Libgcrypt is a general purpose crypto library based on the code used
in GNU Privacy Guard.

The library is available as 32-bit and 64-bit.


%package devel
Summary: Development files for the %{name} package.
Group: Development/Libraries
Requires: /sbin/install-info
Requires: info
Requires: libgpg-error-devel >= 1.27-1
Requires: %{name} = %{version}-%{release}

%description devel
Libgcrypt is a general purpose crypto library based on the code used
in GNU Privacy Guard.  This package contains files needed to develop
applications using libgcrypt.

If you are compiling a 32-bit program, no special compiler options are
needed.

If you are compiling a 64-bit program, you have to compile and link your
application with "xlc_r -q64" or "gcc -maix64".


%prep
%setup -q
%patch0 -p1


%build
# setup environment for 32-bit and 64-bit builds
export CONFIG_SHELL=/usr/bin/ksh
export CONFIG_ENV_ARGS=/usr/bin/ksh

export CC="xlc_r -D_LARGE_FILES"
export CFLAGS="-qmaxmem=16384 -qlanglvl=extc99 -qbitfields=unsigned -qhalt=s -DSYSV -D_AIX -D_AIX32 -D_AIX41 -D_AIX43 -D_AIX51 -D_AIX52 \
-D_AIX53 -D_AIX61 -D_AIX71 -D_ALL_SOURCE -DFUNCPROTO=15 -O -I/opt/freeware/include"
export AR="ar -X32_64"
export NM="nm -X32_64"

# first build the 64-bit version
export OBJECT_MODE=64
export LDFLAGS="-L/opt/freeware/lib64 -Wl,-blibpath:/opt/freeware/lib64:/usr/lib:/lib -Wl,-bmaxdata:0x80000000 -Wl,-bexpall"
./configure \
    --prefix=%{_prefix} \
    --infodir=%{_infodir} \
    --enable-shared --enable-static \
    --disable-aesni-support \
    --disable-pclmul-support \
    --disable-avx-support \
    --disable-avx2-support \
    --disable-neon-support \
    --disable-amd64-as-feature-detection \
    --disable-asm
gmake %{?_smp_mflags}

cp src/.libs/%{name}.so.20 .
gmake distclean

# now build the 32-bit version
export OBJECT_MODE=32
export LDFLAGS="-L/opt/freeware/lib -Wl,-blibpath:/opt/freeware/lib:/usr/lib:/lib -Wl,-bmaxdata:0x80000000 -Wl,-bexpall"
./configure \
    --prefix=%{_prefix} \
    --infodir=%{_infodir} \
    --enable-static --enable-shared \
    --disable-asm
gmake %{?_smp_mflags}

# add the 64-bit shared objects to the shared library containing already the
# 32-bit shared objects
${AR} -q src/.libs/%{name}.a ./%{name}.so.20

# Add the older 1.5.4 shared members for compatibility with older apps
# (gmake sure they're set for LOADONLY with 'strip -e')
cp %{SOURCE2} %{name}.so.11
/usr/bin/strip -X32 -e %{name}.so.11
/usr/bin/ar -X32 -q src/.libs/%{name}.a ./%{name}.so.11
cp %{SOURCE3} %{name}.so.11
/usr/bin/strip -X64 -e %{name}.so.11
/usr/bin/ar -X64 -q src/.libs/%{name}.a ./%{name}.so.11


%install
[ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT}
gmake DESTDIR=${RPM_BUILD_ROOT} install

/usr/bin/strip ${RPM_BUILD_ROOT}%{_bindir}/* || :

rm -f ${RPM_BUILD_ROOT}%{_infodir}/dir
gzip --best ${RPM_BUILD_ROOT}%{_infodir}/gcrypt.info

(
  cd ${RPM_BUILD_ROOT}
  for dir in bin include lib
  do
    mkdir -p usr/${dir}
    cd usr/${dir}
    ln -sf ../..%{_prefix}/${dir}/* .
    cd -
  done
)


%post devel
/sbin/install-info %{_infodir}/gcrypt.info.gz %{_infodir}/dir


%preun devel
if [ $1 = 0 ]; then
    /sbin/install-info --delete %{_infodir}/gcrypt.info.gz %{_infodir}/dir
fi


%clean
[ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT}


%files
%defattr(-,root,system)
%{_bindir}/dumpsexp
%{_bindir}/hmac256
%{_libdir}/*.a
/usr/bin/dumpsexp
/usr/bin/hmac256
/usr/lib/*.a


%files devel
%defattr(-,root,system)
%{_bindir}/%{name}-config
%{_includedir}/*
%{_libdir}/*.la
%{_datadir}/aclocal/*
%{_infodir}/gcrypt.info*
/usr/bin/%{name}-config
/usr/include/*
/usr/lib/*.la

Event Timeline

werner changed the task status from Open to Testing.Jul 5 2017, 8:22 PM
werner triaged this task as Normal priority.
werner added a subscriber: werner.

Oh well, the usual IBM enum/int problems. It bugs me since the OS/2 days. I am not sure why you experienced it only now. One of the wrong return types is there for ages. I pushed fixes for master and 1.7.

Can you please apply them and try them out?

applied the following patch and the package built successfully. thank you!

diff -ruN libgcrypt-1.7.8.ORIG/src/gcrypt-int.h libgcrypt-1.7.8/src/gcrypt-int.h
--- libgcrypt-1.7.8.ORIG/src/gcrypt-int.h       2017-05-03 12:45:22 +0000
+++ libgcrypt-1.7.8/src/gcrypt-int.h    2017-07-05 12:56:25 +0000
@@ -131,7 +131,7 @@
                           void *buffer, size_t buflen);
 void _gcry_md_write (gcry_md_hd_t hd, const void *buffer, size_t length);
 unsigned char *_gcry_md_read (gcry_md_hd_t hd, int algo);
-gpg_error_t _gcry_md_extract (gcry_md_hd_t hd, int algo, void *buffer,
+gcry_err_code_t _gcry_md_extract (gcry_md_hd_t hd, int algo, void *buffer,
                               size_t length);
 void _gcry_md_hash_buffer (int algo, void *digest,
                            const void *buffer, size_t length);
diff -ruN libgcrypt-1.7.8.ORIG/src/visibility.c libgcrypt-1.7.8/src/visibility.c
--- libgcrypt-1.7.8.ORIG/src/visibility.c       2017-05-03 12:45:22 +0000
+++ libgcrypt-1.7.8/src/visibility.c    2017-07-05 16:32:30 +0000
@@ -57,7 +57,7 @@
   return _gcry_err_make_from_errno (source, err);
 }

-gcry_error_t
+gcry_err_code_t
 gcry_error_from_errno (int err)
 {
   return _gcry_error_from_errno (err);
@@ -1174,7 +1174,7 @@
   return _gcry_md_read (hd, algo);
 }

-gcry_err_code_t
+gcry_error_t
 gcry_md_extract (gcry_md_hd_t hd, int algo, void *buffer, size_t length)
 {
   return _gcry_md_extract(hd, algo, buffer, length);
werner claimed this task.