Comments (15)
Can you confirm whether the installed bazel you have is gcc or clang?
(If you got the binaries via wget from the server, they will have been built with gcc, if instead you just did a bazel run //:install
, it will be clang). Not an ideal situation, but we're looking into that).
from drake-external-examples.
I believe it was originally clang. I was able to fix my libprotobuf error by first building drake with bazel build --compiler=gcc-5 --config snopt //...
and then compiling my cmake project as usual.
However, I'm now running into segmentation faults in my external project, which are not present in the macOS build which uses clang.
from drake-external-examples.
results so far (build / run)
drake-clang & drake_cmake_installed-clang : SUCCESS / FAIL (libprotobuf)
drake-clang & drake_cmake_installed_gcc : SUCCESS / SUCCESS
drake-gcc & drake_cmake_installed_gcc : SUCCESS / SUCCESS
drake-clang & my_project-clang : SUCCESS / FAIL (libprotobuf)
drake-clang & my_project-gcc : FAIL ( won't link - can't find the drake symbols)
drake-gcc & my_project-gcc : SUCCESS / FAIL (segmentation fault - though this looks fixable)
from drake-external-examples.
to clarify drake-gcc & my_project-gcc - I can build drake examples and run them, so from your standpoint this is a SUCCESS / SUCCESS
from drake-external-examples.
The drake-clang
& my_project-clang
is probably where we should focus. Is my_project_clang
also linking to libprotobuf
by another path (non-drake, e.g. directly or transitively via another library)?
from drake-external-examples.
Not unless drake_cmake_installed-clang is somewhere. That fails in the same way as my project with the libprotobuf error. I would have expected clang / clang to work fine - and it does on macOS.
from drake-external-examples.
drake-clang
& drake_cmake_installed-clang
is actually working for me. I am using
# drake
bazel run --config snopt //:install -- /opt/drake
# drake_cmake_installed
cd build && cmake -Ddrake_DIR=/opt/drake/lib/cmake/drake -DCMAKE_CXX_COMPILER=/usr/bin/clang++-4.0 .. && make VERBOSE=1 -j5
when I build the actual project (you used /usr/bin/clang++
, which I do not have).
from drake-external-examples.
hmm.. I just tried that with clang-4.0 - and it still failed. Both for my project and for drake_cmake_installed.
That seems to point towards a problem with my particular installation.
from drake-external-examples.
@stonier are you building from the precompiled binaries?
from drake-external-examples.
For this, I was testing with bazel run install method as shown above, so I could switch it from gcc to clang as you have done.
from drake-external-examples.
I did verify that the gcc method (both bazel and precompiled) fails due to (I believe) my project also including Eigen. As soon as drake calls a function which uses Eigen, it seg faults.
I'm testing bazel-clang on a fresh ubuntu install now.
from drake-external-examples.
Are you making sure you find_package(Drake CONFIG REQUIRED)
before anything else (if your project or another down the line is doing find_package(EIGEN ...)
before Drake it will find the system Eigen which is incompatible with Drake's Eigen, but the other way around is fine.
Some notes on this in the PCL example README. I should ass some additional notes to the drake_cmake_installed
README.
from drake-external-examples.
I was able to reproduce the libprotobuf error on a fresh, completely clean ubuntu 16.04 install trying to do drake-clang and drake_cmake_installed-clang
# drake
bazel build --compiler=clang-4.0 --config snopt //...
mkdir build
bazel run --compiler=clang-4.0 --config snopt //:install -- $PWD/build
# drake_cmake_installed
mkdir build; cd build
cmake -Ddrake_DIR="$HOME/drake/build/lib/cmake/drake" -DCMAKE_CXX_COMPILER="/usr/bin/clang++-4.0" ..
make -j
~/sham/drake_cmake_installed/build/src/particles$ ./uniformly_accelerated_particle_demo
[libprotobuf ERROR external/com_google_protobuf/src/google/protobuf/descriptor_database.cc:58] File already exists in database: google/protobuf/any.proto
[libprotobuf FATAL external/com_google_protobuf/src/google/protobuf/descriptor.cc:1394] CHECK failed: generated_database_->Add(encoded_file_descriptor, size):
terminate called after throwing an instance of 'google::protobuf::FatalException'
what(): CHECK failed: generated_database_->Add(encoded_file_descriptor, size):
Aborted (core dumped)
maybe note-worth - the CXX flag only specifies the CXX complier, while the C complier is still GNU
The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is Clang 4.0.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/clang++-4.0
-- Check for working CXX compiler: /usr/bin/clang++-4.0 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Could NOT find GTest (missing: GTEST_LIBRARY GTEST_INCLUDE_DIR GTEST_MAIN_LIBRARY)
-- Could NOT find GTest (missing: GTEST_LIBRARY GTEST_INCLUDE_DIR GTEST_MAIN_LIBRARY)
-- Configuring done
-- Generating done
from drake-external-examples.
I did, however, fix the GNU gcc error. It turns out that one of our externals had packaged the eigen includes as well - by removing that, everything works.
from drake-external-examples.
Testing the above instructions, but for Bionic with clang-6.0
(specified for both CC and CXX), and using environment variables since we've stopped using CROSSTOOL
in Drake.
$ bash-isolate # See https://bit.ly/2FtluQs
$ export CC=clang-6.0 CXX=clang++-6.0 SNOPT_PATH=git
$ cd drake
$ git rev-parse --short HEAD
a57d3198a
$ drake_dir=${PWD}/build/py2
$ bazel run --config=snopt //:install -- ${drake_dir}
$ cd .../drake-external-examples/drake_cmake_installed
$ git rev-parse --short HEAD
43ff258
$ mkdir build && cd build
$ cmake -DCMAKE_PREFIX_PATH=${drake_dir} ..
$ make -j
$ ctest -V -R
# No failures
Since this succeeds, I'm closing the issue for now.
However, @dmsj, if you still have this as an active pain point, I can re-open the issue.
(Also, are you still on Xenail, or have y'all migrated to Bionic?)
from drake-external-examples.
Related Issues (20)
- [Question] Ubuntu 16.04 HOT 1
- make is not working: clp HOT 1
- [drake_bazel_installed] Compile Error when using a stable Drake installed from APT (focal:0.35.0-1) HOT 2
- [drake_bazel_installed] C++ Examples for Bazel when Using with Installed Package HOT 2
- [drake-bazel-installed] Python examples all fail to import pydrake HOT 3
- [drake_cmake_installed] CMake error when building in release mode HOT 4
- Upgrade CI testing to use Ubuntu 20 (focal)
- Update supported MacOS from Catalina to Big Sur
- Possibly Revert #229 Back to Official HOT 1
- [drake_cmake_installed] CMake error when make in release mode HOT 3
- The drake_cmake_installed example Particle does not plot in visualizer HOT 2
- drake_bazel_installed doesn't work well HOT 1
- Re-license to MIT-0 HOT 1
- [drake_cmake_installed] Python version misdetection HOT 2
- Tutorials for getting up and running. HOT 1
- Example for PyPI workflow
- drake_bazel_external warnings about reproducibility HOT 1
- Where are the executables using drake_cmake_external?? HOT 2
- Replace macOS x86 CI with arm64, or decomission
- Build is not successful using drake_cmake_external on macos with m2 HOT 4
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 drake-external-examples.