Comments (13)
Do you have a empty.c in tools/cpp ?
from bazel.
Yes. This was run from head with only running compile.sh and modifying examples/cpp/BUILD.
$ ls tools/cpp
BUILD CROSSTOOL empty.cc
from bazel.
The rules aren't quite compatible with the Mac tools - that's why we added
the empty.cc in a few places. I have an idea of how to change the rules to
make this go away, but the downside is that it would be technically
incompatible with our internal rules. Alternatively, we could add wrappers
around the Mac tools to make them handle that corner case in a way that's
compatible with the rules.
On Wed, Mar 25, 2015 at 8:20 PM Trevor Gray [email protected]
wrote:
Yes. This was run from head with only modifying examples/cpp/BUILD.
$ ls tools/cpp
BUILD CROSSTOOL empty.cc—
Reply to this email directly or view it on GitHub
#61 (comment).
from bazel.
To clarify - the Mac tools don't allow static libraries (and maybe this
also applies to dynamic libraries) which are empty - i.e. which don't
contain any object files, while the Linux tools typically allow this. The
rules, however, have implicit .a and .so outputs which the rules
'guarantee' to always be created, even for empty libraries (the rules can't
determine during the loading phase if there are going to be .cc source
files or not).
On Wed, Mar 25, 2015 at 8:30 PM Ulf Adams [email protected] wrote:
The rules aren't quite compatible with the Mac tools - that's why we added
the empty.cc in a few places. I have an idea of how to change the rules to
make this go away, but the downside is that it would be technically
incompatible with our internal rules. Alternatively, we could add wrappers
around the Mac tools to make them handle that corner case in a way that's
compatible with the rules.On Wed, Mar 25, 2015 at 8:20 PM Trevor Gray [email protected]
wrote:Yes. This was run from head with only modifying examples/cpp/BUILD.
$ ls tools/cpp
BUILD CROSSTOOL empty.cc—
Reply to this email directly or view it on GitHub
#61 (comment).
from bazel.
I just introduced a wrapper around gcc for another bug (the library path one we discussed on monday), let just do another wrapper around otool for that.
from bazel.
sorry I means around libtool
from bazel.
Ulf, I let you handle this one when you are back.
from bazel.
Is
# libtool_wrapper.sh
set -eu
LIBTOOL="/usr/bin/libtool"
GCC="/usr/bin/gcc"
TOOLS_DIR="$PWD/tools/cpp"
# Ensure that we have an 'empty' .o
if [ ! -e $TOOLS_DIR/empty.o ]; then
${GCC} -o $TOOLS_DIR/empty.o -c $TOOLS_DIR/empty.cc
fi
# Call normal libtool with the addition empty .o
${LIBTOOL} "$@" $TOOLS_DIR/empty.o
the worse thing ever to fix this or only the second-worst thing?
from bazel.
Installed bazel on May 24, cloned from github.
Mac OS X Yosemite, this issue is still present, even though there is an empty.cc on the bazel-project/tools/cpp/ dir. Any idea why?
from bazel.
I've encountered the same issue while trying to build Boost on OS X with Xcode 6.4. In that case, adding an empty.cc (with linkstatic = 1 to silence warnings) does not help.
from bazel.
I'm back now, and this seems like it's critical to fix. I've made some progress on a fix, which is going to be to remove the static / dynamic libraries if there aren't any object files. There's a chance that this breaks users who rely on the implicit output files <name>.a or <name>.so being available, but I don't expect that to be widely used.
For those using the workaround, the empty.cc file needs to be actually referenced in cc_library.srcs (and you'll still get warnings from the linker).
from bazel.
I will often wrap a genrule() built library (built, say, with autoconf) with a cc_library(); among other benefits, this allows me to specify the correct include paths for the library's headers and have them handled transitive-magically. If implicit output files are removed, will this trick still work?
from bazel.
Yes, that's not a problem. I only know a single use case for the .a or .so implicit outputs, and there's a workaround for that. I also had a quick look through our internal code base, and there are few, if any, places that rely on the 'old' behavior.
from bazel.
Related Issues (20)
- [7.3.0] Ensure that downloads are cancelled on repo rule restart HOT 1
- [7.2.1] Ensure that downloads are cancelled on repo rule restart HOT 1
- [bazel.build] Problem with /external/overview HOT 1
- Help building Bazel 7.2.0 under Alpine - build succeeds but need help with ijar HOT 4
- Allow platform-specific startup options
- Broken logo for company in "users" page
- Refactor `default_compile_flags` defaults for windows cc toolchain
- [7.2.1] "unlinkat ([path]) (Directory not empty)" errors with experimental_worker_for_repo_fetching HOT 1
- [7.2.1] NPE in `CompletionFunction` HOT 9
- [7.3.0] NPE in `CompletionFunction` HOT 3
- [Mirror] rules_java HOT 2
- [7.2.1] Enforce and await cleanup in `StarlarkBaseExternalContext` HOT 3
- [7.3.0] Enforce and await cleanup in `StarlarkBaseExternalContext` HOT 6
- Should @local_config_platform//:host be marked no-remote-exec (or maybe even no-remote)?
- [7.3.0] Allow discard previous overrides for --override_repository and --override_module HOT 1
- [7.3.0] Do not fail a sandboxed spawn for missing execution statistics HOT 1
- [7.2.1] Do not fail a sandboxed spawn for missing execution statistics HOT 2
- [7.2.1] Allow discard previous overrides for --override_repository and --override_module HOT 2
- Bazel 7.2.0 fails to build due to Java mismatch issues HOT 6
- [7.3.0] .blazerc mentioned (wrong filename) on import error at bazel startup HOT 1
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.