This is an automated email from the ASF dual-hosted git repository.

cdutz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/master by this push:
     new 038b7f45e94 build: Changed the build to build a statically linked 
thrift executable for Linux (Also fixed the problem also enabling uinx profiles 
on Macs) (#10788)
038b7f45e94 is described below

commit 038b7f45e949b3e79fe081f8d119eeb6cdcc494e
Author: Christofer Dutz <[email protected]>
AuthorDate: Sat Aug 5 14:52:02 2023 +0200

    build: Changed the build to build a statically linked thrift executable for 
Linux (Also fixed the problem also enabling uinx profiles on Macs) (#10788)
---
 README.md                       |   4 ++
 iotdb-client/client-cpp/pom.xml |   2 +
 pom.xml                         |   9 +--
 tools/thrift/pom.xml            | 154 +++++++++++++++++++++++++++++++++++++++-
 4 files changed, 160 insertions(+), 9 deletions(-)

diff --git a/README.md b/README.md
index 93e3adc6682..a8779316e83 100644
--- a/README.md
+++ b/README.md
@@ -125,6 +125,10 @@ Make sure `Java` is installed, if it's missing, simply 
install it via:
 
     sudo apt install libboost-all-dev
 
+#### OpenSSL header files
+
+    sudo apt -y install libssl-dev
+
 #### OpenSSL
 
 Usually OpenSSL is already installed, however it's missing the header files we 
need to compile.
diff --git a/iotdb-client/client-cpp/pom.xml b/iotdb-client/client-cpp/pom.xml
index 4dfe1253d0f..1e6751ede78 100644
--- a/iotdb-client/client-cpp/pom.xml
+++ b/iotdb-client/client-cpp/pom.xml
@@ -340,6 +340,7 @@
             <activation>
                 <os>
                     <family>unix</family>
+                    <name>Linux</name>
                     <arch>!aarch64</arch>
                 </os>
             </activation>
@@ -354,6 +355,7 @@
             <activation>
                 <os>
                     <family>unix</family>
+                    <name>Linux</name>
                     <arch>aarch64</arch>
                 </os>
             </activation>
diff --git a/pom.xml b/pom.xml
index 059f42214c1..d34f9e35c10 100644
--- a/pom.xml
+++ b/pom.xml
@@ -208,11 +208,6 @@
         <thrift.exec.absolute.path/>
         <thrift.exec-cmd.executable>chmod</thrift.exec-cmd.executable>
         <boost.include.dir/>
-        <!--
-            Setting some random property to some random value, as an empty 
maven
-            property produces a NullPointerException in the cmake plugin.
-        -->
-        <bison.executable.dir>-Dtrue1=true1</bison.executable.dir>
     </properties>
     <!--
         if we claim dependencies in dependencyManagement, then we do not claim
@@ -1124,6 +1119,7 @@
             <activation>
                 <os>
                     <family>unix</family>
+                    <name>Linux</name>
                     <arch>!aarch64</arch>
                 </os>
             </activation>
@@ -1138,6 +1134,7 @@
             <activation>
                 <os>
                     <family>unix</family>
+                    <name>Linux</name>
                     <arch>aarch64</arch>
                 </os>
             </activation>
@@ -1160,7 +1157,6 @@
                 <cmake.generator>Unix Makefiles</cmake.generator>
                 <thrift.executable>thrift</thrift.executable>
                 <boost.include.dir>/usr/local/include</boost.include.dir>
-                
<bison.executable.dir>-DBISON_EXECUTABLE=/usr/local/opt/bison/bin/bison</bison.executable.dir>
             </properties>
         </profile>
         <profile>
@@ -1176,7 +1172,6 @@
                 <cmake.generator>Unix Makefiles</cmake.generator>
                 <thrift.executable>thrift</thrift.executable>
                 
<boost.include.dir>/opt/homebrew/opt/boost/include</boost.include.dir>
-                
<bison.executable.dir>-DBISON_EXECUTABLE=/opt/homebrew/opt/bison/bin/bison</bison.executable.dir>
             </properties>
         </profile>
         <profile>
diff --git a/tools/thrift/pom.xml b/tools/thrift/pom.xml
index 25717d66a0a..8da28e521c0 100644
--- a/tools/thrift/pom.xml
+++ b/tools/thrift/pom.xml
@@ -114,8 +114,6 @@
                                 <!-- Generate libthrift.a to compile IoTDB 
Session -->
                                 <option>-DWITH_STATIC_LIB=ON</option>
                                 
<option>-DCMAKE_POSITION_INDEPENDENT_CODE=ON</option>
-                                <!-- Specify new version Bison path for 
Mac-OS, as the default version is too old -->
-                                <option>${bison.executable.dir}</option>
                             </options>
                         </configuration>
                     </execution>
@@ -159,4 +157,156 @@
             </plugin>
         </plugins>
     </build>
+    <profiles>
+        <profile>
+            <id>.os-unix</id>
+            <activation>
+                <os>
+                    <family>unix</family>
+                    <name>Linux</name>
+                    <arch>!aarch64</arch>
+                </os>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>com.googlecode.cmake-maven-project</groupId>
+                        <artifactId>cmake-maven-plugin</artifactId>
+                        <executions>
+                            <!-- Uses a CMake generator to generate the build 
using the build tool of choice -->
+                            <execution>
+                                <id>cmake-generate</id>
+                                <phase>generate-sources</phase>
+                                <goals>
+                                    <goal>generate</goal>
+                                </goals>
+                                <configuration>
+                                    <generator>${cmake.generator}</generator>
+                                    
<sourcePath>${project.build.directory}/thrift-${thrift.version}</sourcePath>
+                                    
<targetPath>${project.build.directory}/build</targetPath>
+                                    <options combine.children="append">
+                                        <!-- Tell the linker to build 
statically linked binaries -->
+                                        
<option>-DCMAKE_EXE_LINKER_FLAGS=-static</option>
+                                        
<option>-DZLIB_USE_STATIC_LIBS=ON</option>
+                                        
<option>-DOPENSSL_USE_STATIC_LIBS=ON</option>
+                                    </options>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+        <profile>
+            <id>.os-unix-arm</id>
+            <activation>
+                <os>
+                    <family>unix</family>
+                    <name>Linux</name>
+                    <arch>aarch64</arch>
+                </os>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>com.googlecode.cmake-maven-project</groupId>
+                        <artifactId>cmake-maven-plugin</artifactId>
+                        <executions>
+                            <!-- Uses a CMake generator to generate the build 
using the build tool of choice -->
+                            <execution>
+                                <id>cmake-generate</id>
+                                <phase>generate-sources</phase>
+                                <goals>
+                                    <goal>generate</goal>
+                                </goals>
+                                <configuration>
+                                    <generator>${cmake.generator}</generator>
+                                    
<sourcePath>${project.build.directory}/thrift-${thrift.version}</sourcePath>
+                                    
<targetPath>${project.build.directory}/build</targetPath>
+                                    <options combine.children="append">
+                                        <!-- Tell the linker to build 
statically linked binaries -->
+                                        
<option>-DCMAKE_EXE_LINKER_FLAGS=-static</option>
+                                        
<option>-DZLIB_USE_STATIC_LIBS=ON</option>
+                                        
<option>-DOPENSSL_USE_STATIC_LIBS=ON</option>
+                                    </options>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+        <profile>
+            <id>.os-mac</id>
+            <activation>
+                <os>
+                    <family>mac</family>
+                    <arch>!aarch64</arch>
+                </os>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>com.googlecode.cmake-maven-project</groupId>
+                        <artifactId>cmake-maven-plugin</artifactId>
+                        <executions>
+                            <!-- Uses a CMake generator to generate the build 
using the build tool of choice -->
+                            <execution>
+                                <id>cmake-generate</id>
+                                <phase>generate-sources</phase>
+                                <goals>
+                                    <goal>generate</goal>
+                                </goals>
+                                <configuration>
+                                    <generator>${cmake.generator}</generator>
+                                    
<sourcePath>${project.build.directory}/thrift-${thrift.version}</sourcePath>
+                                    
<targetPath>${project.build.directory}/build</targetPath>
+                                    <options combine.children="append">
+                                        <!-- Specify new version Bison path 
for Mac-OS, as the default version is too old -->
+                                        
<option>-DBISON_EXECUTABLE=/usr/local/opt/bison/bin/bison</option>
+                                    </options>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+        <profile>
+            <id>.os-mac-arm</id>
+            <activation>
+                <os>
+                    <family>mac</family>
+                    <arch>aarch64</arch>
+                </os>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>com.googlecode.cmake-maven-project</groupId>
+                        <artifactId>cmake-maven-plugin</artifactId>
+                        <executions>
+                            <!-- Uses a CMake generator to generate the build 
using the build tool of choice -->
+                            <execution>
+                                <id>cmake-generate</id>
+                                <phase>generate-sources</phase>
+                                <goals>
+                                    <goal>generate</goal>
+                                </goals>
+                                <configuration>
+                                    <generator>${cmake.generator}</generator>
+                                    
<sourcePath>${project.build.directory}/thrift-${thrift.version}</sourcePath>
+                                    
<targetPath>${project.build.directory}/build</targetPath>
+                                    <options combine.children="append">
+                                        <!-- Specify new version Bison path 
for Mac-OS, as the default version is too old -->
+                                        
<option>-DBISON_EXECUTABLE=/opt/homebrew/opt/bison/bin/bison</option>
+                                    </options>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
 </project>

Reply via email to