Author Topic: Problem compìling after r11701 (related to Direct2D)  (Read 16025 times)

Offline sodev

  • Regular
  • ***
  • Posts: 496
Re: Problem compìling after r11701 (related to Direct2D)
« Reply #15 on: May 24, 2019, 11:46:20 pm »
Nope, you broke it more :). wxUSE_GRAPHICS_DIRECT2D is ALWAYS defined, but it has the value 0 if its off and 1 if its on. Your check always returns true but its value seems be 0, your error messages indicate that it doesn't find Direct2D related headers.

The problem is that setup.h does enable wxUSE_GRAPHICS_CONTEXT but not wxUSE_GRAPHICS_DIRECT2D

Code
// Enable support for Direct2D-based implementation of wxGraphicsContext.
//
// Default is 1 for compilers which support it, i.e. VC10+ currently. If you
// use an earlier MSVC version or another compiler and installed the necessary
// SDK components manually, you need to change this setting.
//
// Recommended setting: 1 for faster and better quality graphics under Windows
// 7 and later systems (if wxUSE_GRAPHICS_GDIPLUS is also enabled, earlier
// systems will fall back on using GDI+).
#if defined(_MSC_VER) && _MSC_VER >= 1600
    #define wxUSE_GRAPHICS_DIRECT2D wxUSE_GRAPHICS_CONTEXT
#else
    #define wxUSE_GRAPHICS_DIRECT2D 0
#endif

Easiest fix is to set it 1 in the #else case as well.

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2743
Re: Problem compìling after r11701 (related to Direct2D)
« Reply #16 on: May 25, 2019, 12:06:55 am »
Thanks sodev

I reverted my local CB (removing all my dumb changes) and changed setup.h to specify
"#define wxUSE_GRAPHICS_DIRECT2D 1"

