From cd0f07fbf32c87c92ba724c6c55c815d1ec371af Mon Sep 17 00:00:00 2001 From: bill Date: Wed, 28 Sep 2022 01:09:41 +0800 Subject: [PATCH 1/2] Fixed msvc pch --- .gitignore | 2 ++ aquery_config.py | 2 +- msc-plugin/libaquery.vcxproj | 20 +++++++++++-------- msc-plugin/msc-plugin.vcxproj | 36 +++++++++++++++++++++++------------ msc-plugin/server.sln | 3 --- reconstruct/storage.py | 4 ++-- server/monetdb_conn.cpp | 2 +- 7 files changed, 42 insertions(+), 27 deletions(-) diff --git a/.gitignore b/.gitignore index c262c14..d63528c 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,8 @@ tests/datagen_jose/tickgen datagen tests/private *.dSYM +launcher.exp +launcher.lib testmain.lib testmain.exp test.lib diff --git a/aquery_config.py b/aquery_config.py index c2ede14..5e4bed2 100644 --- a/aquery_config.py +++ b/aquery_config.py @@ -10,7 +10,7 @@ have_hge = False cygroot = 'c:/msys64/usr/bin' msbuildroot = '' os_platform = 'unknown' -build_driver = 'Makefile' +build_driver = 'Auto' def init_config(): global __config_initialized__, os_platform, msbuildroot, build_driver diff --git a/msc-plugin/libaquery.vcxproj b/msc-plugin/libaquery.vcxproj index 96b11f8..cb493e4 100644 --- a/msc-plugin/libaquery.vcxproj +++ b/msc-plugin/libaquery.vcxproj @@ -97,11 +97,12 @@ stdcpp17 stdc17 Create - pch.hpp + pch_msc.hpp $(ProjectDir)\..\monetdb\msvc - ../libaquery.pch + $(SolutionDir)..\msc-plugin\pch_msc.pch true true + $(IntDir)vc$(PlatformToolsetVersion).pdb Console @@ -122,7 +123,7 @@ stdcpp17 stdc17 Create - pch.hpp + pch_msc.hpp None Full AnySuitable @@ -138,7 +139,8 @@ true false $(ProjectDir)\..\monetdb\msvc - ../libaquery.pch + $(SolutionDir)..\msc-plugin\pch_msc.pch + $(IntDir)vc$(PlatformToolsetVersion).pdb Console @@ -160,11 +162,12 @@ stdcpp17 stdc17 Create - pch.hpp + pch_msc.hpp $(ProjectDir)\..\monetdb\msvc - ../libaquery.pch + $(SolutionDir)..\msc-plugin\pch_msc.pch true true + $(IntDir)vc$(PlatformToolsetVersion).pdb Console @@ -185,7 +188,7 @@ stdcpp17 stdc17 Create - pch.hpp + pch_msc.hpp None Full AnySuitable @@ -201,7 +204,8 @@ true false $(ProjectDir)\..\monetdb\msvc - ../libaquery.pch + $(SolutionDir)..\msc-plugin\pch_msc.pch + $(IntDir)vc$(PlatformToolsetVersion).pdb Console diff --git a/msc-plugin/msc-plugin.vcxproj b/msc-plugin/msc-plugin.vcxproj index e0765b4..cec60b3 100644 --- a/msc-plugin/msc-plugin.vcxproj +++ b/msc-plugin/msc-plugin.vcxproj @@ -104,11 +104,14 @@ $(ProjectDir)\..\monetdb\msvc /WL %(AdditionalOptions) stdc17 - Create - ./server/pch.hpp - ../libaquery.pch + Use + pch_msc.hpp + + true true + $(IntDir)vc$(PlatformToolsetVersion).pdb + pch_msc.hpp Console @@ -129,8 +132,8 @@ stdcpp17 $(ProjectDir)\..\monetdb\msvc stdc17 - Create - ./server/pch.hpp + Use + pch_msc.hpp None Full AnySuitable @@ -145,8 +148,11 @@ false true false - ../libaquery.pch + + false + $(IntDir)vc$(PlatformToolsetVersion).pdb + pch_msc.hpp Console @@ -175,11 +181,14 @@ $(ProjectDir)\..\monetdb\msvc /WL %(AdditionalOptions) stdc17 - Create - ./server/pch.hpp - ../libaquery.pch + Use + pch_msc.hpp + + true true + $(IntDir)vc$(PlatformToolsetVersion).pdb + pch_msc.hpp Console @@ -200,8 +209,8 @@ stdcpp17 $(ProjectDir)\..\monetdb\msvc stdc17 - Create - ./server/pch.hpp + Use + pch_msc.hpp None Full AnySuitable @@ -216,8 +225,11 @@ false true false - ../libaquery.pch + + false + $(IntDir)vc$(PlatformToolsetVersion).pdb + pch_msc.hpp Console diff --git a/msc-plugin/server.sln b/msc-plugin/server.sln index 8b021f9..84fb37c 100644 --- a/msc-plugin/server.sln +++ b/msc-plugin/server.sln @@ -9,9 +9,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "server", "server.vcxproj", EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "msc-plugin", "msc-plugin.vcxproj", "{8081FDAA-4D13-4B7A-ADB2-8224AF7F1C81}" - ProjectSection(ProjectDependencies) = postProject - {B52AACF7-16A6-4FCA-90AD-867D367BDA4F} = {B52AACF7-16A6-4FCA-90AD-867D367BDA4F} - EndProjectSection EndProject Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "msvs-py", "..\msvs-py\msvs-py.pyproj", "{CCC243F5-663E-45B7-A6DE-B2468C58B3A7}" EndProject diff --git a/reconstruct/storage.py b/reconstruct/storage.py index 790f073..6d3bb54 100644 --- a/reconstruct/storage.py +++ b/reconstruct/storage.py @@ -210,8 +210,8 @@ class Context: from aquery_config import build_driver, os_platform if not self.finalized: headers = '' - if build_driver == 'MSBuild': - headers ='#include \"./server/pch.hpp\"\n' + # if build_driver == 'MSBuild': + # headers ='#include \"./server/pch.hpp\"\n' for h in self.headers: if h[0] != '"': diff --git a/server/monetdb_conn.cpp b/server/monetdb_conn.cpp index ed9db74..b29f1a8 100644 --- a/server/monetdb_conn.cpp +++ b/server/monetdb_conn.cpp @@ -1,4 +1,4 @@ -#include "pch.hpp" +#include "pch_msc.hpp" #include "libaquery.h" #include From c4e9166e1aafe98df6305ef877d61655bfc7610f Mon Sep 17 00:00:00 2001 From: Bill Sun Date: Wed, 28 Sep 2022 19:52:23 +0800 Subject: [PATCH 2/2] Fixed build for centos --- Makefile | 24 ++++++++++++++++++------ aquery_config.py | 2 +- build.py | 2 +- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 8d8c62a..d878994 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ MonetDB_LIB = MonetDB_INC = Threading = CXXFLAGS = --std=c++1z -OPTFLAGS = -O3 -fno-semantic-interposition -DNDEBUG +OPTFLAGS = -O3 -DNDEBUG LINKFLAGS = -flto SHAREDFLAGS = -shared FPIC = -fPIC @@ -12,6 +12,18 @@ LIBTOOL = USELIB_FLAG = -Wl,--whole-archive,libaquery.a -Wl,-no-whole-archive LIBAQ_SRC = server/server.cpp server/monetdb_conn.cpp server/io.cpp LIBAQ_OBJ = server.o monetdb_conn.o io.o +SEMANTIC_INTERPOSITION = -fno-semantic-interposition +RANLIB = ranlib +ifeq ($(COMPILER), clang ) + CLANG_GE_10 = $(shell expr `$(CXX) -dumpversion | cut -f1 -d.` \>= 10) + ifneq ($(CLANG_GE_10), 1) + SEMANTIC_INTERPOSITION = + endif + ifeq (, $(shell llvm-ranlib)) + RANLIB = llvm-ranlib + endif +endif +OPTFLAGS += $(SEMANTIC_INTERPOSITION) ifeq ($(PCH), 1) PCHFLAGS = -include server/pch.hpp @@ -19,7 +31,6 @@ else PCHFLAGS = endif - ifeq ($(OS),Windows_NT) NULL_DEVICE = NUL OS_SUPPORT += server/winhelper.cpp @@ -48,8 +59,8 @@ else endif else OPTFLAGS += -march=native - MonetDB_LIB += $AQ_MONETDB_LIB - MonetDB_INC += $AQ_MONETDB_INC + MonetDB_LIB += $(AQ_MONETDB_LIB) + MonetDB_INC += $(AQ_MONETDB_INC) MonetDB_INC += -I/usr/local/include/monetdb -I/usr/include/monetdb endif MonetDB_LIB += -lmonetdbe @@ -64,6 +75,7 @@ endif SHAREDFLAGS += $(FPIC) info: + $(info $(OPTFLAGS)) $(info $(OS_SUPPORT)) $(info $(OS)) $(info $(Threading)) @@ -78,14 +90,14 @@ pch: libaquery.a: $(CXX) -c $(FPIC) $(PCHFLAGS) $(LIBAQ_SRC) $(MonetDB_INC) $(MonetDB_LIB) $(OS_SUPPORT) $(Threading) $(OPTFLAGS) $(LINKFLAGS) $(CXXFLAGS) &&\ $(LIBTOOL) libaquery.a $(LIBAQ_OBJ) &&\ - ranlib libaquery.a + $(RANLIB) libaquery.a server.bin: $(CXX) $(LIBAQ_SRC) $(LINKFLAGS) $(OS_SUPPORT) $(Threading) $(MonetDB_INC) $(MonetDB_LIB) $(OPTFLAGS) $(CXXFLAGS) -o server.bin launcher: $(CXX) -D__AQ_BUILD_LAUNCHER__ $(LIBAQ_SRC) $(LINKFLAGS) $(OS_SUPPORT) $(Threading) $(MonetDB_INC) $(MonetDB_LIB) $(OPTFLAGS) $(CXXFLAGS) -o aq server.so: -# $(CXX) server/server.cpp server/monetdb_conn.cpp -fPIC -shared $(OS_SUPPORT) monetdb/msvc/monetdbe.dll --std=c++1z -O3 -march=native -o server.so -I./monetdb/msvc +# $(CXX) -z muldefs server/server.cpp server/monetdb_conn.cpp -fPIC -shared $(OS_SUPPORT) monetdb/msvc/monetdbe.dll --std=c++1z -O3 -march=native -o server.so -I./monetdb/msvc $(CXX) $(SHAREDFLAGS) $(PCHFLAGS) $(LIBAQ_SRC) $(OS_SUPPORT) $(Threading) $(MonetDB_INC) $(MonetDB_LIB) $(OPTFLAGS) $(LINKFLAGS) $(CXXFLAGS) -o server.so server_uselib: $(CXX) $(SHAREDFLAGS) $(USELIB_FLAG),libaquery.a $(MonetDB_LIB) $(OPTFLAGS) $(LINKFLAGS) $(CXXFLAGS) -o server.so diff --git a/aquery_config.py b/aquery_config.py index 5e4bed2..9f55062 100644 --- a/aquery_config.py +++ b/aquery_config.py @@ -21,7 +21,7 @@ def init_config(): import os from engine.utils import add_dll_dir # os.environ['CXX'] = 'C:/Program Files/LLVM/bin/clang.exe' - os.environ['THREADING'] = '1' + # os.environ['THREADING'] = '1' if ('__config_initialized__' not in globals() or not __config_initialized__): diff --git a/build.py b/build.py index d0fa6c8..f53a467 100644 --- a/build.py +++ b/build.py @@ -173,7 +173,7 @@ class build_manager: self.cxx = '' self.OptimizationLv = '4' # [O0, O1, O2, O3, Ofast] self.Platform = 'amd64' - self.PCH = 1 + self.PCH = os.environ['PCH'] if 'PCH' in os.environ else 1 self.StaticLib = 1 self.fLTO = 1 self.fmarchnative = 1