NetBSD Problem Report #54380

From www@netbsd.org  Tue Jul 16 12:44:19 2019
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 8DD6B7A170
	for <gnats-bugs@gnats.NetBSD.org>; Tue, 16 Jul 2019 12:44:19 +0000 (UTC)
Message-Id: <20190716124418.E50B57A1D2@mollari.NetBSD.org>
Date: Tue, 16 Jul 2019 12:44:18 +0000 (UTC)
From: uwe@stderr.spb.ru
Reply-To: uwe@stderr.spb.ru
To: gnats-bugs@NetBSD.org
Subject: devel/apr has unresolved references on NetBSD/macppc
X-Send-Pr-Version: www-1.0

>Number:         54380
>Category:       pkg
>Synopsis:       devel/apr has unresolved references on NetBSD/macppc
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jul 16 12:45:00 +0000 2019
>Originator:     Valery Ushakov
>Release:        pkgsrc-2019Q2
>Organization:
>Environment:
NetBSD pony 8.1_STABLE NetBSD 8.1_STABLE (GENERIC) #0: Sat Jun 15 07:30:17 MSK 2019  uwe@sampo:/home/uwe/work/netbsd/build8/obj/macppc/sys/arch/macppc/compile/GENERIC macppc
>Description:
devel/apr was updated to 1.7.0 in pkgsrc-2019Q2

Building www/apache24 (that depends on devel/apr) on NetBSD/macppc fails with:

/bin/sh /export/netbsd/cvs/pkgsrc-quarterly/www/apache24/work.powerpc/httpd-2.4.39/build/libtool --silent --mode=link gcc  -pthread  -pipe -O2 -D_FORTIFY_SOURCE=2 -I/usr/pkg/include/apr-1 -I/usr/pkg/include -I/usr/include -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -L/usr/lib -Wl,-R/usr/lib -o htpasswd  htpasswd.lo passwd_common.lo /usr/pkg/lib/libaprutil-1.la -lexpat /usr/pkg/lib/libapr-1.la -lrt -lcrypt -lpthread -lcrypt
/export/netbsd/cvs/pkgsrc-quarterly/www/apache24/work.powerpc/.buildlink/lib/libapr-1.so: undefined reference to `__sync_fetch_and_add_8'
/export/netbsd/cvs/pkgsrc-quarterly/www/apache24/work.powerpc/.buildlink/lib/libapr-1.so: undefined reference to `__sync_val_compare_and_swap_8'
/export/netbsd/cvs/pkgsrc-quarterly/www/apache24/work.powerpc/.buildlink/lib/libapr-1.so: undefined reference to `__sync_lock_test_and_set_8'
/export/netbsd/cvs/pkgsrc-quarterly/www/apache24/work.powerpc/.buildlink/lib/libapr-1.so: undefined reference to `__sync_fetch_and_sub_8'
/export/netbsd/cvs/pkgsrc-quarterly/www/apache24/work.powerpc/.buildlink/lib/libapr-1.so: undefined reference to `__sync_sub_and_fetch_8'
*** Error code 1

apr tries to detect if the compiler HAVE_ATOMIC_BUILTINS by doing a
configure test with an unsigned long test variable and it succeeds b/c
ppc has 4-byte atomics.  Then it uses that condition to cover all of
its atomic functions, including 8-byte, which are not implemented on
ppc.  So gcc emits calls to external functions for them and those are
unresolved.

Perhaps apr should do the configure test with a known 8 byte type
instead.

I'd expect this to be the case for many other 32-bit platforms.

Specifically for ppc I was able to work around this by building with
ap_cv_atomic_builtins=no in the environment to force its hand and with
an additional change to include/arch/unix/apr_arch_atomic.h.  That
header tests for ppc by checking __PPC__ and __ppc__ which are not
defined, but doesn't check __powerpc__ which is.

>How-To-Repeat:
Build www/apache24 on NetBSD/macppc
>Fix:
N/A

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.