Opened 3 years ago
Closed 3 years ago
#657 closed defect (fixed)
Cannot compile LEMON with MSVC and clang
Reported by: | Máté Lugosi | Owned by: | Alpar Juttner |
---|---|---|---|
Priority: | major | Milestone: | LEMON 1.4 release |
Component: | core | Version: | hg main |
Keywords: | Cc: | ||
Revision id: |
Description
Hi! I've been successfully using LEMON in my project in a linux environment using gcc compiler. However when building for windows and macos I've run into the following problems:
- MSVC (Visual C++ 2019):
2>main.obj : error LNK2019: unresolved external symbol "public: __cdecl lemon::bits::WinLock::WinLock(void)" (??0WinLock@bits@lemon@@QEAA@XZ) referenced in function "public: __cdecl lemon::bits::Lock::Lock(void)" (??0Lock@bits@lemon@@QEAA@XZ) 2>main.obj : error LNK2019: unresolved external symbol "public: __cdecl lemon::bits::WinLock::~WinLock(void)" (??1WinLock@bits@lemon@@QEAA@XZ) referenced in function "public: __cdecl lemon::bits::Lock::~Lock(void)" (??1Lock@bits@lemon@@QEAA@XZ) 2>main.obj : error LNK2019: unresolved external symbol "public: void __cdecl lemon::bits::WinLock::lock(void)" (?lock@WinLock@bits@lemon@@QEAAXXZ) referenced in function "protected: void __cdecl lemon::AlterationNotifier<class lemon::DigraphExtender<class lemon::ListDigraphBase>,class lemon::ListDigraphBase::Arc>::attach(class lemon::AlterationNotifier<class lemon::DigraphExtender<class lemon::ListDigraphBase>,class lemon::ListDigraphBase::Arc>::ObserverBase &)" (?attach@?$AlterationNotifier@V?$DigraphExtender@VListDigraphBase@lemon@@@lemon@@VArc@ListDigraphBase@2@@lemon@@IEAAXAEAVObserverBase@12@@Z) 2>main.obj : error LNK2019: unresolved external symbol "public: void __cdecl lemon::bits::WinLock::unlock(void)" (?unlock@WinLock@bits@lemon@@QEAAXXZ) referenced in function "protected: void __cdecl lemon::AlterationNotifier<class lemon::DigraphExtender<class lemon::ListDigraphBase>,class lemon::ListDigraphBase::Arc>::attach(class lemon::AlterationNotifier<class lemon::DigraphExtender<class lemon::ListDigraphBase>,class lemon::ListDigraphBase::Arc>::ObserverBase &)" (?attach@?$AlterationNotifier@V?$DigraphExtender@VListDigraphBase@lemon@@@lemon@@VArc@ListDigraphBase@2@@lemon@@IEAAXAEAVObserverBase@12@@Z) 2>main.obj : error LNK2001: unresolved external symbol "struct lemon::Invalid const lemon::INVALID" (?INVALID@lemon@@3UInvalid@1@B) 2>D:\Git\mbt-repository\build\Debug\mbt-fw-release.exe : fatal error LNK1120: 5 unresolved externals
It seems there are some linking issues with LEMON however I was unable to fix the problem.
- Clang 9.0.1
[build] In file included from /home/oll48/Git/mbt-repository/src/main.cpp:3: [build] In file included from /home/oll48/Git/mbt-repository/util/Controller.h:30: [build] In file included from /home/oll48/Git/mbt-repository/lib/EFSMTransformer.h:13: [build] In file included from /home/oll48/Git/mbt-repository/model/FSM.h:20: [build] In file included from /home/oll48/Git/mbt-repository/dependencies/lemon/euler.h:24: [build] In file included from /home/oll48/Git/mbt-repository/dependencies/lemon/connectivity.h:22: [build] In file included from /home/oll48/Git/mbt-repository/dependencies/lemon/dfs.h:31: [build] /home/oll48/Git/mbt-repository/dependencies/lemon/path.h:231:24: error: no viable conversion from 'typename PredMapPath<FilterArcs<ListDigraph, ArcMap<bool> >, NodeMap<Arc> >::RevArcIt' to 'std::vector<lemon::ListDigraphBase::Arc, std::allocator<lemon::ListDigraphBase::Arc> >::value_type' (aka 'lemon::ListDigraphBase::Arc') [build] head.push_back(it); [build] ^~ [build] /home/oll48/Git/mbt-repository/dependencies/lemon/path.h:1017:12: note: in instantiation of function template specialization 'lemon::Path<lemon::FilterArcs<lemon::ListDigraph, lemon::DigraphExtender<lemon::ListDigraphBase>::ArcMap<bool> > >::buildRev<lemon::PredMapPath<lemon::FilterArcs<lemon::ListDigraph, lemon::DigraphExtender<lemon::ListDigraphBase>::ArcMap<bool> >, lemon::SubDigraphBase<lemon::ListDigraph, lemon::ConstMap<lemon::ListDigraphBase::Node, lemon::Const<bool, true> >, lemon::DigraphExtender<lemon::ListDigraphBase>::ArcMap<bool>, false>::NodeMap<lemon::ListDigraphBase::Arc> > >' requested here [build] to.buildRev(from); [build] ^ [build] /home/oll48/Git/mbt-repository/dependencies/lemon/path.h:1033:45: note: in instantiation of member function 'lemon::_path_bits::PathCopySelectorBackward<lemon::PredMapPath<lemon::FilterArcs<lemon::ListDigraph, lemon::DigraphExtender<lemon::ListDigraphBase>::ArcMap<bool> >, lemon::SubDigraphBase<lemon::ListDigraph, lemon::ConstMap<lemon::ListDigraphBase::Node, lemon::Const<bool, true> >, lemon::DigraphExtender<lemon::ListDigraphBase>::ArcMap<bool>, false>::NodeMap<lemon::ListDigraphBase::Arc> >, lemon::Path<lemon::FilterArcs<lemon::ListDigraph, lemon::DigraphExtender<lemon::ListDigraphBase>::ArcMap<bool> > >, true>::copy' requested here [build] PathCopySelectorBackward<From, To>::copy(from, to); [build] ^ [build] /home/oll48/Git/mbt-repository/dependencies/lemon/path.h:1046:45: note: in instantiation of member function 'lemon::_path_bits::PathCopySelector<lemon::PredMapPath<lemon::FilterArcs<lemon::ListDigraph, lemon::DigraphExtender<lemon::ListDigraphBase>::ArcMap<bool> >, lemon::SubDigraphBase<lemon::ListDigraph, lemon::ConstMap<lemon::ListDigraphBase::Node, lemon::Const<bool, true> >, lemon::DigraphExtender<lemon::ListDigraphBase>::ArcMap<bool>, false>::NodeMap<lemon::ListDigraphBase::Arc> >, lemon::Path<lemon::FilterArcs<lemon::ListDigraph, lemon::DigraphExtender<lemon::ListDigraphBase>::ArcMap<bool> > >, true>::copy' requested here [build] _path_bits::PathCopySelector<From, To>::copy(from, to); [build] ^ [build] /home/oll48/Git/mbt-repository/dependencies/lemon/path.h:79:7: note: in instantiation of function template specialization 'lemon::pathCopy<lemon::PredMapPath<lemon::FilterArcs<lemon::ListDigraph, lemon::DigraphExtender<lemon::ListDigraphBase>::ArcMap<bool> >, lemon::SubDigraphBase<lemon::ListDigraph, lemon::ConstMap<lemon::ListDigraphBase::Node, lemon::Const<bool, true> >, lemon::DigraphExtender<lemon::ListDigraphBase>::ArcMap<bool>, false>::NodeMap<lemon::ListDigraphBase::Arc> >, lemon::Path<lemon::FilterArcs<lemon::ListDigraph, lemon::DigraphExtender<lemon::ListDigraphBase>::ArcMap<bool> > > >' requested here [build] pathCopy(cpath, *this); [build] ^ [build] /home/oll48/Git/mbt-repository/lib/AllTransitionState.h:585:62: note: in instantiation of function template specialization 'lemon::Path<lemon::FilterArcs<lemon::ListDigraph, lemon::DigraphExtender<lemon::ListDigraphBase>::ArcMap<bool> > >::Path<lemon::PredMapPath<lemon::FilterArcs<lemon::ListDigraph, lemon::DigraphExtender<lemon::ListDigraphBase>::ArcMap<bool> >, lemon::SubDigraphBase<lemon::ListDigraph, lemon::ConstMap<lemon::ListDigraphBase::Node, lemon::Const<bool, true> >, lemon::DigraphExtender<lemon::ListDigraphBase>::ArcMap<bool>, false>::NodeMap<lemon::ListDigraphBase::Arc> > >' requested here [build] Path<FilterArcs<ListDigraph, ArcFilter> > path = bfs.path(next_state); [build] ^ [build] /home/oll48/Git/mbt-repository/dependencies/lemon/list_graph.h:81:11: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'typename PredMapPath<FilterArcs<ListDigraph, ArcMap<bool> >, NodeMap<Arc> >::RevArcIt' to 'const lemon::ListDigraphBase::Arc &' for 1st argument [build] class Arc { [build] ^ [build] /home/oll48/Git/mbt-repository/dependencies/lemon/list_graph.h:81:11: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'typename PredMapPath<FilterArcs<ListDigraph, ArcMap<bool> >, NodeMap<Arc> >::RevArcIt' to 'lemon::ListDigraphBase::Arc &&' for 1st argument [build] /home/oll48/Git/mbt-repository/dependencies/lemon/list_graph.h:91:7: note: candidate constructor not viable: no known conversion from 'typename PredMapPath<FilterArcs<ListDigraph, ArcMap<bool> >, NodeMap<Arc> >::RevArcIt' to 'lemon::Invalid' for 1st argument [build] Arc (Invalid) { id = -1; } [build] ^ [build] /home/oll48/Git/mbt-repository/dependencies/lemon/bits/path_dump.h:64:7: note: candidate function [build] operator const typename Digraph::Arc() const { [build] ^ [build] /bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/stl_vector.h:1200:30: note: passing argument to parameter '__x' here [build] push_back(value_type&& __x) [build] ^ (...) ^
This is only a small snippet of the errors however they are all the same issue basically, it seems clang has problem with using arc iterators and arcs interchangebly, maybe some kind of cast would fix this?
I would be very thankful for any feedback, these issues prevent us from making our software fully platform independent.
Change History (5)
comment:1 Changed 3 years ago by
comment:2 Changed 3 years ago by
Which version did you use? In [a278d16bd2d0] various clang related issues was resolved. It compiles with clang 9. For more details see #634.
comment:3 Changed 3 years ago by
I'm using the same version as the tip on the hg lemon repo, which includes that changeset #634 as the latest commit.
Linux works fine, it's windows and macos that don't work.
I think some changes to CMake default flags, e.g. as on windows it fails with
D:\a\LEMON\LEMON\lemon/compact_graph.h(135,15): error C2220: the following warning is treated as an error [D:\a\LEMON\LEMON\build\test\digraph_test.vcxproj]
Because of the \WX
Flag.
I think macos also fails because of compiler flags, as in CMake macos is also UNIX, so uses the same flags:
/Users/runner/work/LEMON/LEMON/lemon/maps.h:2445:18: error: definition of implicit copy constructor for 'Reference' is deprecated because it has a user-declared copy assignment operator [-Werror,-Wdeprecated-copy]
If you log in to a github account you can check out the error logs here:
comment:4 Changed 3 years ago by
Thanks for the feedback. I managed to solve my problems
The clang issue was solved by switching to the latest development version of lemon from the main branch which includes #634
The windows issues were caused by bad cmake configuration on our side
You can close this issue
comment:5 Changed 3 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
I've found the same thing. Using CMake from #658 seems to work.
See here: https://github.com/MultiFlow/LEMON/runs/3989872427?check_suite_focus=true