Closed lassemoldrup closed 1 year ago
Duplicate of #317 .
@lassemoldrup , can you check whether branch bug/317
(#404) addresses this issue?
@SSoelvsten That seems to have fixed the error, but there is now a new one:
[ 56%] Building CXX object src/adiar/CMakeFiles/adiar.dir/bdd/apply.cpp.o
In file included from /Users/lasse/Code/adiar/src/adiar/bdd/apply.cpp:9:
/Users/lasse/Code/adiar/src/adiar/../adiar/internal/levelized_priority_queue.h:43:20: error: constexpr function never produces a constant expression [-Winvalid-constexpr]
constexpr size_t no_lookahead_bound(const size_t degree = 1)
^
/Users/lasse/Code/adiar/src/adiar/../adiar/internal/levelized_priority_queue.h:45:16: note: non-constexpr function 'pow<int, unsigned long>' cannot be used in a constant
expression
return 8 * std::pow(2, degree);
^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/math.h:995:1: note: declared here
pow(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
^
Luckily a power of two is just the same as a left-shift, so std::pow
can be replaced with (1 << degree)
. I assume there is another error that pops up now, @lassemoldrup ?
It compiles now 🎉
However, running make examples/queens
gives a lot of linker warnings (only warnings) of the form
ld: warning: direct access in function 'tpie::priority_queue<adiar::prod_tuple_1, adiar::tuple_fst_lt, tpie::pq_overflow_heap<adiar::prod_tuple_1, adiar::tuple_fst_lt> >::init(unsigned long, unsigned long long)' from file '../src/adiar/libadiar.a(apply.cpp.o)' to global weak symbol 'typeinfo for tpie::exception' from file 'CMakeFiles/queens.dir/queens.cpp.o' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
Might also be related to clang?
That looks quite odd. Googling around says one should make sure the visibility is the same between the project, its subprojects and all their dependencies. Both TPIE and Adiar has in their respective CMakeLists.txt set the CXX_VISIBILITY_PRESET
to hidden
. My best guess would be, that this has something to do with a difference in Boost and how it was compiled?
I am using the Homebrew version of boost (v. 1.79
), if that helps: https://formulae.brew.sh/formula/boost#default
Ubuntu ships with 1.71 but I cannot remember what version is on my Fedora machine. Can you try to manually change both the settings for Adiar and TPIE by setting their CXX_VISIBILITY_PRESET
to default
instead?
Changing the CXX_VISIBILITY_PRESET
of just Adiar fixes the warning. I also noticed that one of the warnings generated by CMake is possibly related:
CMake Warning (dev) at external/tpie/tpie/CMakeLists.txt:224 (add_library):
Policy CMP0063 is not set: Honor visibility properties for all target
types. Run "cmake --help-policy CMP0063" for policy details. Use the
cmake_policy command to set the policy and suppress this warning.
Target "tpie" of type "STATIC_LIBRARY" has the following visibility
properties set for CXX:
CXX_VISIBILITY_PRESET
For compatibility CMake is not honoring them for this target.
This warning is for project developers. Use -Wno-dev to suppress it.
That seems odd - I need to read up on what is going on here. But, thanks for debugging with me. I might ask a few more questions another day.
No problem, feel free.
I created a pull request for TPIE which fixes that very CMake warning (see the pull request above that mentions this issue). Whether that truly fixes this problem I cannot say. What happens if you do the following?
cd external/tpie
git remote set-url origin https://github.com/SSoelvsten/tpie.git
git fetch
git checkout cmake/cleanup
cd ../../
make clean
make examples/queens
If not, then I guess I have to set CXX_VISIBILITY_PRESET
for Adiar to default
.
@SSoelvsten Using your TPIE branch sadly doesn't fix the CMake warning or the linker errors.
So #408 is a fix, @lassemoldrup ?
Yes, that fixes the linker warnings (but not the CMake warning).
What version of CMake are you using? The change for TPIE fixed the CMake warning on my version 3.22.2, as far as I could tell.
I am using version 3.24.1.
Describe the bug Simply running
make
on my Mac (macOS version 12.4) fails to compile giving the following error:cmake --version
:cmake version 3.24.1
clang --version
:Apple clang version 11.0.3 (clang-1103.0.32.59)
To Reproduce N/A
Additional context The project has previously compiled, and I don't think I have done anything except update the library.