wxWidgets 3.1.0 building with clang

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
romikforest
In need of some credit
In need of some credit
Posts: 2
Joined: Wed Dec 06, 2017 9:49 pm

wxWidgets 3.1.0 building with clang

Post by romikforest »

I very need to build wxWidgets with clang on Windows for my current project, and I've build wxWidgets 3.0.3 and 3.1.0 on with native clang llvm 5.0.0, using mingw-w64 7.2.0, 64 bit, seh, posix threads standard library and tools (x86_64-w64-windows-gnu target). Samples are working. But I'm unable to link dll's except the main one. So I can't build opengl dll in monolithic shared build and all dlls with MONOLITHIC=0. There are some errors with headers/precompiled headers. While compiling I have many redeclared inline; 'dllimport' attribute ignored warnings like:

Code: Select all

    In file included from ../../src/xrc/xmlreshandler.cpp:18:
    In file included from ..\..\include\wx/xrc/xmlreshandler.h:22:
    In file included from ..\..\include\wx/window.h:18:
    ..\..\include\wx/event.h:3750:35: warning: 'wxObjectEventFunctor::operator()' redeclared inline; 'dllimport' attribute ignored [-Wignored-attributes]
    inline void wxObjectEventFunctor::operator()(wxEvtHandler *handler, wxEvent& event)
and then linker undefined reference errors like:

Code: Select all

     clang_mswuddll-forest\coredll_appcmn.o:(.rdata[_ZTV12wxAppConsole]+0x1e0): undefined reference to `non-virtual thunk to wxAppConsoleBase::FilterEvent(wxEvent&)'
In case of monolithic build I had warnings in compilation stage only in file src/common/glcmn.cpp, so I had builded a library with command like:

Code: Select all

    mingw32-make.exe -f makefile.gcc MONOLITHIC=1 SHARED=1 BUILD=debug USE_OPENGL=0 CFLAGS=" -Wno-inconsistent-missing-override -Wno-shift-negative-value -Wno-unused-command-line-argument " CXXFLAGS=" -Wno-inconsistent-missing-override -Wno-shift-negative-value -Wno-unused-command-line-argument -fexceptions -fasynchronous-unwind-tables -fnon-call-exceptions -std=gnu++11 -pthread " LDFLAGS=" -Wno-unused-command-line-argument -fexceptions -fasynchronous-unwind-tables -fnon-call-exceptions -pthread -Wl,--allow-multiple-definition "  CC="clang -target x86_64-w64-windows-gnu" CXX="clang++ -target x86_64-w64-windows-gnu"
I had patched only two files while building wxWidgets 3.1.0 vesrion to avoid errors: include/wx/msw/private.h and src/msw/mediactrl_am.cpp
In src/msw/mediactrl_am.cpp I had changed the constant in case:

Code: Select all

    case -609: // readystatechange in IActiveMovie2 and IMediaPlayer
and in include/wx/msw/private.h I changed lines with errors:

Code: Select all

    // close the handle in the class dtor
    //template <wxUIntPtr INVALID_VALUE = (wxUIntPtr)INVALID_HANDLE_VALUE>
    template <wxUIntPtr INVALID_VALUE = (wxUIntPtr)-1>
    class AutoHANDLE
and:

Code: Select all

    static HANDLE InvalidHandle()
    {
        //return static_cast<HANDLE>(INVALID_VALUE);
        return reinterpret_cast<HANDLE>(INVALID_VALUE);
    }
For wxWidgets 3.0.3 I've patched mediactrl_am.cpp and also used the patch https://github.com/wxWidgets/wxWidgets/ ... 11237e38f6

It is very difficult to me to install tools like MSYS2 on my job, so I would like to avoid using configure.

Is there way to repair wxWidgets dlls building with clang in my case?
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7458
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxWidgets 3.1.0 building with clang

Post by ONEEYEMAN »

Hi,
You have 2 contradicting statements:

1. "Samples are working."
2. "I'm unable to link dll's except the main one.".

Are you able to build and execute the dll sample?

Thank you.
romikforest
In need of some credit
In need of some credit
Posts: 2
Joined: Wed Dec 06, 2017 9:49 pm

Re: wxWidgets 3.1.0 building with clang

Post by romikforest »

I've builded samples with static libraries (default). And I test my project now using SHARED=0.
I've builded MONOLITHIC=1 SHARED=1 wxWidgets without opengl and the dialog sample with them, and it works.

I can't build MONOLITHIC=0 SHARED=1 at all.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7458
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxWidgets 3.1.0 building with clang

Post by ONEEYEMAN »

Hi,
But if static build works - what else do you need.
Can you build and run the project using that configuration?
It is de-facto standard on Windows.

Thank you.
Post Reply