-
Notifications
You must be signed in to change notification settings - Fork 561
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Thrift] Build thrift library with cmake. #5427
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
2e2ac99
Build thrift library with cmake.
evetion 8199ee5
Add Thrift as new package.
evetion 8cdb754
Revert ThriftJuliaCompiler.
evetion 0bb9527
Name package Thrift.
evetion d796f38
Build dir outside of src dir.
evetion 0920e92
Apply patch for Windows.
evetion 4e443ec
Disable tutorials and add another patch.
evetion f553cde
Also lowercase <windows.h>.
evetion feb2381
Patch FreeBSD and fix patches.
evetion f914c37
Build under src dir.
evetion 5adf578
More case-sensitive fixes.
evetion d2607f8
Another patch update...
evetion d0dce62
More case-sensitive fixes.
evetion a6774ce
Fix double patch. Exclude Delphi compiler, it uses unsupported codecv…
evetion 1e2ccb2
Merge branch 'master' into feat/thrift
evetion f67654e
Update T/Thrift/build_tarballs.jl
evetion File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# Note that this script can accept some limited command-line arguments, run | ||
# `julia build_tarballs.jl --help` to see a usage message. | ||
using BinaryBuilder, Pkg | ||
|
||
name = "Thrift" | ||
version = v"0.16.0" | ||
|
||
# Collection of sources required to complete build | ||
sources = [ | ||
GitSource("https://github.com/apache/thrift.git", "2a93df80f27739ccabb5b885cb12a8dc7595ecdf") | ||
DirectorySource("./bundled") | ||
] | ||
|
||
# Bash recipe for building across all platforms | ||
script = raw""" | ||
cd $WORKSPACE/srcdir/thrift | ||
|
||
# Needed as https://github.com/apache/thrift/pull/2518 isn't released yet | ||
for f in ${WORKSPACE}/srcdir/patches/*.patch; do | ||
atomic_patch -p1 ${f} | ||
done | ||
|
||
mkdir build_dir && cd build_dir | ||
|
||
CMAKE_FLAGS=(-DCMAKE_INSTALL_PREFIX=$prefix | ||
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} | ||
-DCMAKE_BUILD_TYPE=Release | ||
-DBUILD_COMPILER=ON | ||
-DBUILD_CPP=ON | ||
-DBUILD_PYTHON=OFF | ||
-DBUILD_TESTING=OFF | ||
-DBUILD_JAVASCRIPT=OFF | ||
-DBUILD_NODEJS=OFF | ||
-DWITH_SHARED_LIB=ON | ||
-DBUILD_TUTORIALS=OFF | ||
-DTHRIFT_COMPILER_DELPHI=OFF) | ||
|
||
cmake .. "${CMAKE_FLAGS[@]}" | ||
|
||
make -j${nproc} | ||
make install | ||
""" | ||
|
||
# These are the platforms we will build for by default, unless further | ||
# platforms are passed in on the command line | ||
platforms = expand_cxxstring_abis(supported_platforms()) | ||
|
||
# The products that we will ensure are always built | ||
products = [ | ||
ExecutableProduct("thrift", :thrift) | ||
LibraryProduct("libthrift", :libthrift) | ||
] | ||
|
||
# Dependencies that must be installed before this package can be built | ||
dependencies = [ | ||
Dependency("boost_jll", compat="=1.76.0") | ||
] | ||
|
||
# Build the tarballs, and possibly a `build.jl` as well. | ||
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; julia_compat="1.6") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
diff --git a/lib/cpp/src/thrift/transport/TSocket.cpp b/lib/cpp/src/thrift/transport/TSocket.cpp | ||
index 9991fd6bd..e46daeba8 100644 | ||
--- a/lib/cpp/src/thrift/transport/TSocket.cpp | ||
+++ b/lib/cpp/src/thrift/transport/TSocket.cpp | ||
@@ -432,6 +432,10 @@ void TSocket::local_open() { | ||
TWinsockSingleton::create(); | ||
#endif // _WIN32 | ||
|
||
+#if __FreeBSD__ | ||
+ #define EAI_NODATA EAI_NONAME | ||
+#endif // __FreeBSD__ | ||
+ | ||
if (isOpen()) { | ||
return; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,184 @@ | ||
diff --git a/compiler/cpp/tests/catch/catch.hpp b/compiler/cpp/tests/catch/catch.hpp | ||
index 33d037e55..1744c742d 100644 | ||
--- a/compiler/cpp/tests/catch/catch.hpp | ||
+++ b/compiler/cpp/tests/catch/catch.hpp | ||
@@ -6338,7 +6338,7 @@ namespace Catch { | ||
#endif | ||
|
||
#ifdef __AFXDLL | ||
-#include <AfxWin.h> | ||
+#include <afxwin.h> | ||
#else | ||
#include <windows.h> | ||
#endif | ||
diff --git a/lib/cpp/src/thrift/protocol/TProtocol.h b/lib/cpp/src/thrift/protocol/TProtocol.h | ||
index 867ceb079..b691c4169 100644 | ||
--- a/lib/cpp/src/thrift/protocol/TProtocol.h | ||
+++ b/lib/cpp/src/thrift/protocol/TProtocol.h | ||
@@ -22,7 +22,7 @@ | ||
|
||
#ifdef _WIN32 | ||
// Need to come before any Windows.h includes | ||
-#include <Winsock2.h> | ||
+#include <winsock2.h> | ||
#endif | ||
|
||
#include <thrift/transport/TTransport.h> | ||
diff --git a/lib/cpp/src/thrift/transport/THttpServer.cpp b/lib/cpp/src/thrift/transport/THttpServer.cpp | ||
index 91a1c39af..6fc281674 100644 | ||
--- a/lib/cpp/src/thrift/transport/THttpServer.cpp | ||
+++ b/lib/cpp/src/thrift/transport/THttpServer.cpp | ||
@@ -25,7 +25,7 @@ | ||
#include <thrift/transport/THttpServer.h> | ||
#include <thrift/transport/TSocket.h> | ||
#if defined(_MSC_VER) || defined(__MINGW32__) | ||
- #include <Shlwapi.h> | ||
+ #include <shlwapi.h> | ||
#endif | ||
|
||
using std::string; | ||
diff --git a/lib/cpp/src/thrift/transport/TPipeServer.cpp b/lib/cpp/src/thrift/transport/TPipeServer.cpp | ||
index e4234b180..fd1aeee95 100644 | ||
--- a/lib/cpp/src/thrift/transport/TPipeServer.cpp | ||
+++ b/lib/cpp/src/thrift/transport/TPipeServer.cpp | ||
@@ -27,8 +27,8 @@ | ||
#ifdef _WIN32 | ||
#include <thrift/windows/OverlappedSubmissionThread.h> | ||
#include <thrift/windows/Sync.h> | ||
-#include <AccCtrl.h> | ||
-#include <Aclapi.h> | ||
+#include <accctrl.h> | ||
+#include <aclapi.h> | ||
#include <sddl.h> | ||
#endif //_WIN32 | ||
|
||
diff --git a/lib/cpp/src/thrift/transport/TServerSocket.cpp b/lib/cpp/src/thrift/transport/TServerSocket.cpp | ||
index 25ec789e0..8dda1072b 100644 | ||
--- a/lib/cpp/src/thrift/transport/TServerSocket.cpp | ||
+++ b/lib/cpp/src/thrift/transport/TServerSocket.cpp | ||
@@ -70,7 +70,7 @@ | ||
// adds problematic macros like min() and max(). Try to work around: | ||
#define NOMINMAX | ||
#define WIN32_LEAN_AND_MEAN | ||
-#include <Windows.h> | ||
+#include <windows.h> | ||
#undef NOMINMAX | ||
#undef WIN32_LEAN_AND_MEAN | ||
#endif | ||
diff --git a/lib/cpp/src/thrift/transport/TWebSocketServer.h b/lib/cpp/src/thrift/transport/TWebSocketServer.h | ||
index 7f39f36b9..2a3e076cf 100644 | ||
--- a/lib/cpp/src/thrift/transport/TWebSocketServer.h | ||
+++ b/lib/cpp/src/thrift/transport/TWebSocketServer.h | ||
@@ -31,7 +31,7 @@ | ||
#include <thrift/transport/TSocket.h> | ||
#include <thrift/transport/THttpServer.h> | ||
#if defined(_MSC_VER) || defined(__MINGW32__) | ||
-#include <Shlwapi.h> | ||
+#include <shlwapi.h> | ||
#define THRIFT_strncasecmp(str1, str2, len) _strnicmp(str1, str2, len) | ||
#define THRIFT_strcasestr(haystack, needle) StrStrIA(haystack, needle) | ||
#else | ||
diff --git a/lib/cpp/src/thrift/windows/GetTimeOfDay.cpp b/lib/cpp/src/thrift/windows/GetTimeOfDay.cpp | ||
index ac24124b3..d3696053b 100644 | ||
--- a/lib/cpp/src/thrift/windows/GetTimeOfDay.cpp | ||
+++ b/lib/cpp/src/thrift/windows/GetTimeOfDay.cpp | ||
@@ -38,7 +38,7 @@ int thrift_gettimeofday(struct timeval* tv, struct timezone* tz) { | ||
} | ||
#else | ||
#define WIN32_LEAN_AND_MEAN | ||
-#include <Winsock2.h> | ||
+#include <winsock2.h> | ||
#include <cstdint> | ||
#include <sstream> | ||
#include <thrift/transport/TTransportException.h> | ||
diff --git a/lib/cpp/src/thrift/windows/SocketPair.cpp b/lib/cpp/src/thrift/windows/SocketPair.cpp | ||
index 2650b37d4..9271b0294 100644 | ||
--- a/lib/cpp/src/thrift/windows/SocketPair.cpp | ||
+++ b/lib/cpp/src/thrift/windows/SocketPair.cpp | ||
@@ -34,7 +34,7 @@ | ||
#include <string.h> | ||
|
||
// Win32 | ||
-#include <WS2tcpip.h> | ||
+#include <ws2tcpip.h> | ||
|
||
int thrift_socketpair(int d, int type, int protocol, THRIFT_SOCKET sv[2]) { | ||
THRIFT_UNUSED_VARIABLE(protocol); | ||
diff --git a/lib/cpp/src/thrift/windows/SocketPair.h b/lib/cpp/src/thrift/windows/SocketPair.h | ||
index 86bf43150..74b65dfaa 100644 | ||
--- a/lib/cpp/src/thrift/windows/SocketPair.h | ||
+++ b/lib/cpp/src/thrift/windows/SocketPair.h | ||
@@ -29,7 +29,7 @@ | ||
#endif | ||
|
||
// Win32 | ||
-#include <Winsock2.h> | ||
+#include <winsock2.h> | ||
#include <thrift/thrift-config.h> | ||
|
||
int thrift_socketpair(int d, int type, int protocol, THRIFT_SOCKET sv[2]); | ||
diff --git a/lib/cpp/src/thrift/windows/Sync.h b/lib/cpp/src/thrift/windows/Sync.h | ||
index f5b8a052d..df93e7436 100644 | ||
--- a/lib/cpp/src/thrift/windows/Sync.h | ||
+++ b/lib/cpp/src/thrift/windows/Sync.h | ||
@@ -31,7 +31,7 @@ | ||
// adds problematic macros like min() and max(). Try to work around: | ||
#define NOMINMAX | ||
#define WIN32_LEAN_AND_MEAN | ||
-#include <Windows.h> | ||
+#include <windows.h> | ||
#undef NOMINMAX | ||
#undef WIN32_LEAN_AND_MEAN | ||
|
||
diff --git a/lib/cpp/src/thrift/windows/WinFcntl.h b/lib/cpp/src/thrift/windows/WinFcntl.h | ||
index 4816fc5ec..39e5efd13 100644 | ||
--- a/lib/cpp/src/thrift/windows/WinFcntl.h | ||
+++ b/lib/cpp/src/thrift/windows/WinFcntl.h | ||
@@ -33,7 +33,7 @@ | ||
#endif | ||
|
||
// Win32 | ||
-#include <Winsock2.h> | ||
+#include <winsock2.h> | ||
#include <thrift/transport/PlatformSocket.h> | ||
|
||
extern "C" { | ||
diff --git a/lib/cpp/src/thrift/windows/config.h b/lib/cpp/src/thrift/windows/config.h | ||
index ce10c5524..19296d63f 100644 | ||
--- a/lib/cpp/src/thrift/windows/config.h | ||
+++ b/lib/cpp/src/thrift/windows/config.h | ||
@@ -57,7 +57,7 @@ | ||
#include <thrift/windows/SocketPair.h> | ||
|
||
// windows | ||
-#include <Winsock2.h> | ||
+#include <winsock2.h> | ||
#include <ws2tcpip.h> | ||
|
||
#ifndef __MINGW32__ | ||
diff --git a/lib/cpp/test/OpenSSLManualInitTest.cpp b/lib/cpp/test/OpenSSLManualInitTest.cpp | ||
index 935a20514..bf6c15369 100644 | ||
--- a/lib/cpp/test/OpenSSLManualInitTest.cpp | ||
+++ b/lib/cpp/test/OpenSSLManualInitTest.cpp | ||
@@ -21,7 +21,7 @@ | ||
// which will cause the test to fail | ||
#define MANUAL_OPENSSL_INIT 1 | ||
#ifdef _WIN32 | ||
-#include <WinSock2.h> | ||
+#include <winsock2.h> | ||
#endif | ||
|
||
#include <boost/test/unit_test.hpp> | ||
diff --git a/lib/py/src/ext/endian.h b/lib/py/src/ext/endian.h | ||
index 1660cbd98..a2cf594ed 100644 | ||
--- a/lib/py/src/ext/endian.h | ||
+++ b/lib/py/src/ext/endian.h | ||
@@ -25,7 +25,7 @@ | ||
#ifndef _WIN32 | ||
#include <netinet/in.h> | ||
#else | ||
-#include <WinSock2.h> | ||
+#include <winsock2.h> | ||
#pragma comment(lib, "ws2_32.lib") | ||
#define BIG_ENDIAN (4321) | ||
#define LITTLE_ENDIAN (1234) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not very convinced by this patch. How did you come up with that?
EAI_NODATA
is innetdb.h
on FreeBSD with value 7,EAI_NONAME
has value 8 (butEAI_NODATA
is inside an#if 0
):There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a C++ programmer so I could be wrong here. I got the following error on freebsd
in a previous build.
There are many hits when you google this, but essentially FreeBSD obsoleted it in an RFC, as it states in your
netdb.h
example. Similarly, the manual doesn't mention it anymore: https://www.freebsd.org/cgi/man.cgi?query=gai_strerror&sektion=3&apropos=0&manpath=FreeBSD+7.1-RELEASE and the mailing list states that:Eventlet patched this in a similar way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, if FreeBSD devs tell to use
EAI_NONAME
instead ofEAI_NODATA
then this is good I guess.