Skip to content
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

[evpp] Fix build error on OSX #11967

Merged
merged 3 commits into from
Jul 7, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ports/evpp/CONTROL
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Source: evpp
Version: 0.7.0-2
Version: 0.7.0-3
Homepage: https:/Qihoo360/evpp
Description: A modern C++ network library based on libevent for developing high performance network services in TCP/UDP/HTTP protocols.
Build-Depends: glog, libevent (windows), libevent[openssl] (!windows), rapidjson, concurrentqueue (!windows), boost-lockfree (!windows)
45 changes: 45 additions & 0 deletions ports/evpp/fix-osx-build.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
diff --git a/evpp/server_status.h b/evpp/server_status.h
index 3a83725..f28f833 100644
--- a/evpp/server_status.h
+++ b/evpp/server_status.h
@@ -25,7 +25,7 @@ public:
};

std::string StatusToString() const {
- H_CASE_STRING_BIGIN(status_);
+ H_CASE_STRING_BIGIN(+status_);
H_CASE_STRING(kNull);
H_CASE_STRING(kInitialized);
H_CASE_STRING(kRunning);
diff --git a/evpp/sockets.cc b/evpp/sockets.cc
index 333c05c..c547d88 100644
--- a/evpp/sockets.cc
+++ b/evpp/sockets.cc
@@ -22,6 +22,14 @@ std::string strerror(int e) {
}

return empty_string;
+#elif defined(__APPLE__)
+ char buf[2048] = {};
+ strerror_r(e, buf, sizeof(buf) - 1);
+ const char* s = buf;
+ if (s) {
+ return std::string(s);
+ }
+ return std::string();
#else
char buf[2048] = {};
const char* s = strerror_r(e, buf, sizeof(buf) - 1);
diff --git a/evpp/tcp_conn.cc b/evpp/tcp_conn.cc
index b7678d0..527b2b9 100644
--- a/evpp/tcp_conn.cc
+++ b/evpp/tcp_conn.cc
@@ -309,7 +309,7 @@ void TCPConn::SetTCPNoDelay(bool on) {
}

std::string TCPConn::StatusToString() const {
- H_CASE_STRING_BIGIN(status_);
+ H_CASE_STRING_BIGIN(+status_);
H_CASE_STRING(kDisconnected);
H_CASE_STRING(kConnecting);
H_CASE_STRING(kConnected);
7 changes: 4 additions & 3 deletions ports/evpp/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
include(vcpkg_common_functions)

set(EVPP_VERSION 0.7.0)

vcpkg_from_github(
Expand All @@ -11,13 +9,16 @@ vcpkg_from_github(
PATCHES
fix-rapidjson-1-1.patch
fix-linux-build.patch
fix-osx-build.patch
)

file(REMOVE_RECURSE ${SOURCE_PATH}/3rdparty/rapidjson ${SOURCE_PATH}/3rdparty/concurrentqueue)

vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS -DEVPP_VCPKG_BUILD=ON
OPTIONS
-DEVPP_VCPKG_BUILD=ON
)

vcpkg_install_cmake()
Expand Down
1 change: 0 additions & 1 deletion scripts/ci.baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,6 @@ epsilon:arm-uwp=fail
epsilon:x64-linux=fail
epsilon:x64-osx=fail
epsilon:x64-uwp=fail
evpp:x64-osx=fail
expat:arm-uwp=fail
expat:x64-uwp=fail
faad2:x64-linux=fail
Expand Down