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

linkstamp not working under windows #6997

Closed
iceboy233 opened this issue Dec 26, 2018 · 15 comments
Closed

linkstamp not working under windows #6997

iceboy233 opened this issue Dec 26, 2018 · 15 comments
Assignees
Labels
area-Windows Windows-specific issues and feature requests P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) stale Issues or PRs that are stale (no activity for 30 days) team-Rules-CPP Issues for C++ rules type: bug

Comments

@iceboy233
Copy link

Description of the problem / feature request:

linkstamp not working under windows.

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

BUILD

cc_library(
    name = "stamp",
    linkstamp = "stamp.cc",
)

cc_binary(
    name = "main",
    deps = [":stamp"],
)

Create WORKSPACE and stamp.cc as empty file.

Run bazel build :main

What operating system are you running Bazel on?

windows 7 x64

What's the output of bazel info release?

INFO: Invocation ID: cc88fec2-4534-4815-9258-15066d7e79b3
release 0.21.0

What's the output of git remote get-url origin ; git rev-parse master ; git rev-parse HEAD ?

'git' 不是内部或外部命令,也不是可运行的程序
或批处理文件。

Have you found anything relevant by searching the web?

No

Any other information, logs, or outputs that you want to share?

INFO: Invocation ID: e87fb112-53df-40f4-9fa6-28c9b57dc0ba
Loading:
Loading: 0 packages loaded
Analyzing: target //:main (1 packages loaded, 0 targets configured)
Internal error thrown during build. Printing stack trace: java.lang.RuntimeExcep
tion: Unrecoverable error while evaluating node '//:main BuildConfigurationValue
.Key[99c851308ce672690ab47bd8a8e4cb79] false' (requested by nodes )
        at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate
.run(AbstractParallelEvaluator.java:499)
        at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$Wrapped
Runnable.run(AbstractQueueVisitor.java:368)
        at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exe
c(Unknown Source)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(Unknown Source)

        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(Unknown Sourc
e)
Caused by: java.lang.IllegalArgumentException
        at com.google.common.base.Preconditions.checkArgument(Preconditions.java
:127)
        at com.google.devtools.build.lib.rules.cpp.CppLinkstampCompileHelper.get
Variables(CppLinkstampCompileHelper.java:141)
        at com.google.devtools.build.lib.rules.cpp.CppLinkstampCompileHelper.cre
ateLinkstampCompileAction(CppLinkstampCompileHelper.java:56)
        at com.google.devtools.build.lib.rules.cpp.CppLinkActionBuilder.build(Cp
pLinkActionBuilder.java:1000)
        at com.google.devtools.build.lib.rules.cpp.CcLinkingHelper.createDynamic
Library(CcLinkingHelper.java:709)
        at com.google.devtools.build.lib.rules.cpp.CcLinkingHelper.createCcLinkA
ctions(CcLinkingHelper.java:439)
        at com.google.devtools.build.lib.rules.cpp.CcLinkingHelper.link(CcLinkin
gHelper.java:356)
        at com.google.devtools.build.lib.rules.cpp.CcBinary.createTransitiveLink
ingActions(CcBinary.java:684)
        at com.google.devtools.build.lib.rules.cpp.CcBinary.init(CcBinary.java:3
99)
        at com.google.devtools.build.lib.rules.cpp.CcBinary.create(CcBinary.java
:240)
        at com.google.devtools.build.lib.rules.cpp.CcBinary.create(CcBinary.java
:76)
        at com.google.devtools.build.lib.analysis.ConfiguredTargetFactory.create
Rule(ConfiguredTargetFactory.java:323)
        at com.google.devtools.build.lib.analysis.ConfiguredTargetFactory.create
ConfiguredTarget(ConfiguredTargetFactory.java:207)
        at com.google.devtools.build.lib.skyframe.SkyframeBuildView.createConfig
uredTarget(SkyframeBuildView.java:728)
        at com.google.devtools.build.lib.skyframe.ConfiguredTargetFunction.creat
eConfiguredTarget(ConfiguredTargetFunction.java:783)
        at com.google.devtools.build.lib.skyframe.ConfiguredTargetFunction.compu
te(ConfiguredTargetFunction.java:326)
        at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate
