copperspice / diamond

Cross platform programmers editor, uses the CopperSpice libraries
https://www.copperspice.com/
GNU General Public License v2.0
20 stars 4 forks source link

'clang-cl' issue #22

Open gvanem opened 2 years ago

gvanem commented 2 years ago

I've built the CopperSpice libraries using MSVC-2019 and used them to build KitchenSink and Diamond just fine. And both programs works fine.

But using clang-cl (the supposedly 100% compatible MSVC compiler driver) to compile Diamond, I'm getting 17 unresolved link errors for these symbols:

__declspec(dllimport) public: __thiscall Cs::QRegularExpression<class QString8>::QRegularExpression<class QString8>(class Cs::QRegularExpression<class QString8> &&)
__declspec(dllimport) public: __thiscall Cs::QRegularExpression<class QString8>::QRegularExpression<class QString8>(class Cs::QRegularExpression<class QString8> const &)
__declspec(dllimport) public: __thiscall Cs::QRegularExpression<class QString8>::QRegularExpression<class QString8>(class QString8 const &,class QFlags<enum QPatternOption>)
__declspec(dllimport) public: __thiscall Cs::QRegularExpression<class QString8>::QRegularExpression<class QString8>(void)
__declspec(dllimport) public: __thiscall Cs::QRegularExpression<class QString8>::~QRegularExpression<class QString8>(void)
__declspec(dllimport) public: __thiscall Cs::QRegularExpressionMatch<class QString8>::QRegularExpressionMatch<class QString8>(void)
__declspec(dllimport) public: __thiscall Cs::QRegularExpressionMatch<class QString8>::~QRegularExpressionMatch<class QString8>(void)
__declspec(dllimport) public: bool __thiscall Cs::QRegularExpressionMatch<class QString8>::hasMatch(void)const
__declspec(dllimport) public: class Cs::QRegularExpression<class QString8> & __thiscall Cs::QRegularExpression<class QString8>::operator=(class Cs::QRegularExpression<class QString8> &&)
__declspec(dllimport) public: class Cs::QRegularExpression<class QString8> & __thiscall Cs::QRegularExpression<class QString8>::operator=(class Cs::QRegularExpression<class QString8> const &)
__declspec(dllimport) public: class Cs::QRegularExpressionMatch<class QString8> & __thiscall Cs::QRegularExpressionMatch<class QString8>::operator=(class Cs::QRegularExpressionMatch<class QString8> &&)
__declspec(dllimport) public: class Cs::QRegularExpressionMatch<class QString8> __thiscall Cs::QRegularExpression<class QString8>::match(class QString8 const &)const
__declspec(dllimport) public: class Cs::QRegularExpressionMatch<class QString8> __thiscall Cs::QRegularExpression<class QString8>::match(class QString8 const &,class QString8::const_iterator,enum QMatchType,class QFlags<enum QMatchOption>)const
__declspec(dllimport) public: class QString8::const_iterator __thiscall Cs::QRegularExpressionMatch<class QString8>::capturedEnd(int)const
__declspec(dllimport) public: class QString8::const_iterator __thiscall Cs::QRegularExpressionMatch<class QString8>::capturedStart(int)const
__declspec(dllimport) public: int __thiscall Cs::QRegularExpressionMatch<class QString8>::capturedLength(int)const
__declspec(dllimport) public: void __thiscall Cs::QRegularExpression<class QString8>::setPatternOptions(class QFlags<enum QPatternOption>)

in search.obj and syntax.obj.

I suspect there's is an issue with the cl option -Zc:wchar_t that clang-cl does not like. Or how some UTF-8 issue (?). Any pointers on this?

bgeller commented 2 years ago

As you mentioned building CopperSpice and any C++ application which links with CS using MSVC-2019 will work correctly.

Just so you know the issue you run into is not related to strings or the UTF-8 encoding. The problem is that the clang-cl compiler is somewhere between clang and MSVC. So it is not a real clang compiler, which we do support on other platforms. Windows is just a bit unusual.

This is not a simple item to solve since compiler specific directives would need to be added and existing ones would need to be adjusted. If this is something you are interested in working on please let us know and we can give you more information.

Barbara

gvanem commented 2 years ago

This is not a simple item to solve since compiler specific directives would need to be added and ...

I have no problem mixing .dll/.lib files between MSVC and clang-cl in plain C. So I'm interested in which compiler specific directives that needs tweaking, yes.

bgeller commented 2 years ago

This is not about DLL files or the fact that CopperSpice was written in C++. We support multiple compilers and there are differences between (1) msvc and (2) clang. Right now our libraries assume you are using one or the other. The clang-cl compiler is mixture of both and would need to be treated as a third compiler.

If you do a search for Q_CC_MSVC and Q_CC_CLANG you will find about 40 #ifdefs. Every one of these needs to be examined and changed in some way. You can see these defines in the qglobal.h file.

The other item is the platform specific code located in /src/plugins/platforms/windows. This code has not been compiled with clang or clang-cl. It may be perfectly fine or there many be changes which are required.

We are happy to help you investigate and answer questions as you go along. It would be nice to add these changes to CopperSpice and your work is appreciated.

Barbara