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

rename GOOGLE_GLOG_DLL_DECL to GLOG_EXPORT #764

Merged
merged 1 commit into from
Feb 14, 2022
Merged

rename GOOGLE_GLOG_DLL_DECL to GLOG_EXPORT #764

merged 1 commit into from
Feb 14, 2022

Conversation

sergiud
Copy link
Collaborator

@sergiud sergiud commented Dec 14, 2021

Use a consistent naming and avoid platform specific terms. Also remove copy and paste code.

@drigz Is there a way to define GLOG_EXPORT=__declspec(dllimport) for Windows builds only when glog is being used (as opposed to being compiled)?

@sergiud sergiud added this to the 0.6 milestone Dec 14, 2021
@sergiud sergiud requested a review from drigz December 14, 2021 20:40
@codecov-commenter
Copy link

codecov-commenter commented Dec 14, 2021

Codecov Report

Merging #764 (24cdfde) into master (aa94e6b) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #764   +/-   ##
=======================================
  Coverage   72.78%   72.78%           
=======================================
  Files          17       17           
  Lines        3259     3259           
=======================================
  Hits         2372     2372           
  Misses        887      887           
Impacted Files Coverage Δ
src/glog/logging.h.in 80.00% <ø> (ø)
src/logging.cc 73.70% <ø> (ø)
src/windows/port.h 100.00% <ø> (ø)
src/vlog_is_on.cc 70.22% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update aa94e6b...24cdfde. Read the comment docs.

@drigz
Copy link
Member

drigz commented Dec 15, 2021

Is there a way to define GLOG_EXPORT=__declspec(dllimport) for Windows builds only when glog is being used (as opposed to being compiled)?

I'm aware that copts affects only the build actions for glog targets, and defines affects both glog actions and actions for targets that depend on glog.

IIUC you are asking if there is something that affects targets that depend on glog but not glog actions themselves. If so, I'm not aware of anything. You could see if copts overrides defines, and if not, you could try something like copts = ["-DACTUALLY_PLEASE_IGNORE_GLOG_EXPORT", ...] and adapt the source code accordingly. Does that answer your question?

@sergiud
Copy link
Collaborator Author

sergiud commented Dec 15, 2021

I'd like to avoid defining export macros in headers. Would it be possible to define GLOG_EXPORT multiple times such that its last definition occurence wins (which should be GLOG_EXPORT=__declspec(dllimport)?

Also, I'm wondering why the Bazel build succeeds in the first place as there's no __declspec(dllimport) currently defined. Does Bazel build a static library version of glog?

@drigz
Copy link
Member

drigz commented Dec 15, 2021

I'm afraid I know very little about how the Windows build works, and I don't understand the effect of the dll* strings.

Would it be possible to define GLOG_EXPORT multiple times such that its last definition occurence wins (which should be GLOG_EXPORT=__declspec(import)?

I tried the following:

cc_library(
    # ...
    defines = ["FOO=one"] + ...,
    copts = ["-UFOO", "-DFOO=two"] + ...,
    # ...
)

This led to the following command line:

/usr/bin/gcc ... '-DFOO=one' ... -UFOO '-DFOO=two' ... -c src/symbolize.cc -o bazel-out/k8-fastbuild/bin/_objs/glog/symbolize.pic.o

So I think that pattern should work if you want to use different settings for the two actions.

@sergiud sergiud force-pushed the glog-export branch 9 times, most recently from 363fa40 to 7d70137 Compare December 23, 2021 23:06
@sergiud
Copy link
Collaborator Author

sergiud commented Dec 23, 2021

@drigz Does Bazel always build a static library of glog? I'm asking because building the Bazel glog example from current master produces several linker errors on Windows related to gflags if I add linkstatic = False to the cc_test rule.

@drigz
Copy link
Member

drigz commented Dec 29, 2021

@drigz Does Bazel always build a static library of glog? I'm asking because building the Bazel glog example from current master produces several linker errors on Windows related to gflags if I add linkstatic = False to the cc_test rule.

That's surprising to me, but I know very little about the behavior on Windows. For cc_test, I'd expect dynamic linking by default (IIRC it does this for faster incremental build/test cycles) whereas cc_binary is mostly-static by default (ie gflags linked statically, libc linked dynamically). I checked this on Linux and it seems to be correct: building a cc_test uses something like gcc -o main main.pic.o -lglog -lgflags -lstdc++ ... whereas the cc_binary uses gcc -o main main.pic.o glog/*.pic.o gflags/*.pic.o -lstdc++ ....

If this is blocking you, send me a repro and I can take a look, it might also be worth trying the bazel-discuss mailing list.

@sergiud
Copy link
Collaborator Author

sergiud commented Feb 1, 2022

@drigz For some reason, AppVeyor builds are active again and cause failing checks. I guess, these should be removed completely.

@drigz
Copy link
Member

drigz commented Feb 7, 2022

I don't know the "right way" to disable AppVeyor. I ticked a box "Skip branches without appveyor.yml" which will hopefully do the trick.

@sergiud
Copy link
Collaborator Author

sergiud commented Feb 7, 2022

Unfortunately, that did not help.

@drigz
Copy link
Member

drigz commented Feb 7, 2022

It seems that I don't have access to the top-level project: I can't change settings at https://ci.appveyor.com/project/google-admin/glog.

IIRC I "added" glog to my AppVeyor account when trying to address your last request: I've deleted that, which might put us back where we were before. I'll see if I can find out anything more useful.

@sergiud
Copy link
Collaborator Author

sergiud commented Feb 11, 2022

@drigz Any updates?

@drigz
Copy link
Member

drigz commented Feb 11, 2022

No response, just tried a different list so we'll see if that helps. I also spotted the failed checks on this project are from @ukai's project, so maybe they can disable that.

If this doesn't work, we could try to figure out how the checks get started: there's no webhook enabled on this repo, but maybe there's a webhook or polling enabled at some other level...

@sergiud
Copy link
Collaborator Author

sergiud commented Feb 11, 2022

Thanks for the update!

@sergiud sergiud marked this pull request as ready for review February 13, 2022 11:52
@sergiud
Copy link
Collaborator Author

sergiud commented Feb 13, 2022

@drigz Seems to be working again.

I would merge this PR as is. PTAL and let me know if you have any concerns.

Use a consistent naming and avoid platform specific terms. Also remove
copy and paste code.
@sergiud sergiud merged commit 9f0b7d3 into master Feb 14, 2022
@sergiud sergiud deleted the glog-export branch February 14, 2022 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants