forked from Lainports/freebsd-ports
During an exp-run for llvm 15 (see bug 265425), it turned out that
databases/db5 failed to build with clang 15.
This is caused by db5's configure script attempting to detect TLS but
encountering internal compiler errors while compiling its test cases,
and then concluding TLS does not work at all:
...
checking whether C++ supports the wstring class... checking for thread local storage (TLS) class... none
...
in config.log it shows what is happening:
configure:19128: checking for thread local storage (TLS) class
configure:19164: c++ -c -O2 -pipe -Wall -Wextra -fstack-protector-strong -fno-strict-aliasing -D_THREAD_SAFE conftest.cpp >&5
conftest.cpp:30:72: error: use of undeclared identifier 'NULL'
template<typename T> __thread T* TLSClass<T>::tlsvar = NULL;
^
Assertion failed: (!isValueDependent() && "Expression evaluator can't be called on a dependent expression."), function isConstantInitializer, file /usr/src/contrib/llvm-project/clang/lib/AST/Expr.cpp, line 3184.
PLEASE submit a bug report to https://bugs.freebsd.org/submit/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: c++ -c -O2 -pipe -Wall -Wextra -fstack-protector-strong -fno-strict-aliasing -D_THREAD_SAFE conftest.cpp
1. conftest.cpp:30:76: current parser token ';'
#0 0x00000000053fec51 PrintStackTrace
#/usr/src/contrib/llvm-project/llvm/lib/Support/Unix/Signals.inc:569:13
#1 0x00000000053fcf35 RunSignalHandlers
#/usr/src/contrib/llvm-project/llvm/lib/Support/Signals.cpp:104:18
#2 0x00000000053a591e HandleCrash
#/usr/src/contrib/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:76:5
#3 0x00000000053a5ae3 CrashRecoverySignalHandler
#/usr/src/contrib/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:0:51
#4 0x0000000006a1b05e handle_signal
#/usr/src/lib/libthr/thread/thr_sig.c:0:3
c++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Interestingly enough this compilation error with a fatal crash exists
for a very long time, even back to clang 10 and earlier! But for various
reasons the configure script has always ignored these errors and found
some workaround way to enable TLS anyway.
For now the problem can be fixed by including <stddef.h> at the top of
conftest.cpp, which will allow the TLS test to succeed normally, without
crashing, and the correct result will then be:
configure:19128: checking for thread local storage (TLS) class
configure:19165: c++ -c -O2 -pipe -Wall -Wextra -fstack-protector-strong -fno-strict-aliasing -D_THREAD_SAFE conftest.cpp >&5
conftest.cpp:33:35: warning: unused variable 'x' [-Wunused-variable]
static __thread int x = 0;
^
1 warning generated.
configure:19165: $? = 0
configure:19220: result: modifier
PR: 267156
Approved by: maintainer timeout (>1 month)
MFH: 2022Q4
114 lines
3.7 KiB
Makefile
114 lines
3.7 KiB
Makefile
PORTNAME= db5
|
|
PORTVERSION= 5.3.28
|
|
PORTREVISION= 9
|
|
CATEGORIES= databases java
|
|
MASTER_SITES= https://download.oracle.com/berkeley-db/
|
|
PKGNAMEPREFIX?=
|
|
#
|
|
# the distfiles aren't named db5-* but db-*:
|
|
DISTNAME= db-${PORTVERSION}
|
|
DIST_SUBDIR= bdb
|
|
|
|
DEPRECATED= EOLd, potential security issues, maybe use db18 instead
|
|
EXPIRATION_DATE=2022-06-30
|
|
|
|
MAINTAINER= ports@FreeBSD.org
|
|
COMMENT= Oracle Berkeley DB, revision ${BDBVER}
|
|
WWW= https://www.oracle.com/database/berkeley-db/db.html
|
|
|
|
LICENSE= SLEEPYCAT
|
|
LICENSE_GROUPS= FSF GPL OSI
|
|
LICENSE_NAME= Sleepycat
|
|
LICENSE_FILE= ${WRKSRC}/../LICENSE
|
|
LICENSE_PERMS= dist-mirror dist-sell pkg-mirror pkg-sell auto-accept
|
|
|
|
BDBVER= ${PORTVERSION:R}
|
|
BDBMAJ= ${BDBVER:R}
|
|
CONFIGURE_ARGS= --enable-cxx --enable-stl --enable-dbm \
|
|
--enable-compat185 --enable-dump185 \
|
|
--includedir=${PREFIX}/include/${PORTNAME} \
|
|
--libdir=${PREFIX}/lib/${PORTNAME} \
|
|
--bindir=${PREFIX}/bin/${PORTNAME}
|
|
CONFIGURE_SCRIPT= ../dist/configure
|
|
GNU_CONFIGURE= yes
|
|
USES= gmake libtool
|
|
INSTALL_TARGET= install_include install_lib install_utilities
|
|
WRKSRC= ${WRKDIR}/${DISTNAME}/build_unix
|
|
PATCH_WRKSRC= ${WRKDIR}/${DISTNAME}
|
|
USE_LDCONFIG= yes
|
|
PLIST_SUB= BDBMAJ=${BDBMAJ} BDBVER=${BDBVER}
|
|
MAKE_ARGS+= docdir=${DOCSDIR}
|
|
CFLAGS+= -Wall -Wextra
|
|
|
|
OPTIONS_DEFINE= CRYPTO DEBUG L10N JAVA TCL DOCS
|
|
OPTIONS_DEFAULT=CRYPTO
|
|
OPTIONS_SUB= yes
|
|
CRYPTO_DESC= Cryptography support
|
|
L10N_DESC= Localization support (EXPERIMENTAL)
|
|
|
|
PORTDOCS= *
|
|
|
|
DBLIBS= libdb libdb_cxx libdb_stl
|
|
|
|
DEBUG_CONFIGURE_ENABLE= debug umrw
|
|
CRYPTO_CONFIGURE_WITH= cryptography=yes
|
|
L10N_CONFIGURE_ENABLE= localization
|
|
JAVA_USE= java
|
|
# db5 is incompatible with openjdk8 and causes IllegalArgument
|
|
# exceptions during build
|
|
JAVA_VARS= DBLIBS+=libdb_java JAVA_VERSION="1.7"
|
|
JAVA_CONFIGURE_ENABLE= java
|
|
JAVA_CPPFLAGS= -I"${JAVA_HOME}/include"
|
|
JAVA_CONFIGURE_ENV= JAVAC="${JAVAC}" JAR="${JAR}" JAVA="${JAVA}" JAVACFLAGS="-Xlint:unchecked"
|
|
TCL_CONFIGURE_ENABLE= tcl
|
|
TCL_USES= tcl
|
|
TCL_CONFIGURE_WITH= tcl=${TCL_LIBDIR}
|
|
TCL_VARS= DBLIBS+=libdb_tcl
|
|
DOCS_INSTALL_TARGET= install_docs
|
|
|
|
.include <bsd.port.options.mk>
|
|
|
|
.if ${ARCH} == aarch64 || ${ARCH:Marmv*}
|
|
# db5 uses a deprecated instruction for mutexes on ARM, fbsd bug#197227
|
|
# and also bug#205001
|
|
CONFIGURE_ARGS+= --enable-posixmutexes
|
|
# force POSIX mutexes - the OS supports PTHREAD_PROCESS_SHARED
|
|
CONFIGURE_ARGS+= --with-mutex=POSIX/pthreads
|
|
.endif
|
|
|
|
post-patch:
|
|
${REINPLACE_CMD} -i '' -e '/^DOCLIST/{s/csharp//;}' ${WRKSRC}/../dist/Makefile.in
|
|
${REINPLACE_CMD} -i '' -Ee 's/[[:<:]]atomic_init[[:>:]]/db_atomic_init/g' ${WRKSRC}/../src/mp/mp* ${WRKSRC}/../src/mutex/mut_*
|
|
|
|
post-install:
|
|
${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/db5/db_*
|
|
${RM} -r ${STAGEDIR}${DOCSDIR}/bdb-sql
|
|
.for i in ${DBLIBS}
|
|
${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/${PORTNAME}/${i}-${BDBVER}.so.0
|
|
${LN} -s -f ${PORTNAME}/${i}-${BDBVER}.so.0 ${STAGEDIR}${PREFIX}/lib
|
|
${LN} -s -f ${PORTNAME}/${i}-${BDBMAJ}.so ${STAGEDIR}${PREFIX}/lib
|
|
${LN} -s -f ${i}-${BDBVER}.so.0 ${STAGEDIR}${PREFIX}/lib/${i}-${BDBVER}.so
|
|
${LN} -s -f ${i}-${BDBVER}.so.0 ${STAGEDIR}${PREFIX}/lib/${i}-${BDBMAJ}.so.0
|
|
${LN} -s -f ${i}-${BDBVER}.a ${STAGEDIR}${PREFIX}/lib/${PORTNAME}/${i}.a
|
|
.endfor
|
|
cd ${STAGEDIR}${PREFIX}/bin/${PORTNAME}; \
|
|
for i in *; do ${LN} -s -f ${PORTNAME}/$$i ../$$i-${BDBVER} ; \
|
|
${LN} -s -f ${PORTNAME}/$$i ../$$i-${BDBMAJ} ; done
|
|
|
|
post-install-JAVA-off:
|
|
${RM} -r ${STAGEDIR}${DOCSDIR}/java
|
|
.for i in gsg gsg_db_rep gsg_txn
|
|
${RM} -r ${STAGEDIR}${DOCSDIR}/${i}/JAVA
|
|
.endfor
|
|
|
|
post-install-TCL-on:
|
|
echo "package ifneeded Db_tcl ${BDBVER} \
|
|
[list load [file join $$dir libdb_tcl-${BDBVER}.so]] \
|
|
" > ${STAGEDIR}${PREFIX}/lib/${PORTNAME}/pkgIndex.tcl
|
|
|
|
post-install-TCL-off:
|
|
.for i in api_reference/TCL
|
|
${RM} -r ${STAGEDIR}${DOCSDIR}/${i}
|
|
.endfor
|
|
|
|
.include <bsd.port.mk>
|