From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id D01C66C1AE; Tue, 18 May 2021 08:51:30 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org D01C66C1AE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1621317090; bh=wnfzMLgUZc5HgSjPwAOSQCgDuuKKuvSOQvNzx8cTjkA=; h=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=V/bgD82DXJ/isbs3UwoR2OlxubaA6DlIlS+kntyfdEbCzoseqMtRZetswOOrWLFrB GgvKYwuckNNJxqJ/qS6Q6TkNNoht7HC68uYv0zZKgK41aE+FwG4rTKH+14g9QOWq/g 3eYSZYAzG8opu0R3NIarvuTH+CWWYQlp3kCa+qnc= Received: from smtp17.mail.ru (smtp17.mail.ru [94.100.176.154]) (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 18C816C1AE for ; Tue, 18 May 2021 08:51:30 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 18C816C1AE Received: by smtp17.mail.ru with esmtpa (envelope-from ) id 1lisdc-0003uc-2w; Tue, 18 May 2021 08:51:28 +0300 Date: Tue, 18 May 2021 08:50:21 +0300 To: Igor Munkin Message-ID: References: <4dd97d6fbfb470d41e9ef5ad12492a0def664b2b.1620678384.git.imun@tarantool.org> <20210512215532.GE3944@tarantool.org> <20210517172157.GO3944@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20210517172157.GO3944@tarantool.org> X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD95978C26455E69BE0AAE50420B6EFF6A4E51E23FC86C8E287182A05F53808504099229D3018A0D7BE1709E6AF4B4F1A9DD4C59C2F3102B857B08E6A53D247553D X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7FFA2A8BF6367A61CEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006373ABD2822AD894AA78638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D866D31278BFF6BD555675435EF0369B2D117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCF1175FABE1C0F9B6A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD18CB629EEF1311BF91D2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B67393CE827C55B5F775ECD9A6C639B01B4E70A05D1297E1BBCB5012B2E24CD356 X-C1DE0DAB: 0D63561A33F958A55CCFED21DAC8BBE932282A1389258623B23113ECA96ACED5D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA752546FE575EB473F1410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D3447DF5779098ECEE98473B684A761BB7270C3451F57B78894191B1D76EE09252042FBD6D2396BAA861D7E09C32AA3244C28A451C91F250439CF7CD3F6E1C48098E8FBBEFAE1C4874CFACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojdWksWVKfsTD3kYBeDjqMVQ== X-Mailru-Sender: 3B9A0136629DC91206CBC582EFEF4CB41A81678E1563EA55DB1003C17DDC894F8735D1064880384AF2400F607609286E924004A7DEC283833C7120B22964430C52B393F8C72A41A89437F6177E88F7363CDA0F3B3F5B9367 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit 1/3] build: pass sysroot to MacOS SDK X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Sergey Kaplun via Tarantool-patches Reply-To: Sergey Kaplun Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Igor, On 17.05.21, Igor Munkin wrote: > Sergey, > > On 14.05.21, Sergey Kaplun wrote: > > Igor, > > > > Thanks for the fixes! > > > > Please fix the nit below. Otherwise, LGTM. > > Thanks for your review. Unfortunately, this is not a nit (at least I > have no idea how to handle it). Consider the answers below. > > > > > On 13.05.21, Igor Munkin wrote: > > > Sergey, > > > > > > Thanks for such precise review! I've answered the questions below and > > > re-implemented the fix (the new patch is at the end), so hold your LGTM > > > for a while. > > > > > > On 11.05.21, Sergey Kaplun wrote: > > > > > > > > > > Side note: Also I've seen that Mike uses OSX_DEPLOYMENT_TARGET variable. > > > > Moreover, CMAKE_OSX_SYSROOT should "computed based on the > > > > CMAKE_OSX_DEPLOYMENT_TARGET or the host platform" according to [4]. > > > > And by itself, it means the minimum possible IOS version, where an > > > > application may run [5]. May be we should fix this too with a separate > > > > issue and patch (to protect users from building LuaJIT on ancient > > > > devices)? > > > > > > Sorry, I don't get this one. What exactly is bothering you here? > > > > Just friendly reminder. It's not related to the patch. Just a side > > note. :) I remembered about it only because it is part of OSX twists. > > There is no need to do it in this patch, but maybe later? > > But I still don't get what we need to do... I suppose it will be nice to add CMAKE_OSX_DEPLOYMENT_TARGET. Like Mike does in Makefile: MACOSX_DEPLOYMENT_TARGET is set to 10.4. In the separate patch, of course. > > > > > > > > > > > > > > > > [1]: https://cmake.org/cmake/help/latest/manual/cmake-variables.7.html > > > > [2]: https://cmake.org/cmake/help/v3.1/manual/cmake-variables.7.html > > > > [3]: https://github.com/LuaJIT/LuaJIT/blob/8dc3cd6c84dfc81539604340b7884408e1c71d55/doc/install.html#L437 > > > > [4]: https://cmake.org/cmake/help/v3.1/variable/CMAKE_OSX_SYSROOT.html > > > > [5]: https://developer.apple.com/library/archive/documentation/ToolsLanguages/Conceptual/Xcode_Overview/WorkingwithTargets.html > > > > > > > > -- > > > > Best regards, > > > > Sergey Kaplun > > > > > > ================================================================================ > > > > > > build: pass sysroot to MacOS SDK > > > > > > There were issues with configuring LuaJIT on Apple machines, since > > > CMake auxiliary routine fails to locate system headers > > > (e.g. assert.h in case when LUA_USE_ASSERT is enabled). As a result > > > platform detection fails and LuaJIT configuration ends with the fatal > > > error. This patch adds the necessary flags to help the routine to find > > > the required system headers. > > > > > > Needed for tarantool/tarantool#6065 > > > Relates to tarantool/tarantool#5629 > > > Follows up tarantool/tarantool#4862 > > > > What's about 5983? Shouldn't it be mentioned too? > > No, since there is a separate issue this patch is needed for (#6065). > > > > > > > > > Signed-off-by: Igor Munkin > > > --- > > > cmake/LuaJITUtils.cmake | 8 ++++++++ > > > 1 file changed, 8 insertions(+) > > > > > > diff --git a/cmake/LuaJITUtils.cmake b/cmake/LuaJITUtils.cmake > > > index d9f8b12a..3497edc4 100644 > > > --- a/cmake/LuaJITUtils.cmake > > > +++ b/cmake/LuaJITUtils.cmake > > > @@ -1,4 +1,12 @@ > > > function(LuaJITTestArch outvar strflags) > > > + # XXX: This routine uses external headers (e.g. system ones), > > > + # which location is specified either implicitly (within CMake > > > + # machinery) or explicitly (manually by configuration options). > > > + # Need -isysroot flag on recentish MacOS after command line > > > + # tools no longer provide headers in /usr/include. > > > + if(CMAKE_OSX_SYSROOT) > > > > Nit: This variable should be taken into account only for OS X > > platforms [1]. I suppose not only by CMake, but by our build system too. > > > > I've got the error on Linux if I try to build LuaJIT like the following > > (by mistake of course): > > > > | $ uname -s > > | Linux > > | $ cmake . -DCMAKE_OSX_SYSROOT="/tmp/blablabalblablbalalbla" -DLUA_USE_ASSERT=ON -DCMAKE_BUILD_TYPE=Debug > > Sigh. After all, I've tried for three patches, seems like ninety... > > BTW, I see failures even on MacOS: > | $ uname -msr > | Darwin 20.3.0 arm64 > | $ cmake . -DCMAKE_OSX_SYSROOT="/tmp" > | -- The C compiler identification is AppleClang 12.0.0.12000032 > | -- Detecting C compiler ABI info > | -- Detecting C compiler ABI info - failed > | -- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc > | -- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - broken > | CMake Error at /opt/homebrew/Cellar/cmake/3.20.1/share/cmake/Modules/CMakeTestCCompiler.cmake:66 (message): > | The C compiler > | > | "/Library/Developer/CommandLineTools/usr/bin/cc" > | > | is not able to compile a simple test program. > | > | It fails with the following output: > | > | Change Dir: /Users/tntmac07.tarantool.i/imun/tarantool-luajit/CMakeFiles/CMakeTmp > | > | Run Build Command(s):/usr/bin/make -f Makefile cmTC_da00c/fast && /Library/Developer/CommandLineTools/usr/bin/make -f CMakeFiles/cmTC_da00c.dir/build.make CMakeFiles/cmTC_da00c.dir/build > | Building C object CMakeFiles/cmTC_da00c.dir/testCCompiler.c.o > | /Library/Developer/CommandLineTools/usr/bin/cc -arch arm64 -isysroot /tmp -mmacosx-version-min=11.1 -MD -MT CMakeFiles/cmTC_da00c.dir/testCCompiler.c.o -MF CMakeFiles/cmTC_da00c.dir/testCCompiler.c.o.d -o CMakeFiles/cmTC_da00c.dir/testCCompiler.c.o -c /Users/tntmac07.tarantool.i/imun/tarantool-luajit/CMakeFiles/CMakeTmp/testCCompiler.c > | Linking C executable cmTC_da00c > | /opt/homebrew/Cellar/cmake/3.20.1/bin/cmake -E cmake_link_script CMakeFiles/cmTC_da00c.dir/link.txt --verbose=1 > | /Library/Developer/CommandLineTools/usr/bin/cc -arch arm64 -isysroot /tmp -mmacosx-version-min=11.1 -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/cmTC_da00c.dir/testCCompiler.c.o -o cmTC_da00c > | ld: library not found for -lSystem > | clang: error: linker command failed with exit code 1 (use -v to see invocation) > | make[1]: *** [cmTC_da00c] Error 1 > | make: *** [cmTC_da00c/fast] Error 2 > | > | > | > | > | > | CMake will not be able to correctly generate this project. > | Call Stack (most recent call first): > | CMakeLists.txt:12 (project) > | > | > | -- Configuring incomplete, errors occurred! > | See also "/Users/tntmac07.tarantool.i/imun/tarantool-luajit/CMakeFiles/CMakeOutput.log". > | See also "/Users/tntmac07.tarantool.i/imun/tarantool-luajit/CMakeFiles/CMakeError.log". > > I have no idea how to fix this, so I propose to classify manual > definition of CMAKE_OSX_SYSROOT as PEBKAC and move on. Thoughts? Why we can't just change the check to the following? | if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_OSX_SYSROOT) At least it fixes the case I mentioned above, doesn't it? And we definitely can't protect users from wrong sysroot paths on OS X systems like in your example. This case looks like "Сам себе злобный Буратино". > > > | In file included from lua.h:14, > > | from lj_arch.h:9: > > | /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/include/stdint.h:9:16: fatal error: stdint.h: No such file or directory > > | 9 | # include_next > > | | ^~~~~~~~~~ > > | compilation terminated. > > | CMake Error at cmake/LuaJITUtils.cmake:48 (message): > > | [LuaJITArch] Unsupported target architecture > > | Call Stack (most recent call first): > > | cmake/SetTargetFlags.cmake:16 (LuaJITArch) > > | src/CMakeLists.txt:17 (include) > > > > > + set(strflags "${strflags} -isysroot ${CMAKE_OSX_SYSROOT}") > > > + endif() > > > # XXX: simply splits the COMMAND argument by > > > # spaces with no further parsing. At the same time GCC is bad in > > > # argument handling, so let's help it a bit. > > > > > > ================================================================================ > > > > > > [1]: https://gitlab.kitware.com/cmake/cmake/-/blob/master/Source/cmLocalGenerator.cxx#L1911-1916 > > > [2]: https://gitlab.kitware.com/cmake/cmake/-/blob/master/Tests/FindPackageModeMakefileTest/CMakeLists.txt#L24-28 > > > > > > > > > -- > > > Best regards, > > > IM > > > > [1]: https://cmake.org/cmake/help/v3.0/variable/CMAKE_OSX_SYSROOT.html > > > > -- > > Best regards, > > Sergey Kaplun > > -- > Best regards, > IM -- Best regards, Sergey Kaplun