From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp51.i.mail.ru (smtp51.i.mail.ru [94.100.177.111]) (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 819E846971A for ; Tue, 10 Dec 2019 17:15:25 +0300 (MSK) Date: Tue, 10 Dec 2019 17:15:24 +0300 From: Kirill Yukhin Message-ID: <20191210141524.pz4qyuryz7hunu76@tarantool.org> References: <24ad607cdb08403e955e4c66daf11e2ed99e750e.1575233822.git.v.shpilevoy@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <24ad607cdb08403e955e4c66daf11e2ed99e750e.1575233822.git.v.shpilevoy@tarantool.org> Subject: Re: [Tarantool-patches] [PATCH 1/1] Fix build on Mac with gcc and XCode 11 List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Vladislav Shpilevoy Cc: tarantool-patches@dev.tarantool.org Hello, On 01 дек 21:59, Vladislav Shpilevoy wrote: > There is a bug in XCode 11 which makes some standard C headers > not self sufficient when compile with gcc. At least and > are affected. When they are included first, > compilation fails with creepy errors like this: > > In file included > from /Applications/Xcode.app/Contents/Developer/ > Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/ > sys/wait.h:110, > from /Applications/Xcode.app/Contents/Developer/ > Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/ > stdlib.h:66, > from tarantool/third_party/zstd/lib/common/zstd_common.c:16: > /Applications/Xcode.app/Content/Developer/ > Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/ > sys/resource.h: > In function 'getiopolicy_np': /Applications/Xcode.app/Contents/Developer/ > Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/ > sys/resource.h:447:34: error: > expected declaration specifiers before '__OSX_AVAILABLE_STARTING' > 447 | int getiopolicy_np(int, int) > __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0); > > The patch workarounds the bug by deleting the buggy header > includes where possible, and by changing include order in other > cases. > > Also there was a second compilation problem. This was about > different definitions of the same standard functions: via extern > "C" and without. It looked like this: > > In file included from tarantool/src/trivia/util.h:36, > from tarantool/src/tt_pthread.h:35, > from tarantool/src/lib/core/fiber.h:38, > from tarantool/src/lib/core/coio.h:33, > from tarantool/src/lib/core/coio.cc:31: > /usr/local/Cellar/gcc/9.2.0_1/lib/gcc/9/gcc/x86_64-apple-darwin18/9.2.0 > include-fixed/stdio.h:222:7: error: conflicting declaration of > 'char* ctermid(char*)' with 'C' linkage > 222 | char *ctermid(char *); > | ^~~~~~~ > > In file included from /Applications/Xcode.app/Contents/Developer/Platforms/ > MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/unistd.h:525, > from tarantool/src/lib/core/fiber.h:37, > from tarantool/src/lib/core/coio.h:33, > from tarantool/src/lib/core/coio.cc:31: > /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/ > Developer/SDKs/MacOSX.sdk/usr/include/_ctermid.h:26:10: note: previous > declaration with 'C++' linkage > 26 | char *ctermid(char *); > | ^~~~~~~ > > This bug is workarounded by deletion of the conflicting includes, > because anyway they appeared to be not needed. > > Closes #4580 > --- > Issue: https://github.com/tarantool/tarantool/issues/4580 > Branch: https://github.com/tarantool/tarantool/tree/gerold103/gh-4580-mac-build I've checked your patch into master. -- Regards, Kirill