Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » U++ community news and announcements » U++/Win32 is now using CLANG toolchain
U++/Win32 is now using CLANG toolchain [message #53107] Mon, 02 March 2020 00:38 Go to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
I have found this wonderful little project:

https://github.com/mstorsjo/llvm-mingw

which provides CLANG toolchain in windows. This is great match for several reasons:

- it is multichain, single compiler for both 32 and 64 bits, which results in nice small footprint - in fact, I have dropped "without toolchain" windows version, it is now single 140MB .7z file...
- it has good optimal TLS support, unlike gcc in win32
- it is actually able to produce .pdb compatible debug info. That means we can use the same (superior) debugger as for Microsoft C++, including "smart" parts that now display U++ types (!) There are some issues that I plan to gradually fix with workarounds, but overal this seems to work prette well.

Currently it has some downsides too, namely

- targets Windows universal CRT (instead of MSVCRT.dll), which means that for previous versions you need to ship some .dlls with your application. This might or might not be fixed in future...
- being there, it was not possible to have single static linked OpenSSL library for both clang and msvc, so I have gave up and OpenSSL is once again linked dynamically (just as SDL2, MYSQL, PGSQL are)
- there are some issues with weak references, which affected global new/delete overloading )https://github.com/mstorsjo/llvm-mingw/issues/91), but we have workaround for now
- there is also some issue with std::chrono timers, not able to reproduce, but I needed to revert 'msecs' function to older code to fix some weird issues in theide.

