From patchwork Mon May 24 17:33:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 1482902 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.133; helo=smtp2.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FpkpJ5Rblz9sPf for ; Tue, 25 May 2021 03:33:44 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 61DBC402D7; Mon, 24 May 2021 17:33:42 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IwATuBOJvFKW; Mon, 24 May 2021 17:33:41 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp2.osuosl.org (Postfix) with ESMTP id 7A94D4010C; Mon, 24 May 2021 17:33:40 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 5C800C000E; Mon, 24 May 2021 17:33:40 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id E5E2DC0001 for ; Mon, 24 May 2021 17:33:38 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id C8D8883547 for ; Mon, 24 May 2021 17:33:38 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hYfQQfNhg_te for ; Mon, 24 May 2021 17:33:38 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by smtp1.osuosl.org (Postfix) with ESMTPS id 93564835EF for ; Mon, 24 May 2021 17:33:37 +0000 (UTC) Received: (Authenticated sender: blp@ovn.org) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 39C791BF20A; Mon, 24 May 2021 17:33:34 +0000 (UTC) From: Ben Pfaff To: dev@openvswitch.org Date: Mon, 24 May 2021 10:33:18 -0700 Message-Id: <20210524173319.962817-3-blp@ovn.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210524173319.962817-1-blp@ovn.org> References: <20210524173319.962817-1-blp@ovn.org> MIME-Version: 1.0 Cc: Ben Pfaff Subject: [ovs-dev] [PATCH ovn v3 2/3] configure: Improve how to find ddlog binaries and libraries. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" There was no easy way to use a ddlog installation from one of the tarballs provided by the ddlog developers, because these put the binaries in a subdirectory of an installation directory instead of in a system- or user-level bin directory. This commit makes that easier: just do "--with-ddlog=$INSTALLDIR". Signed-off-by: Ben Pfaff --- Documentation/intro/install/general.rst | 37 +++++++++++++++++++----- acinclude.m4 | 38 +++++++++++++++++-------- 2 files changed, 56 insertions(+), 19 deletions(-) diff --git a/Documentation/intro/install/general.rst b/Documentation/intro/install/general.rst index ee48272422fe..589518846233 100644 --- a/Documentation/intro/install/general.rst +++ b/Documentation/intro/install/general.rst @@ -213,13 +213,36 @@ the default database directory, add options as shown here:: ``yum install`` or ``rpm -ivh``) and .deb (e.g. via ``apt-get install`` or ``dpkg -i``) use the above configure options. -To build with DDlog support, add ``--with-ddlog=/lib`` -to the ``configure`` command line. Building with DDLog adds a few -minutes to the build because the Rust compiler is slow. To speed this -up by about 2x, also add ``--enable-ddlog-fast-build``. This disables -some Rust compiler optimizations, making a much slower -``ovn-northd-ddlog`` executable, so it should not be used for -production builds or for profiling. +Use ``--with-ddlog`` to build with DDlog support. To build with +DDlog, the build system needs to be able to find the ``ddlog`` and +``ovsdb2ddlog`` binaries and the DDlog library directory (the +directory that contains ``ddlog_std.dl``). This option supports a +few ways to do that: + + * If binaries are in $PATH, use the library directory as argument, + e.g. ``--with-ddlog=$HOME/differential-datalog/lib``. This is + suitable if DDlog was installed from source via ``stack install`` or + from (hypothetical) distribution packaging. + + The DDlog documentation recommends pointing $DDLOG_HOME to the + DDlog source directory. If you did this, so that $DDLOG_HOME/lib + is the library directory, you may use ``--with-ddlog`` without an + argument. + + * If the binaries and libraries are in the ``bin`` and ``lib`` + subdirectories of an installation directory, use the installation + directory as the argument. This is suitable if DDlog was + installed from one of the binary tarballs published by the DDlog + developers. + +.. note:: + + Building with DDLog adds a few minutes to the build because the + Rust compiler is slow. Add ``--enable-ddlog-fast-build`` to make + this about 2x faster. This disables some Rust compiler + optimizations, making a much slower ``ovn-northd-ddlog`` + executable, so it should not be used for production builds or for + profiling. By default, static libraries are built and linked against. If you want to use shared libraries instead:: diff --git a/acinclude.m4 b/acinclude.m4 index 93177dfe71d4..2fbcab8463c3 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -51,22 +51,36 @@ dnl ddlog (which is probably only useful for developers who are trying dnl different versions, since OVN is currently bound to a particular dnl DDlog version). AC_DEFUN([OVS_CHECK_DDLOG], [ - AC_ARG_WITH([ddlog], - [AC_HELP_STRING([--with-ddlog=.../differential-datalog/lib], - [Enables DDlog by pointing to its library dir])], - [DDLOGLIBDIR=$withval], [DDLOGLIBDIR=no]) + AC_ARG_VAR([DDLOG_HOME], [Root of the DDlog installation]) + AC_ARG_WITH( + [ddlog], + [AC_HELP_STRING([--with-ddlog[[=INSTALLDIR|LIBDIR]]], [Enables DDlog])], + [DDLOG_PATH=$PATH + if test "$withval" = yes; then + # --with-ddlog: $DDLOG_HOME must be set + if test -z "$DDLOG_HOME"; then + AC_MSG_ERROR([To build with DDlog, specify the DDlog install or library directory on --with-ddlog or in \$DDLOG_HOME]) + fi + DDLOGLIBDIR=$DDLOG_HOME/lib + test -d "$DDLOG_HOME/bin" && DDLOG_PATH=$DDLOG_HOME/bin + elif test -f "$withval/lib/ddlog_std.dl"; then + # --with-ddlog=INSTALLDIR + DDLOGLIBDIR=$withval/lib + test -d "$withval/bin" && DDLOG_PATH=$withval/bin + elif test -f "$withval/ddlog_std.dl"; then + # --with-ddlog=LIBDIR + DDLOGLIBDIR=$withval/lib + else + AC_MSG_ERROR([$withval does not contain ddlog_std.dl or lib/ddlog_std.dl]) + fi], + [DDLOGLIBDIR=no + DDLOG_PATH=no]) AC_MSG_CHECKING([for DDlog library directory]) AC_MSG_RESULT([$DDLOGLIBDIR]) if test "$DDLOGLIBDIR" != no; then - if test ! -d "$DDLOGLIBDIR"; then - AC_MSG_ERROR([ddlog library dir "$DDLOGLIBDIR" doesn't exist]) - elif test ! -f "$DDLOGLIBDIR"/ddlog_std.dl; then - AC_MSG_ERROR([ddlog library dir "$DDLOGLIBDIR" lacks ddlog_std.dl]) - fi - - AC_ARG_VAR([DDLOG]) - AC_CHECK_PROGS([DDLOG], [ddlog], [none]) + AC_ARG_VAR([DDLOG], [path to ddlog binary]) + AC_PATH_PROGS([DDLOG], [ddlog], [none], [$DDLOG_PATH]) if test X"$DDLOG" = X"none"; then AC_MSG_ERROR([ddlog is required to build with DDlog]) fi