That solved the compile problem. But now I get Link errors.
Code
g++.exe -shared  -Wl,--out-implib=devel31_64\libcodeblocks.a -Wl,--dll -Lbase\tinyxml -LC:\usr\Proj\wxWidgets3110\lib\gcc_dll -Ldevel31_64 -Lsdk\scripting\lib .objs31_64\sdk\configmanager-revision.o .objs31_64\sdk\annoyingdialog.o .objs31_64\sdk\autodetectcompilers.o .objs31_64\sdk\base64.o .objs31_64\sdk\blockallocated.o .objs31_64\sdk\cbauibook.o .objs31_64\sdk\cbcolourmanager.o .objs31_64\sdk\cbdebugger_interfaces.o .objs31_64\sdk\cbeditor.o .objs31_64\sdk\cbeditorprintout.o .objs31_64\sdk\cbexception.o .objs31_64\sdk\cbplugin.o .objs31_64\sdk\cbproject.o .objs31_64\sdk\cbstatusbar.o .objs31_64\sdk\cbstyledtextctrl.o .objs31_64\sdk\cbthreadpool.o .objs31_64\sdk\cbtreectrl.o .objs31_64\sdk\cbworkspace.o .objs31_64\sdk\ccmanager.o .objs31_64\sdk\compileoptionsbase.o .objs31_64\sdk\compiler.o .objs31_64\sdk\compilercommandgenerator.o .objs31_64\sdk\compilerfactory.o .objs31_64\sdk\compileroptions.o .objs31_64\sdk\compiletargetbase.o .objs31_64\sdk\configmanager.o .objs31_64\sdk\configurationpanel.o .objs31_64\sdk\configuretoolsdlg.o .objs31_64\sdk\confirmreplacedlg.o .objs31_64\sdk\crc32.o .objs31_64\sdk\debuggermanager.o .objs31_64\sdk\editarrayfiledlg.o .objs31_64\sdk\editarrayorderdlg.o .objs31_64\sdk\editarraystringdlg.o .objs31_64\sdk\editor_hooks.o .objs31_64\sdk\editorbase.o .objs31_64\sdk\editorcolourset.o .objs31_64\sdk\editorlexerloader.o .objs31_64\sdk\editormanager.o .objs31_64\sdk\editpairdlg.o .objs31_64\sdk\editpathdlg.o .objs31_64\sdk\edittooldlg.o .objs31_64\sdk\encodingdetector.o .objs31_64\sdk\externaldepsdlg.o .objs31_64\sdk\filefilters.o .objs31_64\sdk\filegroupsandmasks.o .objs31_64\sdk\filemanager.o .objs31_64\sdk\findreplacedlg.o .objs31_64\sdk\genericmultilinenotesdlg.o .objs31_64\sdk\globals.o .objs31_64\sdk\importers_globals.o .objs31_64\sdk\incremental_select_helper.o .objs31_64\sdk\infowindow.o .objs31_64\sdk\loggers.o .objs31_64\sdk\logmanager.o .objs31_64\sdk\macrosmanager.o .objs31_64\sdk\manager.o .objs31_64\sdk\menuitemsmanager.o .objs31_64\sdk\mozilla_chardet\src\CharDistribution.o .objs31_64\sdk\mozilla_chardet\src\JpCntx.o .objs31_64\sdk\mozilla_chardet\src\LangBulgarianModel.o .objs31_64\sdk\mozilla_chardet\src\LangCyrillicModel.o .objs31_64\sdk\mozilla_chardet\src\LangGreekModel.o .objs31_64\sdk\mozilla_chardet\src\LangHebrewModel.o .objs31_64\sdk\mozilla_chardet\src\LangHungarianModel.o .objs31_64\sdk\mozilla_chardet\src\LangThaiModel.o .objs31_64\sdk\mozilla_chardet\src\nsBig5Prober.o .objs31_64\sdk\mozilla_chardet\src\nsCharSetProber.o .objs31_64\sdk\mozilla_chardet\src\nsEscCharsetProber.o .objs31_64\sdk\mozilla_chardet\src\nsEscSM.o .objs31_64\sdk\mozilla_chardet\src\nsEUCJPProber.o .objs31_64\sdk\mozilla_chardet\src\nsEUCKRProber.o .objs31_64\sdk\mozilla_chardet\src\nsEUCTWProber.o .objs31_64\sdk\mozilla_chardet\src\nsGB2312Prober.o .objs31_64\sdk\mozilla_chardet\src\nsHebrewProber.o .objs31_64\sdk\mozilla_chardet\src\nsLatin1Prober.o .objs31_64\sdk\mozilla_chardet\src\nsMBCSGroupProber.o .objs31_64\sdk\mozilla_chardet\src\nsMBCSSM.o .objs31_64\sdk\mozilla_chardet\src\nsSBCharSetProber.o .objs31_64\sdk\mozilla_chardet\src\nsSBCSGroupProber.o .objs31_64\sdk\mozilla_chardet\src\nsSJISProber.o .objs31_64\sdk\mozilla_chardet\src\nsUniversalDetector.o .objs31_64\sdk\mozilla_chardet\src\nsUTF8Prober.o .objs31_64\sdk\multiselectdlg.o .objs31_64\sdk\newfromtemplatedlg.o .objs31_64\sdk\personalitymanager.o .objs31_64\sdk\pipedprocess.o .objs31_64\sdk\pluginmanager.o .objs31_64\sdk\pluginsconfigurationdlg.o .objs31_64\sdk\printing_types.o .objs31_64\sdk\projectbuildtarget.o .objs31_64\sdk\projectfile.o .objs31_64\sdk\projectfileoptionsdlg.o .objs31_64\sdk\projectlayoutloader.o .objs31_64\sdk\projectloader.o .objs31_64\sdk\projectloader_hooks.o .objs31_64\sdk\projectmanager.o .objs31_64\sdk\projectsfilemasksdlg.o .objs31_64\sdk\projecttemplateloader.o .objs31_64\sdk\scripting\bindings\sc_consts.o .objs31_64\sdk\scripting\bindings\sc_dialog.o .objs31_64\sdk\scripting\bindings\sc_globals.o .objs31_64\sdk\scripting\bindings\sc_io.o .objs31_64\sdk\scripting\bindings\sc_plugin.o .objs31_64\sdk\scripting\bindings\sc_progress.o .objs31_64\sdk\scripting\bindings\sc_util_dialogs.o .objs31_64\sdk\scripting\bindings\sc_wxtypes.o .objs31_64\sdk\scripting\bindings\scriptbindings.o .objs31_64\sdk\scriptingmanager.o .objs31_64\sdk\scriptsecuritywarningdlg.o .objs31_64\sdk\scrollingdialog.o .objs31_64\sdk\sdk_events.o .objs31_64\sdk\searchresultslog.o .objs31_64\sdk\selecttargetdlg.o .objs31_64\sdk\templatemanager.o .objs31_64\sdk\tinywxuni.o .objs31_64\sdk\toolsmanager.o .objs31_64\sdk\uservarmanager.o .objs31_64\sdk\workspaceloader.o .objs31_64\sdk\xtra_res.o  -o devel31_64\codeblocks.dll -Wl,--enable-auto-image-base -Wl,--export-all-symbols -Wl,--add-stdcall-alias -Wl,--enable-auto-import -Wl,--no-undefined  -lshfolder -ltxml31_64 -lwxscintilla_cb -lsqplus31_64 -lsqstdlib31_64 -lsquirrel31_64 -lgdi32 -lwxmsw31u
devel31_64/libwxscintilla_cb.a(PlatWX.o): In function `SurfaceFontDataD2D::SurfaceFontDataD2D(FontParameters const&)':
C:/usr/Proj/cbBeta31/trunk/src/sdk/wxscintilla/src/PlatWX.cpp:784: undefined reference to `__imp__Z15wxDWriteFactoryv'
devel31_64/libwxscintilla_cb.a(PlatWX.o): In function `SurfaceDataD2D::SurfaceDataD2D(ScintillaWX*)':
C:/usr/Proj/cbBeta31/trunk/src/sdk/wxscintilla/src/PlatWX.cpp:880: undefined reference to `__imp__Z13wxD2D1Factoryv'
C:/usr/Proj/cbBeta31/trunk/src/sdk/wxscintilla/src/PlatWX.cpp:880: undefined reference to `__imp__Z15wxDWriteFactoryv'
devel31_64/libwxscintilla_cb.a(PlatWX.o): In function `SurfaceD2D::SurfaceD2D()':
C:/usr/Proj/cbBeta31/trunk/src/sdk/wxscintilla/src/PlatWX.cpp:1077: undefined reference to `__imp__Z15wxDWriteFactoryv'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (2 minute(s), 37 second(s))
5 error(s), 22 warning(s) (2 minute(s), 37 second(s))

Is this an indication I need to re-compile wxWidgets 3.1.1 ? If so, what compile settings should I use?
Current my compile settings are (using gcc.exe (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 8.1.0):
Code
mingw32-make -f makefile.gcc USE_XRC=1 SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=1 USE_OPENGL=1 VENDOR=cb CXXFLAGS="-std=gnu++11 -fno-keep-inline-dllexport -fpermissive -Wno-unused-local-typedefs -Wno-ignored-qualifiers -Wno-cast-function-type"

« Last Edit: May 25, 2019, 12:19:18 am by Pecan »

Offline sodev

  • Regular
  • ***
  • Posts: 496
Re: Problem compìling after r11701 (related to Direct2D)
« Reply #17 on: May 25, 2019, 01:02:40 am »
If you change anything in setup.h you always have to recompile wxWidgets, it is its main file to control how it gets compiled.

About compiler settings, i don't know, i build with the https://github.com/rjpcomputing/wxpack scripts, so i do what they do :).

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2743
Re: Problem compìling after r11701 (related to Direct2D)
« Reply #18 on: May 25, 2019, 04:28:13 am »
Resolved:
For windows:
1) change the line in setup.h from "#define wxUSE_GRAPHICS_DIRECT2D 0"
    "to: "#define wxUSE_GRAPHICS_DIRECT2D 1" (drop the quotes).
    For me, setup.h was at ...\wxWidgets3110\lib\gcc_dll\mswu\wx\setup.h
2) Recompile wxWidgets. I did not have to change any build parameters.
3) Recompile CB core, and plugins.
    Copy the wxWidgets executables to your CB output folder.
   For me, these were: ...\wxWidgets3110\lib\gcc_dll\wxmsw311u_gcc_cb.dll
   and ...\wxWidgets3110\lib\gcc_dll\wxmsw311u_gl_gcc_cb.dll
4) My compiler is mingw 8.1.0 gcc.exe (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 8.1.0)
« Last Edit: May 27, 2019, 08:33:44 am by Pecan »

Offline sodev

  • Regular
  • ***
  • Posts: 496
Re: Problem compìling after r11701 (related to Direct2D)
« Reply #19 on: May 25, 2019, 05:25:09 am »
Don't modify the files in the output directories, these files get put there by the build system and it updates them. The correct setup.h to modify is in include\wx\msw

Offline gd_on

  • Lives here!
  • ****
  • Posts: 795
Re: Problem compìling after r11701 (related to Direct2D)
« Reply #20 on: May 25, 2019, 09:48:51 am »
Quote
the build system and it updates them
Not totally sure : I have also correctly built (as Pecan) a new wxwidgets by only modifying \lib\gcc_dll\mswu\wx\setup.h. The one in include\wx\msw seems to be used in a totally fresh build when the lib's one does not still exists. To be totally sure, you can modify both. Nevertheless, take care if you cross build wxwidgets for several OS.
gd_on
Windows 11 64 bits (23H2), svn C::B (last version or almost!), wxWidgets 3.2.4 (tests with 3.3), Msys2 Compilers 13.2.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (dwarf2, posix  in C:\msys64\mingw32).

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5489
Re: Problem compìling after r11701 (related to Direct2D)
« Reply #21 on: May 30, 2019, 09:16:18 am »
I ran into the same problem when trying to build the nightly, win10 64 bit, gcc 8.1.0.

I will try the same thing that Pecan "trial and error-ed", but then there is the discussion that actually that file can exist in 2 locations, ...

Can this please be documented somewhere on the wiki, this is a real breaking change (one could even argue it should not be allowed in such a quick commit), which actually breaks for many people on how to build CB, if we do such things, it should be clearly documented, and the forum is not a good place, things are hard to find. It should be very clear in some section of the wiki.
And a "proven, fact supported solution" if possible, and not trial and errors got it working.

Who can help ?

When there is a good documentation, I will merge it into my nightly cookbook article on the wiki.

I will also mention it in the nightly "Important changes" since it means redistribution of a new wx dll-s.

And while we are rebuilding wx anyway, how about step up to 3.1.2, at the moment nightly is still at 3.1.1 ?

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1549
Re: Problem compìling after r11701 (related to Direct2D)
« Reply #22 on: May 30, 2019, 09:39:23 am »
I am using wx3.1.2 in 32 bits and it works OK, but you will get crashes with Code Completion if you don't backport New Pagodi's changes to wxPopupWindow in wx trunk to wx3.1.2

I published a patch with this backport (and the final files for easier use) in the forum, see http://forums.codeblocks.org/index.php/topic,22974.msg156992.html#msg156992

Regarding the wxWidgets configuration for Direct2D, if lib/gcc_dll/mswu/wx/setup.h exists then it is used for the compilation; if not, then include/wx/msw/setup.h is copied there when compilation starts. Cleaning the target does not delete the setup.h under lib, so any changes made to include/wx/msw/setup.h are ignored. EDIT: the safest way is deletion of lib/gcc_dll (or the 64 variant), edition of include/wx/msw/setup.h and making from scratch.

The only change required to setup.h is from

Code
#if defined(_MSC_VER) && _MSC_VER >= 1600
    #define wxUSE_GRAPHICS_DIRECT2D wxUSE_GRAPHICS_CONTEXT
#else
    #define wxUSE_GRAPHICS_DIRECT2D 0
#endif

to

Code
#if defined(_MSC_VER) && _MSC_VER >= 1600
    #define wxUSE_GRAPHICS_DIRECT2D wxUSE_GRAPHICS_CONTEXT
#else
    #define wxUSE_GRAPHICS_DIRECT2D wxUSE_GRAPHICS_CONTEXT
#endif

or

Code
#define wxUSE_GRAPHICS_DIRECT2D wxUSE_GRAPHICS_CONTEXT
« Last Edit: May 30, 2019, 02:20:46 pm by Miguel Gimenez »

Offline gd_on

  • Lives here!
  • ****
  • Posts: 795
Re: Problem compìling after r11701 (related to Direct2D)
« Reply #23 on: May 30, 2019, 11:29:30 am »
Hi,
Quote
And while we are rebuilding wx anyway, how about step up to 3.1.2
To share my experience, I use myself wx 3.1.2 in 64 bits (since january). I have only added the "temporary" patch proposed by M. Gimenez in http://forums.codeblocks.org/index.php/topic,22974.msg156799.html#msg156799 and it works well. The advantage of this patch, is that it needs only a C::B code modification (though M. Gimenez declare it as non optimal)
I have not used the other patch (in http://forums.codeblocks.org/index.php/topic,22974.msg156992.html#msg156992) because it needs a wxwidgets 3.1.2 modification. And, if I understand well, these modifications have already been included in wxWidget 3.1.3 (by New Pagodi) ... but it's certainly too early to use this new future wx version !
gd_on
Windows 11 64 bits (23H2), svn C::B (last version or almost!), wxWidgets 3.2.4 (tests with 3.3), Msys2 Compilers 13.2.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (dwarf2, posix  in C:\msys64\mingw32).

Offline sodev

  • Regular
  • ***
  • Posts: 496
Re: Problem compìling after r11701 (related to Direct2D)
« Reply #24 on: May 30, 2019, 02:16:06 pm »
There are as many setup.h files as variants you build plus one, in my case i have 9, 4 variants for GCC and 4 variants for MSVC. And those are not present before you actually build the variant at least one time. The wxWidgets documentation clearly tells you how to do the build, you modify the one in the include directory. This is a limitation of Windows where you don't have Autotools, no need to do that on Linux, there you setup the build using the configure script. Recent versions of wxWidgets can be build with CMake, didn't try this by myself, maybe that way is easier to use than the pregenerated Makefile's.

If you don't want to use a custom wxWidgets configuration (i think that is not a problem on Windows, there is usually no system wide library available unlike on Linux) the most proper way would be to figure out which MinGW versions do offer Direct2D support like it is done with the graphics context and propose a PR to wxWidgets so the default configuration will use Direct2D if available. But i don't know if this is possible reliable, AFAIK this is not really related to the compiler version but more to the WinAPI version, but this should also hold true for the graphics context.

About which revision to use, you are building nightly releases, why don't you use "nightly" wxWidgets revisions aka something recent from master? I am using master revisions of wxWidgets for many years now, only a few times i picked a "bad" revision that broke something, but way more often i just got new features and fixes plus i was up to date with breaking api changes. After all you are doing way less releases than wxWidgets, shouldn't be hard to synchronize your own release to one of wxWidgets if you insist on using a release version of it for a release ;)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Problem compìling after r11701 (related to Direct2D)
« Reply #25 on: May 30, 2019, 08:25:09 pm »
(one could even argue it should not be allowed in such a quick commit)
Sorry for the inconvenience, but this is the only way to force people to fix their builds. If I haven't done this the next night build would have mentioned that ligatures worked, but the wouldn't.
Also anyone could just comment this lines, so it is not really a show stopper.

Unfortunately I haven't to documented what I did the first  time I was testing this and now it just worked. :(
If someone is adding stuff to the wiki probably these pages should be updated:
https://wiki.wxwidgets.org/CodeBlocks_Setup_Guide
http://wiki.codeblocks.org/index.php/Compiling_wxWidgets_3.0.0_to_develop_Code::Blocks_(MSW)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7576
    • My Best Post
Re: Problem compìling after r11701 (related to Direct2D)
« Reply #26 on: May 31, 2019, 02:21:49 am »
In about 2 weeks, I hope to have a patch to submit to the wxWidgets master branch to fix this issue for mingw64 gcc builds. I am testing my change to see if it works; then, I need to re-read the setup.h patch documentation to see how to do it.

My patch to fix only configure/make builds. Still needs tested. Patch failed testing!
Code
--- a/setup.h.in
+++ b/setup.h.in
@@ -671,7 +671,7 @@
 
 #define wxUSE_GRAPHICS_GDIPLUS wxUSE_GRAPHICS_CONTEXT
 
-#if defined(_MSC_VER) && _MSC_VER >= 1600
+#if defined(_MSC_VER) && _MSC_VER >= 1600 || defined(__MINGW64_TOOLCHAIN__)
     #define wxUSE_GRAPHICS_DIRECT2D wxUSE_GRAPHICS_CONTEXT
 #else
     #define wxUSE_GRAPHICS_DIRECT2D 0

Tim S.
« Last Edit: May 31, 2019, 09:12:32 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Problem compìling after r11701 (related to Direct2D)
« Reply #27 on: May 31, 2019, 09:12:34 am »
This won't be accepted. I'll have to make more elaborate test because some versions/releases of mingw doesn't have the correct direct2d headers in them.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7576
    • My Best Post
Re: Problem compìling after r11701 (related to Direct2D)
« Reply #28 on: May 31, 2019, 09:34:10 am »
This won't be accepted. I'll have to make more elaborate test because some versions/releases of mingw doesn't have the correct direct2d headers in them.

What version of mingw64 does not have the correct headers?

Note: I found a bug in the order of includes in wx/platform.h and that will likely prevent my wxWidgets patch from working or being accepted.

Edit: More looking into the problem suggest using "wx/msw/chkconf.h" to disable wxUSE_GRAPHICS_DIRECT2D; after it is enabled in setup.h for mingw GCC.
But, I would first have to find out what run-time header version work for both mingw.org and mingw64.
I have decided this is too much work for me at this time.

Tim S.
« Last Edit: May 31, 2019, 11:48:53 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Problem compìling after r11701 (related to Direct2D)
« Reply #29 on: May 31, 2019, 08:18:52 pm »
What version of mingw64 does not have the correct headers?
Not sure, but I'm sure this is not there just because they don't like mingw... You can ask on wx-dev...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]