Closed grantrostig closed 5 years ago
Just verified that g++ can find atomic and that it can't find junk.
This shows that a missing library -ljunk gives an error, but no error on -latomic
g++ -c -pipe -g -std=gnu++1z -Wall -W -fPIC -DQT_QML_DEBUG -I../atomic_test -I. -I../../Qt_online/5.12.0/gcc_64/mkspecs/linux-g++ -o main.o ../atomic_test/main.cpp
g++ -o atomic_test main.o -latomic -ljunk
/usr/bin/ld: cannot find -ljunk
collect2: error: ld returned 1 exit status
make: *** [Makefile:230: atomic_test] Error 1
21:53:33: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project atomic_test (kit: Desktop Qt 5.12.0 GCC 64bit)
When executing step "Make"
Fix is to install libatomic and THEN clear out build directory and try again. Doesn't cmake do that? Guess not. I had just re-ran the cmake and it just kept failing. Can cmake properly restart without me having to know that I must remove the build dir contents manually? Also, documentation should reflect need for libatomic to be installed, since it is not by default when gcc-g++ is installed.
@grantrostig it's not 100% clear if you had to manually install libatomic or not, but if you did it seems like that is a real missing dependency (most likely for hpx-devel
, even though I know in this case you're building from source). libatomic has cause us grief in the past as some compilers (and versions) seem to automatically link against it and some don't.
Edit: although since this can be compiler specific I'm not sure it should be a compulsory dependency... Hmm. It does need to be mentioned somewhere though.
And yes, CMake is a bit like that. In this case CMake is caching (or we have set CMake to cache) the check for libatomic, and the solution is indeed to wipe the build directory and start over. Caching is there to speed up reconfiguration of the build, but in this case it's working against you. In general it's a good idea to start over if your configure step fails.
@msimberg This issues is on the side from Fedora. There should be a dependency of libatomic to the gcc-c++ package. Currently, one need to install the package to compile hpx. For the hpx 1.2.1 fedora release, the package will be installed by hpx-devel
as a workaround.
Fix is to install libatomic and THEN clear out build directory and try again. Doesn't cmake do that? Guess not. I had just re-ran the cmake and it just kept failing. Can cmake properly restart without me having to know that I must remove the build dir contents manually? Also, documentation should reflect need for libatomic to be installed, since it is not by default when gcc-g++ is installed.
1) Doesn't cmake do that?
No cmake keeps the CMakeCache.txt in the build directory and the user needs to delete it.
2) Also, documentation should reflect need for libatomic to be installed, since it is not by default when gcc-g++ is installed.
Unfortunate, this is very specific to Fedora and we decided to keep our documentation independent on any OS. We just have a generic tutorial how to compile hpx on Linux. We understand that this is annoying to have all these issues on Fedora, but we can not document all issues specific to one OS in our documentation.
@msimberg This issues is on the side from Fedora. There should be a dependency of libatomic to the gcc-c++ package. Currently, one need to install the package to compile hpx. For the hpx 1.2.1 fedora release, the package will be installed by
hpx-devel
as a workaround.
@diehlpk , I disagree, we cannot blame the extremely high quality fedora distribution, it is not their issue, nor do I think they are likely to change who gcc is packaged.
However @diehlpk , your solution appears to be the correct one, that is to add it to hpx-devel. Do we need another issue for that, or how will that be tracked?
cc:@msimberg
No cmake keeps the CMakeCache.txt in the build directory and the user needs to delete it.
@diehlpk , I don't think your statement above is entirely accurate, I'm almost certain that the check could be written to re-verify the existence of a library at each run of the build. Furthermore, I suggest that it be changed to do the check and other checks as needed for each time it is run, or that it be documented (applies to all, not just for fedora). Do I need to create another issue for that?
cc: @msimberg
Unfortunate, this is very specific to Fedora and we decided to keep our documentation independent on any OS. We just have a generic tutorial how to compile hpx on Linux.
@diehlpk , Firstly there is a page that is distribution specific that shows the "dnf" and "apt-get" commands etc for the packages install. So some parts of the documentation are specific. I can't find the other place it mentions fedora and suse and others, but here is one also: http://stellar-group.org/libraries/hpx/downloads/
However, we are talking about the source build, and there, I don't think it would hurt to mention the gcc-g++ std::atomic requirement, since it does also mention the boost.atomic requirement here: https://stellar-group.github.io/hpx/docs/sphinx/latest/html/manual/building_hpx.html#prerequisites
You need to build the following Boost libraries for HPX: Boost.Atomic, Boost.Filesystem, Boost.ProgramOptions, Boost.Regex, and Boost.System.
In summary, distribution specific packages are mentioned for the use of their package managers, as show above and they should be correct. I will write another issue.
Mention of std::atomic and it's associated libatomic.so applies to all linux distributions, even as some distributions include it with gcc and others don't.
cc: @msimberg
@grantrostig it's not 100% clear if you had to manually install libatomic or not, but if you did it seems like that is a real missing dependency (most likely for
hpx-devel
, even though I know in this case you're building from source). libatomic has cause us grief in the past as some compilers (and versions) seem to automatically link against it and some don't.
@msimberg , please note that I'm certain that I had to install libatomic on fedora to get the source build of cmake to work, even though gcc-g++ was already installed. No big deal, but I'm trying to be complete.
In this case CMake is caching (or we have set CMake to cache) the check for libatomic, and the solution is indeed to wipe the build directory and start over.
We could be clearing HPX_HAVE_LIBATOMIC
before the check as long as HPX_WITH_CXX11_ATOMIC
is false.
Expected Behavior
building hpx from source
Actual Behavior
[grostig@fx8150-grostig-com build]$ cmake -DCMAKE_INSTALL_PREFIX=/home/grostig/libs .. -- CMake version: 3.12.1 -- HPX version: 1.3.0 -- No vectorization library configured -- Native TLS is enabled. -- Nice threadlevel is disabled. -- Stack traces are enabled. -- Compiling with the native toolset -- C++ mode enforced: C++17 -- Performing Test HPX_WITH_CXX11_ALIAS_TEMPLATES - pre-set to TRUE -- Performing Test HPX_WITH_CXX11_ALIGNAS - pre-set to TRUE -- Performing Test HPX_WITH_CXX11_AUTO - pre-set to TRUE -- Performing Test HPX_WITH_CXX11_CONSTEXPR - pre-set to TRUE -- Performing Test HPX_WITH_CXX11_DECLTYPE - pre-set to TRUE -- Performing Test HPX_WITH_CXX11_SFINAE_EXPRESSION - pre-set to TRUE -- Performing Test HPX_WITH_CXX11_DEFAULTED_FUNCTIONS - pre-set to TRUE -- Performing Test HPX_WITH_CXX11_DELETED_FUNCTIONS - pre-set to TRUE -- Performing Test HPX_WITH_CXX11_EXPLICIT_CONVERSION_OPERATORS - pre-set to TRUE -- Performing Test HPX_WITH_CXX11_EXPLICIT_VARIADIC_TEMPLATES - pre-set to TRUE -- Performing Test HPX_WITH_CXX11_EXTENDED_FRIEND_DECLARATIONS - pre-set to TRUE -- Performing Test HPX_WITH_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS - pre-set to TRUE -- Performing Test HPX_WITH_CXX11_INLINE_NAMESPACES - pre-set to TRUE -- Performing Test HPX_WITH_CXX11_LAMBDAS - pre-set to TRUE -- Performing Test HPX_WITH_CXX11_NOEXCEPT - pre-set to TRUE -- Performing Test HPX_WITH_CXX11_NULLPTR - pre-set to TRUE -- Performing Test HPX_WITH_CXX11_NSDMI - pre-set to TRUE -- Performing Test HPX_WITH_CXX11_RANGE_BASED_FOR - pre-set to TRUE -- Performing Test HPX_WITH_CXX11_RVALUE_REFERENCES - pre-set to TRUE -- Performing Test HPX_WITH_CXX11_SCOPED_ENUMS - pre-set to TRUE -- Performing Test HPX_WITH_CXX11_STATIC_ASSERT - pre-set to TRUE -- Performing Test HPX_WITH_CXX11_VARIADIC_MACROS - pre-set to TRUE -- Performing Test HPX_WITH_CXX11_VARIADIC_TEMPLATES - pre-set to TRUE -- Performing Test HPX_WITH_CXX11_OVERRIDE - pre-set to TRUE -- Performing Test HPX_WITH_CXX11_ARRAY - pre-set to TRUE -- Performing Test HPX_WITH_CXX11_ATOMIC - Failed -- Test failed, detailed output:
CMake Error at cmake/HPX_Message.cmake:47 (message): HPX needs support for C++11 std::atomic Call Stack (most recent call first): cmake/HPX_AddConfigTest.cmake:137 (hpx_error) cmake/HPX_AddConfigTest.cmake:406 (add_hpx_config_test) cmake/HPX_PerformCxxFeatureTests.cmake:92 (hpx_check_for_cxx11_std_atomic) CMakeLists.txt:1174 (hpx_perform_cxx_feature_tests)
-- Configuring incomplete, errors occurred! See also "/home/grostig/src/hpx/hpx_project_source/hpx/build/CMakeFiles/CMakeOutput.log". See also "/home/grostig/src/hpx/hpx_project_source/hpx/build/CMakeFiles/CMakeError.log".
+++++++++++++++++++++++++++++++ This is the cmake error log:
Determining if the function __atomic_fetch_add_4 exists in the atomic failed with the following output: Change Dir: /home/grostig/src/hpx/hpx_project_source/hpx/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/gmake" "cmTC_b717f/fast" /usr/bin/gmake -f CMakeFiles/cmTC_b717f.dir/build.make CMakeFiles/cmTC_b717f.dir/build gmake[1]: Entering directory '/home/grostig/src/hpx/hpx_project_source/hpx/build/CMakeFiles/CMakeTmp' Building C object CMakeFiles/cmTC_b717f.dir/CheckFunctionExists.c.o /usr/lib64/ccache/cc -DCHECK_FUNCTION_EXISTS=__atomic_fetch_add_4 -o CMakeFiles/cmTC_b717f.dir/CheckFunctionExists.c.o -c /usr/share/cmake/Modules/CheckFunctionExists.c