-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
[glog] fix not work on c++03 #25155
[glog] fix not work on c++03 #25155
Conversation
The previous change was to fix |
vcpkg only support vs 2015 or above which use c++ 14 by default. So we don't need to support c++03 on windows platform. |
As far as I know, just removing the definition of |
ports/glog/noerror-nominmax.patch
Outdated
+# ifndef NOMINMAX | ||
+# define NOMINMAX | ||
+# 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.
I noticed that you have removed NOGDI
, is NOMINMAX
necessary here?
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 remember some ports will build fail if not define NOMINMAX. Maybe I can delete it and see if CI report error. The old error log #22135 (comment) I can't download.
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.
As far as I know, just removing the definition of
NOGDI
can fix the build error ofcolmap
, I want to confirm if your patch has any other effect?
Removing the definition of NOGDI
can fix the build error of colmap
, but CI of vcpkg will fail because of the macro ERROR defined in windows.h. It means that the macro ERROR defined in windows.h will get conflicts with other libs like rocksdb.
Including windows.h in glog is only to support C++03 on windows, and vcpkg only support C++14(C++11?) or above on windows. glog version less than 0.5 does not contain windows.h, and there are no errors when building colmap via vcpkg.
Beside, including windows.h in glog means many macros like MIN, MAX will be exported, and macros like NOMINMAX should be defined when using functions std::min/max.
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.
Removing the definition of
NOGDI
can fix the build error ofcolmap
, but CI of vcpkg will fail because of the macro ERROR defined in windows.h. It means that the macro ERROR defined in windows.h will get conflicts with other libs like rocksdb.Including windows.h in glog is only to support C++03 on windows, and vcpkg only support C++14(C++11?) or above on windows. glog version less than 0.5 does not contain windows.h, and there are no errors when building colmap via vcpkg.
Beside, including windows.h in glog means many macros like MIN, MAX will be exported, and macros like NOMINMAX should be defined when using functions std::min/max.
The problem is that public headers relying on changing
will do something different than
The first form may break the evil header (by extra macros), the second form may break the consumer (by missing macros). |
@dg0yt |
Can you help us to understand the original problem? So there are four variants:
Now there is another variant:
|
Yes, no added patches make folly evpp etc build fail.
NOGDI make colmap build fail,
This is a change in upstream master branch, I just copy it to v0.5.
It undefines ERROR marco. Maybe all macro DEFINE or UNDEFINE like NOMINMAX should defined in other ports that rely on glog build failed? So that glog is very much the same behavior as upstream?
|
Including windows.h in glog 0.5 or 0.6 is only to support C++03 on Windows where atomic is not avaiable. For C++11 and above, using atomic are recommanded. The bug of using atomic has been mentioned and fixed google/glog#671 google/glog#667 PS: |
I add upstream cmake atomic check, thanks. |
This reverts commit 17a80f2.
microsoft.vcpkg.pr (x64_windows_static) ##[error]vcpkg ci failed
@Adela0814 , Would you please rerun microsoft.vcpkg.pr (x64_windows_static). |
Wait for CI to finish, then do |
thanks. |
please merge to master , thanks |
Describe the pull request
fix-windows-CXX11_ATOMIC.patch just "#include <atomic>" which not work on c++03.
What does your PR fix?
Fixes #...
Which triplets are supported/not supported? Have you updated the CI baseline?
<all / linux, windows, ...>, <Yes/No>
Does your PR follow the maintainer guide?
Your answer
If you have added/updated a port: Have you run
./vcpkg x-add-version --all
and committed the result?<Yes / I am still working on this PR>
If you are still working on the PR, open it as a Draft: https://github.blog/2019-02-14-introducing-draft-pull-requests/