From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp43.i.mail.ru (smtp43.i.mail.ru [94.100.177.103]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id D310146970E for ; Tue, 21 Jan 2020 15:17:51 +0300 (MSK) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) From: Serge Petrenko In-Reply-To: <20191218023335.6olxxxqeyj7qhyhb@tkn_work_nb> Date: Tue, 21 Jan 2020 15:17:49 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: References: <20191125135347.5105-1-sergepetrenko@tarantool.org> <20191218023335.6olxxxqeyj7qhyhb@tkn_work_nb> Subject: Re: [Tarantool-patches] [PATCH] build: link bundled libcurl with c-ares List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Turenko Cc: tarantool-patches@dev.tarantool.org > 18 =D0=B4=D0=B5=D0=BA. 2019 =D0=B3., =D0=B2 5:33, Alexander Turenko = =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB= (=D0=B0): >=20 > I brief: I would compare build times of c-ares with `./configure && = make > -j` against `cmake . && make -j` and let's start with using = ./configure > if the difference is not significant, but otherwise use CMake from > beginning. >=20 > See other thoughts below. >=20 > WBR, Alexander Turenko. >=20 > =E2=80=94=E2=80=94 Hi! Thank you for review! I sent v2 and fixed what you=E2=80=99ve pointed out. >=20 > I guess that src/CMakeLists.txt will give a warning on static build: = see > around `${libstatic} STREQUAL bundled-libcurl` line. Fixed. >=20 > I also guess that using CMake for luajit, curl and c-ares may solve > several problems: build time, passing toolchain and Mac OS specific > flags, handling -DCMAKE_BUILD_TYPE in subprojects, clean out-of-source > build. Let's verify at least build time: if ./configure adds much = time, > then we'll make other developers angry. Maybe it worth to use CMake = for > c-ares from begnning. I=E2=80=99ve done that, and you=E2=80=99re right. Here are `time (cmake . && make -j)` outputs when using configure for c-ares real 3m16.989s user 4m45.145s sys 1m45.434s and cmake, respectively real 2m2.913s user 3m55.688s sys 1m17.485s >=20 > Don't sure whether it worth to copy CMakeLists.txt from c-ares to our > cmake/ directory. Let's start w/o copy and consider to do it if we'll > need to change something. >=20 > I don't sure which pros and cons have using of ExternalProject(), it > seems we should look a bit into this. >=20 You see, we need c-ares installed, since curl depends on an existing = c-ares installation. So, curl requires that c-ares is installed on build step = already. We cannot use add_subdirectory. It will make cmake run build steps for = all the subdirs first, and only then install them. ExternalProject_Add does exactly what we need. It runs both build and = install steps of the external project on parent=E2=80=99s build step. > I also don't sure whether tarantool-specific flags will be passed for > c-ares when we'll use CMake (with / without ExternalProject()). Some = of > them we should pass (such as -UNDEBUG that is set by > -DCMAKE_BUILD_TYPE=3DDebug), some maybe not (need to verify > add_compile_flags() macro calls at least). All the cmake options need to be passed to external project explicitly. >=20 > Sergey V. will work on > https://github.com/tarantool/tarantool/issues/4444 , maybe it worth to > cooperate. (CCed him.) >=20 > Is c-ares depends on some libraries? CMakeLists.txt extract: # Tell C-Ares about libraries to depend on = =20 IF (HAVE_LIBRESOLV) = =20 LIST (APPEND CARES_DEPENDENT_LIBS resolv) = =20 ENDIF () = =20 IF (HAVE_LIBNSL) = =20 LIST (APPEND CARES_DEPENDENT_LIBS nsl) = =20 ENDIF () = =20 IF (HAVE_LIBSOCKET) = =20 LIST (APPEND CARES_DEPENDENT_LIBS socket) = =20 ENDIF () = =20 IF (HAVE_LIBRT) = =20 LIST (APPEND CARES_DEPENDENT_LIBS rt) = =20 ENDIF () =20 >=20 > WBR, Alexander Turenko. >=20 > On Mon, Nov 25, 2019 at 04:53:47PM +0300, Serge Petrenko wrote: >> libcurl has a built-in threaded resolver used for asynchronous DNS >> requests, however, when DNS server is slow to respond, the request = still >> hangs tarantool until it is finished. The reason is that curl calls >> thread_join on the resolving thread internally upon timeout, making = the >> calling thread hang until resolution has ended. >> Use c-ares as an asynchronous resolver instead to eliminate the = problem. >>=20 >> Closes #4591 >> --- >> https://github.com/tarantool/tarantool/issues/4591 >> = https://github.com/tarantool/tarantool/tree/sp/gh-4591-link-curl-with-c-ar= es-full-ci -- Serge Petrenko sergepetrenko@tarantool.org