Overal, this is a great step forward, next release will be great!
Re: U++/Win32 is now using CLANG toolchain [message #53108 is a reply to message #53107] Mon, 02 March 2020 08:55 Go to previous messageGo to next message
Xemuth is currently offline  Xemuth
Messages: 387
Registered: August 2018
Location: France
Senior Member
Thanks for this implementation, I plan to compile several of my personal project with it.
In case of problem, do we use this post as "bug/ dysfunction reporting" ? or shall we create a new thread ?
Re: U++/Win32 is now using CLANG toolchain [message #53109 is a reply to message #53107] Mon, 02 March 2020 10:33 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
Thank you Mirek.

Best regards
Iñaki
Re: U++/Win32 is now using CLANG toolchain [message #53110 is a reply to message #53107] Mon, 02 March 2020 12:19 Go to previous messageGo to next message
Oblivion is currently offline  Oblivion
Messages: 1091
Registered: August 2007
Senior Contributor
Thank you very much, Mirek!

Best regards,
Oblivion


[Updated on: Mon, 02 March 2020 12:19]

Report message to a moderator

Re: U++/Win32 is now using CLANG toolchain [message #53119 is a reply to message #53107] Tue, 03 March 2020 20:57 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
Are you planning to add cross-compilation from Linux to Windows?
It looks like LLVM-MinGW supports that.


Regards,
Novo
Re: U++/Win32 is now using CLANG toolchain [message #53121 is a reply to message #53119] Wed, 04 March 2020 09:37 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Did not came to my mind...

Currently I am using wine to build win32 stuff in Linux. TheIDE works just fine in wine..

Anyway, if you would like to investigate this area, that would be nice...
Re: U++/Win32 is now using CLANG toolchain [message #53126 is a reply to message #53121] Wed, 04 March 2020 14:09 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
TheIDE compiled with CLANG in Windows 10. It works well Smile

Best regards
Iñaki
Re: U++/Win32 is now using CLANG toolchain [message #53127 is a reply to message #53126] Wed, 04 March 2020 14:16 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
koldo wrote on Wed, 04 March 2020 14:09
TheIDE compiled with CLANG in Windows 10. It works well Smile


Yeah, I am actually working in clang compiled ide for about 14 days now. After some initial fixes (e.g. chrono does not seem to work, so I have to revert to olde msecs implementation) everything seems to be rock stable.

Re: U++/Win32 is now using CLANG toolchain [message #53243 is a reply to message #53127] Tue, 24 March 2020 20:05 Go to previous messageGo to next message
Tom1
Messages: 1212
Registered: March 2007
Senior Contributor
Hi,

Is it possible to take a look at the bazaar/Protect with CLANG? I already noticed that removing file xed/VERSION fixes the compilation issue of Xed package that Protect uses.

However, something goes wrong when running ProtectEncrypt for an exe file created with CLANG.

-

Also, I use some external static libraries and they in turn have some Windows library dependencies that are not being satisfied:

Linking...
lld-link: error: could not open 'libLIBCMT.a': No such file or directory
lld-link: error: could not open 'libOLDNAMES.a': No such file or directory
clang-10: error: linker command failed with exit code 1 (use -v to see invocation)

There were errors. (0:00.50)


In reality these libraries are called 'libcmt.lib' and 'oldnames.lib' and are included with e.g. MSBT. Any suggestions how to proceed here?

Best regards,

Tom
Re: U++/Win32 is now using CLANG toolchain [message #53244 is a reply to message #53243] Tue, 24 March 2020 21:30 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Tom1 wrote on Tue, 24 March 2020 20:05

Linking...
lld-link: error: could not open 'libLIBCMT.a': No such file or directory
lld-link: error: could not open 'libOLDNAMES.a': No such file or directory
clang-10: error: linker command failed with exit code 1 (use -v to see invocation)

There were errors. (0:00.50)


In reality these libraries are called 'libcmt.lib' and 'oldnames.lib' and are included with e.g. MSBT. Any suggestions how to proceed here?

Best regards,

Tom


In organizer, specify them with ".lib" extension. The build will then take it "literally".

Mirek

Re: U++/Win32 is now using CLANG toolchain [message #53245 is a reply to message #53244] Wed, 25 March 2020 08:57 Go to previous messageGo to next message
Tom1
Messages: 1212
Registered: March 2007
Senior Contributor
Hi Mirek,

Adding the libs manually
when: WIN32
Libraries: ../lib/libcmt.lib ../lib/liboldnames.lib

introduces a different issue:
Linking...
lld-link: error: duplicate symbol: atexit
>>> defined at ../crt\crtexe.c:438
>>>            C:\upp-svn\bin\clang\x86_64-w64-mingw32\lib\crt2.o
>>> defined at libcmt.lib(utility.obj)

lld-link: error: duplicate symbol: __dyn_tls_init
>>> defined at d:\agent\_work\4\s\src\vctools\crt\vcstartup\src\tls\tlsdyn.cpp:87
>>>            libcmt.lib(tlsdyn.obj)
>>> defined at ../crt\tlssup.c:77
>>>            libmingw32.a(lib64_libmingw32_a-tlssup.o)

lld-link: error: duplicate symbol: __dyn_tls_init_callback
>>> defined at libcmt.lib(tlsdyn.obj)
>>> defined at ../crt\tlssup.c:103
>>>            libmingw32.a(lib64_libmingw32_a-tlssup.o)

lld-link: error: duplicate symbol: _onexit
>>> defined at d:\agent\_work\4\s\src\vctools\crt\vcstartup\src\utility\utility.cpp:256
>>>            libcmt.lib(utility.obj)
>>> defined at ../crt\ucrtbase_compat.c:86
>>>            libmsvcrt.a(lib64_libucrt_extra_a-ucrtbase_compat.o)

lld-link: error: duplicate symbol: _tls_index
>>> defined at ../crt\tlssup.c:35
>>>            libmingw32.a(lib64_libmingw32_a-tlssup.o)
>>> defined at libcmt.lib(tlssup.obj)

lld-link: error: duplicate symbol: _tls_start
>>> defined at ../crt\tlssup.c:41
>>>            libmingw32.a(lib64_libmingw32_a-tlssup.o)
>>> defined at libcmt.lib(tlssup.obj)

lld-link: error: duplicate symbol: _tls_end
>>> defined at ../crt\tlssup.c:42
>>>            libmingw32.a(lib64_libmingw32_a-tlssup.o)
>>> defined at libcmt.lib(tlssup.obj)

lld-link: error: duplicate symbol: __xl_a
>>> defined at ../crt\tlssup.c:44
>>>            libmingw32.a(lib64_libmingw32_a-tlssup.o)
>>> defined at libcmt.lib(tlssup.obj)

lld-link: error: duplicate symbol: __xl_z
>>> defined at ../crt\tlssup.c:45
>>>            libmingw32.a(lib64_libmingw32_a-tlssup.o)
>>> defined at libcmt.lib(tlssup.obj)

lld-link: error: duplicate symbol: _tls_used
>>> defined at ../crt\tlssup.c:47
>>>            libmingw32.a(lib64_libmingw32_a-tlssup.o)
>>> defined at libcmt.lib(tlssup.obj)

lld-link: error: could not open 'liblibvcruntime.a': No such file or directory
lld-link: error: could not open 'liblibucrt.a': No such file or directory
lld-link: error: could not open 'libLIBCMT.a': No such file or directory
lld-link: error: could not open 'libOLDNAMES.a': No such file or directory
clang-10: error: linker command failed with exit code 1 (use -v to see invocation)

There were errors. (0:00.50)


So adding the libraries yields duplicate symbols while adding yet more unsatisfied dependencies. Unfortunately, they still do not satisfy the requirement for the strange 'libLIBCMT.a' and 'libOLDNAMES.a'. (I also tried to copy the original files to these names, but that did not work either.)

I wonder if I should create a couple of dummy libraries with no public symbols and give them names 'libLIBCMT.a' and 'libOLDNAMES.a'...

Any suggestions to try?

Best regards,

Tom

[EDIT] Well, those dummy empty libraries with names 'libLIBCMT.a' and 'libOLDNAMES.a' did not help either.

[Updated on: Wed, 25 March 2020 09:27]

Report message to a moderator

Re: U++/Win32 is now using CLANG toolchain [message #53250 is a reply to message #53245] Wed, 25 March 2020 12:41 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Why do you need those libs in the first place?

libcmt is AFAIK old C library. No wonder there are duplicates....
Re: U++/Win32 is now using CLANG toolchain [message #53253 is a reply to message #53250] Wed, 25 March 2020 12:52 Go to previous messageGo to next message
Tom1
Messages: 1212
Registered: March 2007
Senior Contributor
Hi,

I use some special devices that are accompanied by static libraries to be used to access those devices. When I add those specific libraries (lib files) into the project, the requirement for these two (old) Windows libraries appear.

Best regards,

Tom
Re: U++/Win32 is now using CLANG toolchain [message #53255 is a reply to message #53253] Wed, 25 March 2020 13:00 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Tom1 wrote on Wed, 25 March 2020 12:52
Hi,

I use some special devices that are accompanied by static libraries to be used to access those devices. When I add those specific libraries (lib files) into the project, the requirement for these two (old) Windows libraries appear.

Best regards,

Tom


Understood. Does it work with original U++ shipped mingw? (I am asking because mingw AFAIK is using msvcrt and the clang toolchain we are using should be possible to be recompiled to use msvcrt as well, something I was considering anyway but postponed because of other issues to solve first).

Mirek
Re: U++/Win32 is now using CLANG toolchain [message #53257 is a reply to message #53255] Wed, 25 March 2020 13:24 Go to previous messageGo to next message
Tom1
Messages: 1212
Registered: March 2007
Senior Contributor
OK, I need to check that separately.

As a matter of fact I never really used MINGW version as ... well I cannot remember exactly, but it did not work for me.

Can you point out where to download the last MINGW version?

Best regards,

Tom

[EDIT] Nevermind... I found the 2019.2 MINGW on sourceforge.net...

[Updated on: Wed, 25 March 2020 13:57]

Report message to a moderator

Re: U++/Win32 is now using CLANG toolchain [message #53263 is a reply to message #53257] Wed, 25 March 2020 14:28 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
sf.net?
Re: U++/Win32 is now using CLANG toolchain [message #53268 is a reply to message #53263] Wed, 25 March 2020 15:37 Go to previous messageGo to next message
Tom1
Messages: 1212
Registered: March 2007
Senior Contributor
OK, upp-mingw-13664 tested. The same result as with CLANG:

Linking...
lld-link: error: could not open libLIBCMT.a: no such file or directory
lld-link: error: could not open libOLDNAMES.a: no such file or directory
collect2.exe: error: ld returned 1 exit status


Also, if I explicitly give the libraries, the behavior follows that of CLANG.

--

BTW: It seems that MINGW is not able to deal with GDAL/OGR source properly... and some other packages too. I guess this was one of my reasons to drop it.

Best regards,

Tom
Re: U++/Win32 is now using CLANG toolchain [message #53271 is a reply to message #53268] Wed, 25 March 2020 17:50 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Tom1 wrote on Wed, 25 March 2020 15:37
OK, upp-mingw-13664 tested. The same result as with CLANG:

Linking...
lld-link: error: could not open libLIBCMT.a: no such file or directory
lld-link: error: could not open libOLDNAMES.a: no such file or directory
collect2.exe: error: ld returned 1 exit status


Also, if I explicitly give the libraries, the behavior follows that of CLANG.

--

BTW: It seems that MINGW is not able to deal with GDAL/OGR source properly... and some other packages too. I guess this was one of my reasons to drop it.

Best regards,

Tom


Too bad...
Re: U++/Win32 is now using CLANG toolchain [message #53284 is a reply to message #53245] Thu, 26 March 2020 11:40 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Tom1 wrote on Wed, 25 March 2020 08:57
Hi Mirek,
Libraries: ../lib/libcmt.lib ../lib/liboldnames.lib


I was thinking about it; if you do not link those libs, what symbols are missing?

Maybe it would be possible to provide the implementation just for missing symbols as workaround? Perhaps even check wine sources to get a clue what they are supposed to do... or MSC library sources - I think those are available.

Mirek
Re: U++/Win32 is now using CLANG toolchain [message #53285 is a reply to message #53284] Thu, 26 March 2020 12:00 Go to previous messageGo to previous message
Tom1
Messages: 1212
Registered: March 2007
Senior Contributor
Hi Mirek,

Actually, I think it is not about missing symbols at all...

I opened the binary .lib file and noticed that it contains the following text string:

/DEFAULTLIB:"LIBCMT" /DEFAULTLIB:"OLDNAMES" 


IMO, these are the problem. I just can't figure out how to remove these dependencies cleanly. All my attempts with binary editing resulted in invalid library file.

Is there some LIB or AR command that could be used to remove these? Then I could see missing symbols and try to fix them.

Best regards,

Tom
Previous Topic: theide: Navigator is now able to search for files too
Next Topic: ide: Compare with log and new 'unit' testing method
Goto Forum:
  


Current Time: Fri Mar 29 07:36:57 CET 2024

Total time taken to generate the page: 0.02094 seconds