-
Notifications
You must be signed in to change notification settings - Fork 216
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
MPL related errors while building tests and examples #17
Comments
I find this strange, as it compiles fine for me. My clang is a couple of days old though, so I'll update it and check again. Could you please pastebin the error you're getting?
For [0], make sure you are using the latest Boost. What I think is happening is that you also have a system Boost installed, and it is that one that gets picked up. When setting up Hana with CMake, it should look like:
Note that Boost_NO_SYSTEM_PATHS is not required, but I suggest you still do it just to make sure system paths are not searched at all. With the latest Boost, all the tests in test/ext/fusion/* should compile, but none should link. This is a bug in Clang. Also note that these tests are incredibly hungry on memory and time, so you might as well just skip them (you can just delete the files and regenerate CMake with For [1], it is a known problem that I was supposed to fix for a while. I just fixed it in 7e2bcdf; thanks for pushing me to finally do it :-). Please update your Hana and let me know if you still get errors. |
Thanks for dealing with those errors. It finally works except for the first one I mentioned. However, I had to delete some tests which took too long to compile (everything in the
The error I'm getting when building home/calin/Workplace/hana/example/tutorial/type_computations.cpp:124:15: error:
static_assert expression is not an integral constant expression
static_assert(mpl::equal<
^~~~~~~~~~~
/home/calin/Workplace/hana/example/tutorial/type_computations.cpp:124:15: note: non-constexpr
function 'operator bool' cannot be used in a constant expression
/home/calin/Workplace/boost-trunk/boost/mpl/bool.hpp:29:5: note: declared here
operator bool() const { return this->value; }
^ The error is pretty self-explanatory. The |
See below.
I know this is a pain. I'm currently working on splitting those tests into several files so they do not crash my own computer.
Hmm, this is weird since in my version of Boost, MPL
Note that I could just change the example so it compiles for you, but I'd rather understand what's happening instead of blindly fixing the error. |
I tested the following code and the result is that the first assert passes while the second one does not. #include <boost/config.hpp>
#include <boost/mpl/equal.hpp>
int main()
{
BOOST_CONSTEXPR int i = 0;
static_assert(i == 0, "");
static_assert(boost::mpl::equal<int, int>{}, "");
return 0;
} The definition of It makes sense to be defined as
No need to do that, I also want to understand why it does not work. :) |
I'm not sure, but is it possible that the SVN is not updated anymore and so it would not contain the latest changes in MPL? My Boost is a clone from the GitHub modularized version. The problem really seems to be that we are using different Boost versions. |
You are right, the SVN repository seems to not be update anymore. I'm installing the modular boost from git right now and that example which was failing should build successfully this time. Even if it is not related to the errors I previously encountered, I had another problem while building Hana and I was wondering if the way I solved it may break the build process on other systems or not. Since I am on Ubuntu, clang links by default to libstdc++. Therefore, to be able to build the tests and examples, I had to make the following changes in the CMakeLists.txt file. diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1a03c6b..716c592 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -123,6 +123,12 @@ function(boost_hana_add_executable target_name)
set_property(TARGET ${target_name}
APPEND PROPERTY INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIRS})
endif()
+
+ target_link_libraries(
+ ${target_name}
+ c++
+ c++abi
+ )
endfunction()
# boost_hana_add_test(<source file> [<target name>]) So every time I'm compiling something using the -std=c++14 flag, I also have to use the -lc++ and -lc++abi linker flags, since clang compiled code doesn't always successfully link to libstdc++ (or this library is a little bit behind with the C++14 features implementation). My question is, would making these changes break the build process on Mac OSs (I have read that on post-Mavericks Macs, the default std implementation chosen by ld is libc++)? I guess that is the OS you are using since you haven't had problems with that. If it wouldn't, I guess that this change would make possible the building of tests and examples from Hana on any Linux based distribution. |
Hmm. I'm having trouble linking to the right libc++ too on OSX. Basically, Hana tests are being linked to my system-provided libc++, but I would need them linked with my tip-of-trunk libc++ that comes with my tip-of-trunk clang. clang is passed |
I understand :). However, I am glad I managed to build Hana and I cannot wait to start using it as well as delving into its implementation details as I am also interested in meta-programming and I think your work is impressive. Thanks for dealing with those building errors. |
I'm unable to run the examples on Ubuntu 14.10 because I get the following error: error while loading shared libraries: libc++abi.so.1: cannot open shared object file: No such file or directory I'm reopenning the issue as a reminder to fix this (and also your link errors). |
I'm now able to compile and run all the examples on ubuntu 14.04, and the Travis VMs (ubuntu 12.xx) as well. I now link with libc++ when I create the example and test executables. I guess that'll have to be changed once we support other standard libraries, but for now I guess it's good enough. Closing. |
Hi!
I was trying to build the tests and the examples and I came across these errors and I cannot figure out whether it is because of my version of boost libs or something else causes them.
I am on Ubuntu 14.04 x64, with clang 3.7 and libcxx (both) trunk - updated yesterday, boost trunk as well. Therefore, the only explanation I find for these errors is that you may have an unofficial/patched version of boost headers.
Firstly, in example/tutorial/type_computations.cpp, the following piece of code does not compile:
Replacing the instantiation
>{}
with>::type::value
makes it compile.Secondly, I am getting the following errors [0] [1] when further building the tests and the examples (the output is too lengthy).
What am I missing? Thanks!
P.S.: Sorry if it is some mistake from my side, but I really want to compile them successfully.
The text was updated successfully, but these errors were encountered: