Comments (8)
This is very surprising. Couldn't reproduce with this BUILD file on Linux, though:
cc_library(
name = "a",
srcs = ["a.cpp"],
)
cc_library(
name = "b",
srcs = ["b.cpp"],
deps = [":a"],
)
cc_binary(
name = "main",
srcs = ["main.cpp"],
deps = [":b"],
)
Assigning to Damien since he knows a tad more about Mac than I do.
from bazel.
Cannot reproduce:
# Regression test for https://github.com/google/bazel/issues/67
# C++ library depedending on C++ library fails to compile on Darwin
function test_cpp_libdeps() {
mkdir -p pkg
cat <<'EOF' >pkg/BUILD
cc_library(
name = "a",
srcs = ["a.cc"],
)
cc_library(
name = "b",
srcs = ["b.cc"],
deps = [":a"],
)
cc_binary(
name = "main",
srcs = ["main.cc"],
deps = [":b"],
)
EOF
cat <<'EOF' >pkg/a.cc
#include <string>
std::string get_hello(std::string world) {
return "Hello, " + world + "!";
}
EOF
cat <<'EOF' >pkg/b.cc
#include <string>
#include <iostream>
std::string get_hello(std::string);
void print_hello(std::string world) {
std::cout << get_hello(world) << std::endl;
}
EOF
cat <<'EOF' >pkg/main.cc
#include <string>
void print_hello(std::string);
int main() {
print_hello(std::string("World"));
}
EOF
bazel build //pkg:a >& $TEST_log \
|| fail "Failed to build //pkg:a"
bazel build //pkg:b >& $TEST_log \
|| fail "Failed to build //pkg:b"
bazel run //pkg:main >& $TEST_log \
|| fail "Failed to run //pkg:main"
expect_log "Hello, World!";
}
Succeed on my mac I will commit it to share it but the output is clean. I might have forgotten a flag though
EDIT NOTE: I added the two build to the test case to have a failing test case for future reference.
from bazel.
\o/ I have a failing test
from bazel.
Add an a.h which b.cc includes and calls a function from.
On Mar 27, 2015 6:45 AM, "lberki" [email protected] wrote:
This is very surprising. Couldn't reproduce with this BUILD file on Linux,
though:cc_library(
name = "a",
srcs = ["a.cpp"],
)cc_library(
name = "b",
srcs = ["b.cpp"],
deps = [":a"],
)cc_binary(
name = "main",
srcs = ["main.cpp"],
deps = [":b"],
)Assigning to Damien since he knows a tad more about Mac than I do.
—
Reply to this email directly or view it on GitHub
#67 (comment).
from bazel.
The problem is that darwin clang expect to have all the dependency provided at compile time. It is not going to be fast to fix.
from bazel.
I edited the test case in my previous message to have an actually failing one for future reference.
from bazel.
I've encountered this issue as well.
from bazel.
I've been hitting this too. I've worked around the issue by adding:
linker_flag: "-undefined"
linker_flag: "dynamic_lookup"
into my CROSSTOOL file. Not sure the larger implications of this style lookup though. But, it's enough for me to actually compile, so I'm happy for now.
from bazel.
Related Issues (20)
- build_tar attempts to use python2 when upgrading to Bazel 6.0.0 HOT 4
- Get I/O exception during sandboxed execution (File exists) when running bazel test. HOT 1
- Java: Overriding record toString() can't be referred to as a dependency HOT 1
- Failed to start local Bazel server on amd64 linux environment on apple silicon.
- [Build Failure] Bazel fails to find toolchains for java on FreeBSD 14-CURRENT amd64 from git checkout at HEAD While resolving toolchains for target @rules_jvm_external//private/tools/java/rules/jvm/external/jar:AddJarManifestEntry: No matching toolchains found for types @bazel_tools//tools/jdk:runtime_toolchain_type.
- 'cannot prefetch a directory' crash HOT 2
- `--remote-download-minimal` does not behave correctly with RBE and `bazel test`. HOT 2
- bazel fails to build target on Windows 11 RAM disk mount with blaze_util::MakeCanonical(...) failed: (error: 1): Incorrect function.
- Build event protocol has incomplete output names
- [bazel.coverage] Problem with coverage reports in multiple modes(set, atomic)
- [bazel.build] Problem with /start/cpp HOT 1
- [6.1.0] have 'bazel test' non-test targets depend on --remote_download_output
- [bazel.build] Problem with /reference/be/python
- 'Output null download failed' at HEAD HOT 2
- [6.1.0] Do the AC integrity check for disk part of the combined cache.
- [6.1.0] Rollback #14510 because it causes remote test execution to fail
- Release 6.1.0 - March 2023
- bazel-1.0.0: Depends: python but it is not installable
- Aspects with `required_providers` set do not run on attributes with `providers` set
- Resizing the terminal kills `bazel run` tests
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bazel.