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
Re: U++/Win32 is now using CLANG toolchain [message #53291 is a reply to message #53285] Thu, 26 March 2020 16:55 Go to previous messageGo to next message
Tom1
Messages: 1212
Registered: March 2007
Senior Contributor
Hi,

One step forward...

when: WIN32 CLANG
Link options: -Xlinker /NODEFAULTLIB:OLDNAMES -Xlinker /NODEFAULTLIB:LIBCMT


This prevents those default libs to be linked.

However, this comes with a price tag:

Linking...
lld-link: error: undefined symbol: __GSHandlerCheck
lld-link: error: undefined symbol: __security_check_cookie
lld-link: error: undefined symbol: __report_rangecheckfailure
lld-link: error: undefined symbol: __chkstk
lld-link: error: undefined symbol: _fltused
lld-link: error: undefined symbol: EnumPrintersA
lld-link: error: undefined symbol: OpenPrinterA
lld-link: error: undefined symbol: SetPrinterA
lld-link: error: undefined symbol: ClosePrinter
clang-10: error: linker command failed with exit code 1 (use -v to see invocation)

There were errors. (0:00.61)


Best regards,

Tom
Re: U++/Win32 is now using CLANG toolchain [message #53293 is a reply to message #53291] Thu, 26 March 2020 17:26 Go to previous messageGo to next message
Tom1
Messages: 1212
Registered: March 2007
Senior Contributor
And here's finally the solution to this game. Had to add fake functions to satisfy the dependencies. I know these functions do not do anything, but I decided not to really need those anyway...

#ifdef __MINGW32__
extern "C"{
	void __cdecl __GSHandlerCheck() { }
	void __cdecl __security_check_cookie(uintptr_t i) { }
	void __cdecl __chkstk() { }
	void __cdecl __report_rangecheckfailure() { }
	void __cdecl _fltused() { }
	WINBOOL WINAPI EnumPrintersA(DWORD Flags,LPSTR Name,DWORD Level,LPBYTE pPrinterEnum,DWORD cbBuf,LPDWORD pcbNeeded,LPDWORD pcReturned) { return false; }
	WINBOOL WINAPI OpenPrinterA(LPSTR pPrinterName,LPHANDLE phPrinter,LPPRINTER_DEFAULTSA pDefault) { return false; }
	WINBOOL WINAPI SetPrinterA(HANDLE hPrinter,DWORD Level,LPBYTE pPrinter,DWORD Command) { return false; }
	WINBOOL WINAPI ClosePrinter(HANDLE hPrinter) { return false; }
}
#endif //__MINGW32__


One more library to go... with a different challenge.

Best regards,

Tom
Re: U++/Win32 is now using CLANG toolchain [message #53295 is a reply to message #53285] Thu, 26 March 2020 18:39 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
What about create empty, add 'manually'? It looks like in the step where you tried to add empty libs, you did not combine that with this.
Re: U++/Win32 is now using CLANG toolchain [message #53296 is a reply to message #53295] Thu, 26 March 2020 18:57 Go to previous messageGo to next message
Tom1
Messages: 1212
Registered: March 2007
Senior Contributor
The above solution is actually easier for me as I do not need to maintain separate dummy empty libs. The lines of code required can be included in the module using the library so it is quite straight forward in this special case.

Thanks and best regards,

Tom
Re: U++/Win32 is now using CLANG toolchain [message #53299 is a reply to message #53296] Thu, 26 March 2020 22:24 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Tom1 wrote on Thu, 26 March 2020 18:57
The above solution is actually easier for me as I do not need to maintain separate dummy empty libs. The lines of code required can be included in the module using the library so it is quite straight forward in this special case.

Thanks and best regards,

Tom


Cool!

Mirek
Re: U++/Win32 is now using CLANG toolchain [message #54549 is a reply to message #53299] Thu, 13 August 2020 12:13 Go to previous messageGo to next message
Oblivion is currently offline  Oblivion
Messages: 1091
Registered: August 2007
Senior Contributor
Hello Mirek,

One problem I've noticed about CLANG on windows: Windows 10 api doesn't seem to be supported by Upp. They cant't be compiled because some of them are conditionally included (ver >= 0x0A00, ver >= 0x0700, etc.)

(I've noticed this while implementing the windows 10 pseudoconsole API support for terminal ctrl.)

The headers, and prototypes are already included in CLANG bundle but It requires manual intervention in Core/config.h to change _WIN32_WINNT from 0x0501 to 0x0A00. (redefining it elsewhere doesn't seem to work either; or at least I couldn't find a simple way)

If I set the version number to 0x0A00 everthing compiles fine on CLANG.
(Also, there is no such problem with MSVC 19. It does not require any intervention.)

Is there a workaround for this problem? (may be a flag in TheIDE's main configuration, etc. ?)

Best regards,
Oblivion



[Updated on: Thu, 13 August 2020 12:26]

Report message to a moderator

Re: U++/Win32 is now using CLANG toolchain [message #54550 is a reply to message #54549] Thu, 13 August 2020 14:20 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Oblivion wrote on Thu, 13 August 2020 12:13
Hello Mirek,

One problem I've noticed about CLANG on windows: Windows 10 api doesn't seem to be supported by Upp. They cant't be compiled because some of them are conditionally included (ver >= 0x0A00, ver >= 0x0700, etc.)

(I've noticed this while implementing the windows 10 pseudoconsole API support for terminal ctrl.)

The headers, and prototypes are already included in CLANG bundle but It requires manual intervention in Core/config.h to change _WIN32_WINNT from 0x0501 to 0x0A00. (redefining it elsewhere doesn't seem to work either; or at least I couldn't find a simple way)

If I set the version number to 0x0A00 everthing compiles fine on CLANG.
(Also, there is no such problem with MSVC 19. It does not require any intervention.)

Is there a workaround for this problem? (may be a flag in TheIDE's main configuration, etc. ?)

Best regards,
Oblivion



I guess adding a flag is the most appropriate at this moment. flagWIN10?
Re: U++/Win32 is now using CLANG toolchain [message #54551 is a reply to message #54550] Thu, 13 August 2020 16:50 Go to previous messageGo to next message
Oblivion is currently offline  Oblivion
Messages: 1091
Registered: August 2007
Senior Contributor
Quote:
I guess adding a flag is the most appropriate at this moment. flagWIN10?


I think that would be fine. Smile


Re: U++/Win32 is now using CLANG toolchain [message #54592 is a reply to message #54550] Tue, 18 August 2020 20:31 Go to previous messageGo to next message
Oblivion is currently offline  Oblivion
Messages: 1091
Registered: August 2007
Senior Contributor
Hello Mirek,


Can we set the definitions in config.h to:

	#ifdef flagWIN10
		#define _WIN32_WINNT _WIN32_WINNT_WIN10
		#undef NTDDI_VERSION
		#define NTDDI_VERSION NTDDI_WIN10_19H1
	#else
		#define _WIN32_WINNT _WIN32_WINNT_WINXP
	#endif



Apparently CLANG Windows 10 api requires setting both the _WIN32_WINNT amd NTDDI_VERSION, to properly -fully- work.
It seems that both versioning constants have to match, and the default NTDDI is set to WINXP.

The WIN10_19H1 is the latest windows 10 upgrade that our CLANG bundle supports. (Gives better Win10 api access to driver kits, which pseudoconsole requires. It doesn't seem to break anything anyway.).

Best regards,
Oblivion


[Updated on: Tue, 18 August 2020 20:37]

Report message to a moderator

Re: U++/Win32 is now using CLANG toolchain [message #54594 is a reply to message #54592] Wed, 19 August 2020 09:16 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
[quote title=Oblivion wrote on Tue, 18 August 2020 20:31]Hello Mirek,


Can we set the definitions in config.h to:

	#ifdef flagWIN10
		#define _WIN32_WINNT _WIN32_WINNT_WIN10
		#undef NTDDI_VERSION
		#define NTDDI_VERSION NTDDI_WIN10_19H1
	#else
		#define _WIN32_WINNT _WIN32_WINNT_WINXP
	#endif


Can it be

		#ifdef flagWIN10
			#define _WIN32_WINNT _WIN32_WINNT_WIN10
			#undef NTDDI_VERSION
			#define NTDDI_VERSION NTDDI_WIN10_19H1
		#else
			#define _WIN32_WINNT 0x0501
		#endif


? (more conservative w.r.t. _WIN32_WINNT_WIN10 availability)

Mirek
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 00:06:22 CET 2024

Total time taken to generate the page: 0.02685 seconds