.run(AbstractParallelEvaluator.java:422)
        ... 5 more

INFO: Elapsed time: 1.707s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (8 packages loaded, 68 targets confi
gured)
Internal error thrown during build. Printing stack trace: java.lang.RuntimeExcep
tion: Unrecoverable error while evaluating node '//:main BuildConfigurationValue
.Key[99c851308ce672690ab47bd8a8e4cb79] false' (requested by nodes )
        at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate
.run(AbstractParallelEvaluator.java:499)
        at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$Wrapped
Runnable.run(AbstractQueueVisitor.java:368)
        at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exe
c(Unknown Source)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(Unknown Source)

        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(Unknown Sourc
e)
Caused by: java.lang.IllegalArgumentException
        at com.google.common.base.Preconditions.checkArgument(Preconditions.java
:127)
        at com.google.devtools.build.lib.rules.cpp.CppLinkstampCompileHelper.get
Variables(CppLinkstampCompileHelper.java:141)
        at com.google.devtools.build.lib.rules.cpp.CppLinkstampCompileHelper.cre
ateLinkstampCompileAction(CppLinkstampCompileHelper.java:56)
        at com.google.devtools.build.lib.rules.cpp.CppLinkActionBuilder.build(Cp
pLinkActionBuilder.java:1000)
        at com.google.devtools.build.lib.rules.cpp.CcLinkingHelper.createDynamic
Library(CcLinkingHelper.java:709)
        at com.google.devtools.build.lib.rules.cpp.CcLinkingHelper.createCcLinkA
ctions(CcLinkingHelper.java:439)
        at com.google.devtools.build.lib.rules.cpp.CcLinkingHelper.link(CcLinkin
gHelper.java:356)
        at com.google.devtools.build.lib.rules.cpp.CcBinary.createTransitiveLink
ingActions(CcBinary.java:684)
        at com.google.devtools.build.lib.rules.cpp.CcBinary.init(CcBinary.java:3
99)
        at com.google.devtools.build.lib.rules.cpp.CcBinary.create(CcBinary.java
:240)
        at com.google.devtools.build.lib.rules.cpp.CcBinary.create(CcBinary.java
:76)
        at com.google.devtools.build.lib.analysis.ConfiguredTargetFactory.create
Rule(ConfiguredTargetFactory.java:323)
        at com.google.devtools.build.lib.analysis.ConfiguredTargetFactory.create
ConfiguredTarget(ConfiguredTargetFactory.java:207)
        at com.google.devtools.build.lib.skyframe.SkyframeBuildView.createConfig
uredTarget(SkyframeBuildView.java:728)
        at com.google.devtools.build.lib.skyframe.ConfiguredTargetFunction.creat
eConfiguredTarget(ConfiguredTargetFunction.java:783)
        at com.google.devtools.build.lib.skyframe.ConfiguredTargetFunction.compu
te(ConfiguredTargetFunction.java:326)
        at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate
.run(AbstractParallelEvaluator.java:422)
        ... 5 more
java.lang.RuntimeException: Unrecoverable error while evaluating node '//:main B
uildConfigurationValue.Key[99c851308ce672690ab47bd8a8e4cb79] false' (requested b
y nodes )
        at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate
.run(AbstractParallelEvaluator.java:499)
        at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$Wrapped
Runnable.run(AbstractQueueVisitor.java:368)
        at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exe
c(Unknown Source)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(Unknown Source)

        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(Unknown Sourc
e)
Caused by: java.lang.IllegalArgumentException
        at com.google.common.base.Preconditions.checkArgument(Preconditions.java
:127)
        at com.google.devtools.build.lib.rules.cpp.CppLinkstampCompileHelper.get
Variables(CppLinkstampCompileHelper.java:141)
        at com.google.devtools.build.lib.rules.cpp.CppLinkstampCompileHelper.cre
ateLinkstampCompileAction(CppLinkstampCompileHelper.java:56)
        at com.google.devtools.build.lib.rules.cpp.CppLinkActionBuilder.build(Cp
pLinkActionBuilder.java:1000)
        at com.google.devtools.build.lib.rules.cpp.CcLinkingHelper.createDynamic
