lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi] [PATCH] Weird fix for clang-7 build


From: Vadim Zeitlin
Subject: [lmi] [PATCH] Weird fix for clang-7 build
Date: Wed, 19 Jun 2019 01:50:03 +0200

 Hello,

 While rebuilding various patches with clang to check if a different
compiler doesn't find something that we didn't notice with gcc, I ran into
the following linking errors:

/usr/bin/ld: ./.libs/libskeleton.so: undefined reference to 
`MultiDimTable<std::pair<double, double>, TierTableAdapter, 
FakeConversion>::DoSetValueAny(std::vector<std::any, std::allocator<std::any> > 
const&, std::any const&)'
/usr/bin/ld: ./.libs/libskeleton.so: undefined reference to 
`MultiDimTable<std::pair<double, double>, TierTableAdapter, 
FakeConversion>::ValueToString[abi:cxx11](std::any const&) const'
/usr/bin/ld: ./.libs/libskeleton.so: undefined reference to 
`MultiDimTable<std::pair<double, double>, TierTableAdapter, 
FakeConversion>::StringToValue(std::__cxx11::basic_string<char, 
std::char_traits<char>, std::allocator<char> > const&) const'
/usr/bin/ld: ./.libs/libskeleton.so: undefined reference to 
`MultiDimTable<std::pair<double, double>, TierTableAdapter, 
FakeConversion>::DoGetValueAny(std::vector<std::any, std::allocator<std::any> > 
const&) const'
clang: error: linker command failed with exit code 1 (use -v to see invocation)

These errors happen when linking anything depending on libskeleton.so,
including lmi_wx and wx_test.

 A check with nm shows that all of these undefined symbols are in
tier_view.o, even though tier_view.cpp doesn't contain any references to
MultiDimTable. It does however include multidimgrid_tools.hpp, which in
turn includes multidimgrid_safe.hpp and, apparently, this is enough to
somehow pull in the symbols above and so we also need to include
multidimgrid_safe.tpp (notice the different extension) to define them.

 Hence the following patch is sufficient to resolve the problem:
---------------------------------- >8 --------------------------------------
diff --git a/tier_view.cpp b/tier_view.cpp
index 6d86f9942..1f3e9fdc3 100644
--- a/tier_view.cpp
+++ b/tier_view.cpp
@@ -24,6 +24,7 @@
 #include "tier_view.hpp"

 #include "multidimgrid_any.hpp"
+#include "multidimgrid_safe.tpp"
 #include "multidimgrid_tools.hpp"
 #include "safely_dereference_as.hpp"
 #include "stratified_charges.hpp"
---------------------------------- >8 --------------------------------------

 However several things are still unclear to me:

- Where/how exactly are these symbols referenced?
- Why does the problem only happen with clang and not gcc?
- Why has it only started happening recently, when there hasn't been any
  changes involving multidimgrid_safe.tpp since many years. Perhaps it's
  due to clang version change, I could try building lmi with older clang to
  see if the problem happens with it too.

 I didn't try to investigate it further because the patch above clearly
doesn't result in any problems with gcc and makes tier_view.cpp consistent
with database_view.cpp, which includes multidimgrid_safe.tpp since always.
Somewhat amazingly, removing this header inclusion from database_view.cpp
does _not_ result in any link problems, neither with clang nor gcc. But I
don't really propose doing it needlessly.

 What I'd like to know is whether you can just apply the trivial patch
above so that lmi builds with clang out of the box or if you'd like me to
spend more time on the questions above to fully understand what's going on
here?

 Thanks in advance,
VZ

Attachment: pgpP6sbO9WF5q.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]