-
Notifications
You must be signed in to change notification settings - Fork 389
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
feat: loongcollector support windows build #2082
base: main
Are you sure you want to change the base?
Conversation
bilosikia
commented
Feb 10, 2025
•
edited by linrunqi08
Loading
edited by linrunqi08
- windows 64位不兼容函数调用均使用#if defined(linux)或者#if defined(_MSC_VER)进行区分
- 部分暂未实现或者暂未修复的ut均使用// TODO: windows进行标识
- CI已添加windows编译+运行UT的workflow,代码合入之后,后续所有代码均会运行windows编译的CI
c56cd6c
to
065ff03
Compare
4a3174b
to
e9ea349
Compare
|
||
if (mIdleFlag) | ||
// check exiting | ||
if (mIdleFlag && !Application::GetInstance()->IsExiting()) |
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.
这里为啥加了一个条件?
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.
这个文件直接删了吧
@@ -38,10 +38,31 @@ struct CompressedLogGroup { | |||
CompressedLogGroup(std::string&& data, size_t rawSize) : mData(std::move(data)), mRawSize(rawSize) {} | |||
}; | |||
|
|||
// vc++ must implemented with declare, cant implement in cpp file. |
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.
改一下描述吧,template specialization must be implemented in h file in vc++
@@ -180,7 +180,7 @@ std::string EncodingConverter::FromACPToUTF8(const std::string& s) const { | |||
|
|||
auto input = const_cast<char*>(s.c_str()); | |||
auto inputLen = s.length(); | |||
std::vector<size_t> ignore; | |||
std::vector<long> ignore; |
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.
这里为什么要改?
#if defined(_MSC_VER) | ||
setsockopt(fd, IPPROTO_IP, IP_TOS, (const char*)&(*socket->mTOS), sizeof(socket->mTOS)); | ||
#else | ||
setsockopt(fd, IPPROTO_IP, IP_TOS, &socket->mTOS, sizeof(socket->mTOS)); | ||
#endif |
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.
统一改成这样&socket->mTOS.value(), sizeof(uint32_t));可以吗?
@@ -390,6 +390,8 @@ bool CommonConfigProvider::DumpConfigFile(const configserver::proto::v2::ConfigD | |||
return false; | |||
} | |||
fout << configDetail; | |||
// in windows, if not close fout, rename will faield, This file is being used by other programs. | |||
fout.close(); |
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.
387到392行用花括号包起来吧,别加close了,其它地方也是这么改的,这里漏了
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.
同主文件,这些相关的类也需要条件编译
@@ -68,6 +68,11 @@ void ProcessorTagNativeUnittest::TestInit() { | |||
} | |||
} | |||
|
|||
// TODO: windows | |||
#if defined(_MSC_VER) | |||
void ProcessorTagNativeUnittest::TestProcess() { |
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.
这里是什么原因不过?
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.
放到内部去
@@ -39,6 +39,8 @@ if(MSVC) | |||
if (ENABLE_ENTERPRISE) | |||
list(REMOVE_ITEM THIS_SOURCE_FILES_LIST ${CMAKE_SOURCE_DIR}/common/LinuxDaemonUtil.h ${CMAKE_SOURCE_DIR}/common/LinuxDaemonUtil.cpp) | |||
endif() | |||
elseif(UNIX) |
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.
这里也要加上enterprise
@@ -61,6 +61,10 @@ | |||
#endif | |||
#else | |||
#include "provider/Provider.h" | |||
#if defined(_MSC_VER) |
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.
应该不需要了
@@ -222,15 +222,18 @@ bool MultilineOptions::ParseRegex(const string& pattern, shared_ptr<boost::regex | |||
|
|||
const string& UnmatchedContentTreatmentToString(MultilineOptions::UnmatchedContentTreatment unmatchedContentTreatment) { | |||
switch (unmatchedContentTreatment) { | |||
case MultilineOptions::UnmatchedContentTreatment::DISCARD: | |||
case MultilineOptions::UnmatchedContentTreatment::DISCARD: { |
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.
不加{},windows编译有问题?
@@ -1878,6 +1878,81 @@ void AppConfig::RegisterCallback(const std::string& key, std::function<bool()>* | |||
mCallbacks[key] = callback; | |||
} | |||
|
|||
#if defined(_MSC_VER) |
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.
有单测覆盖
#else | ||
// TODO: windows | ||
// need fopen with "rb"? | ||
std::FILE* file = std::fopen(filePath.c_str(), "r"); |
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.
有单测覆盖
@@ -141,7 +141,7 @@ void CommonConfigProvider::LoadConfigFile() { | |||
Json::Value detail; | |||
if (LoadConfigDetailFromFile(entry, detail)) { | |||
ConfigInfo info; | |||
info.name = entry.path().stem(); | |||
info.name = entry.path().stem().string(); |
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.
|
||
if (mIdleFlag) | ||
// check exiting | ||
if (mIdleFlag && !Application::GetInstance()->IsExiting()) |
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.
这个地方可能会一直 continue,无法退出。
// TODO: windows | ||
// windows can't instantiation with char32_t, unsigend maybe not ok. | ||
#if defined(_MSC_VER) | ||
std::wstring_convert<std::codecvt_utf8<unsigned long>, unsigned long> convert; |
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.
目前只有 parse docker log 用了,有单测覆盖。
mkdir output | ||
xcopy /Y %LOONCOLLECTOR_CORE_BUILD_PATH%\go_pipeline\Release\GoPluginAdapter.dll %LOONGCOLLECTOR_SRC_PATH%\pkg\logtail\ | ||
set LDFLAGS="-X "github.com/alibaba/ilogtail/pluginmanager.BaseVersion=%LOONCOLLECTOR_VERSION%"" | ||
%GO_BIN% build -mod=mod -buildmode=c-shared -ldflags=%LDFLAGS% -o output\PluginBase.dll %LOONGCOLLECTOR_SRC_UNIX_PATH%\plugin_main |
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.
这个命名不对,需改下