Library(CcLinkingHelper.java:709)
        at com.google.devtools.build.lib.rules.cpp.CcLinkingHelper.createCcLinkA
ctions(CcLinkingHelper.java:439)
        at com.google.devtools.build.lib.rules.cpp.CcLinkingHelper.link(CcLinkin
gHelper.java:356)
        at com.google.devtools.build.lib.rules.cpp.CcBinary.createTransitiveLink
ingActions(CcBinary.java:684)
        at com.google.devtools.build.lib.rules.cpp.CcBinary.init(CcBinary.java:3
99)
        at com.google.devtools.build.lib.rules.cpp.CcBinary.create(CcBinary.java
:240)
        at com.google.devtools.build.lib.rules.cpp.CcBinary.create(CcBinary.java
:76)
        at com.google.devtools.build.lib.analysis.ConfiguredTargetFactory.create
Rule(ConfiguredTargetFactory.java:323)
        at com.google.devtools.build.lib.analysis.ConfiguredTargetFactory.create
ConfiguredTarget(ConfiguredTargetFactory.java:207)
        at com.google.devtools.build.lib.skyframe.SkyframeBuildView.createConfig
uredTarget(SkyframeBuildView.java:728)
        at com.google.devtools.build.lib.skyframe.ConfiguredTargetFunction.creat
eConfiguredTarget(ConfiguredTargetFunction.java:783)
        at com.google.devtools.build.lib.skyframe.ConfiguredTargetFunction.compu
te(ConfiguredTargetFunction.java:326)
        at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate
.run(AbstractParallelEvaluator.java:422)
        ... 5 more
java.lang.RuntimeException: Unrecoverable error while evaluating node '//:main B
uildConfigurationValue.Key[99c851308ce672690ab47bd8a8e4cb79] false' (requested b
y nodes )
        at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate
.run(AbstractParallelEvaluator.java:499)
        at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$Wrapped
Runnable.run(AbstractQueueVisitor.java:368)
        at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exe
c(Unknown Source)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(Unknown Source)

        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(Unknown Sourc
e)
Caused by: java.lang.IllegalArgumentException
        at com.google.common.base.Preconditions.checkArgument(Preconditions.java
:127)
        at com.google.devtools.build.lib.rules.cpp.CppLinkstampCompileHelper.get
Variables(CppLinkstampCompileHelper.java:141)
        at com.google.devtools.build.lib.rules.cpp.CppLinkstampCompileHelper.cre
ateLinkstampCompileAction(CppLinkstampCompileHelper.java:56)
        at com.google.devtools.build.lib.rules.cpp.CppLinkActionBuilder.build(Cp
pLinkActionBuilder.java:1000)
        at com.google.devtools.build.lib.rules.cpp.CcLinkingHelper.createDynamic
Library(CcLinkingHelper.java:709)
        at com.google.devtools.build.lib.rules.cpp.CcLinkingHelper.createCcLinkA
ctions(CcLinkingHelper.java:439)
        at com.google.devtools.build.lib.rules.cpp.CcLinkingHelper.link(CcLinkin
gHelper.java:356)
        at com.google.devtools.build.lib.rules.cpp.CcBinary.createTransitiveLink
ingActions(CcBinary.java:684)
        at com.google.devtools.build.lib.rules.cpp.CcBinary.init(CcBinary.java:3
99)
        at com.google.devtools.build.lib.rules.cpp.CcBinary.create(CcBinary.java
:240)
        at com.google.devtools.build.lib.rules.cpp.CcBinary.create(CcBinary.java
:76)
        at com.google.devtools.build.lib.analysis.ConfiguredTargetFactory.create
Rule(ConfiguredTargetFactory.java:323)
        at com.google.devtools.build.lib.analysis.ConfiguredTargetFactory.create
ConfiguredTarget(ConfiguredTargetFactory.java:207)
        at com.google.devtools.build.lib.skyframe.SkyframeBuildView.createConfig
uredTarget(SkyframeBuildView.java:728)
        at com.google.devtools.build.lib.skyframe.ConfiguredTargetFunction.creat
eConfiguredTarget(ConfiguredTargetFunction.java:783)
        at com.google.devtools.build.lib.skyframe.ConfiguredTargetFunction.compu
te(ConfiguredTargetFunction.java:326)
        at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate
.run(AbstractParallelEvaluator.java:422)
        ... 5 more
FAILED: Build did NOT complete successfully (8 packages loaded, 68 targets confi
gured)
@aiuto aiuto added area-Windows Windows-specific issues and feature requests untriaged labels Jan 2, 2019
@laszlocsomor
Copy link
Contributor

Thanks, I could repro this on Windows 10 x64 as well, and also with older Bazel versions (I tried 0.20.0, 0.19.0, 0.18.0).

@laszlocsomor laszlocsomor added team-Rules-CPP Issues for C++ rules and removed area-Windows Windows-specific issues and feature requests labels Jan 3, 2019
@laszlocsomor
Copy link
Contributor

AFAICT this is a bug in the C++ rules. /cc @hlopko @scentini @oquenchil

@hlopko hlopko added type: bug P1 I'll work on this now. (Assignee required) and removed untriaged labels Jan 9, 2019
@hlopko hlopko self-assigned this Jan 9, 2019
@hlopko
Copy link
Member

hlopko commented Jan 9, 2019

It is indeed! I don't like crashes.

@pablitens
Copy link

@hlopko has this issue been fixed in P1 release? If not, any hope it gets attention any time soon?

@wrowe
Copy link
Contributor

wrowe commented Nov 5, 2019

We have to address this in the very near-term for the envoyproxy. Note that the solution isn't apparent to us yet; there is no option to link.exe to embed an arbitrary binary blob.

@hlopko hlopko assigned lberki and unassigned hlopko Nov 29, 2019
@gregestren gregestren added untriaged and removed P1 I'll work on this now. (Assignee required) labels Jul 7, 2020
@gregestren
Copy link
Contributor

Given the age I reverted the priority to 'untriaged' to signal a request for a more current prioritization.

@wrowe
Copy link
Contributor

wrowe commented Jul 7, 2020

It turned out that the linkstamp problem wasn't unique to Windows... Building a library for iOS already had a workaround. This is what we ended up using for Windows in envoyproxy. It would still be nice to have a more generalized solution. Perhaps using the resource compiler and manifest for dll or exe binaries?

@oquenchil oquenchil added P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) area-Windows Windows-specific issues and feature requests and removed untriaged labels Jul 10, 2020
@jheaff1
Copy link
Contributor

jheaff1 commented Sep 11, 2021

This issue still occurs in bazel 4.2.1. Any update on when it will be fixed? @wrowe May I ask what your workaround was?

@gregestren
Copy link
Contributor

@meteorcloudy

@meteorcloudy
Copy link
Member

Sorry, I don't have any update on this.

@wrowe
Copy link
Contributor

wrowe commented Sep 14, 2021

We have code common to the library implementation (for iOS) shared with the windows .exe target which ignores the gcc version text section altogether, and uses a typical global static const to return the version, instead.

@wrowe
Copy link
Contributor

wrowe commented Sep 14, 2021

You can observe our manual_linkstamp logic here https://github.com/envoyproxy/envoy/tree/main/source/common/version

Particularly the BUILD logic. Our top level project .bazelrc toggles manual_stamp for windows targets.

@zaucy
Copy link
Contributor

zaucy commented Feb 2, 2022

This issue was a blocker for us as well. I ended up making this small header codegen to get us past it. https://github.com/zaucy/rules_cc_stamp

@github-actions
Copy link

Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 1+ years. It will be closed in the next 14 days unless any other activity occurs or one of the following labels is added: "not stale", "awaiting-bazeler". Please reach out to the triage team (@bazelbuild/triage) if you think this issue is still relevant or you are interested in getting the issue resolved.

@github-actions github-actions bot added the stale Issues or PRs that are stale (no activity for 30 days) label Jun 13, 2023
@github-actions
Copy link

This issue has been automatically closed due to inactivity. If you're still interested in pursuing this, please reach out to the triage team (@bazelbuild/triage). Thanks!

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Windows Windows-specific issues and feature requests P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) stale Issues or PRs that are stale (no activity for 30 days) team-Rules-CPP Issues for C++ rules type: bug
Projects
None yet
Development

No branches or pull requests