GTK3 Woes

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
JohnnyShivers
In need of some credit
In need of some credit
Posts: 1
Joined: Sat Mar 27, 2021 6:42 pm

GTK3 Woes

Post by JohnnyShivers » Mon Mar 29, 2021 9:58 pm

Hey y'all,

I have an issue. The left box I call Tilt has gtk3-unicode-3.1, the right box I call Monster has gtk3-unicode-static-3.1.

Tilt has wxWidgets installed in

Code: Select all

/usr
, specifically,

Code: Select all

/usr/include/wx-3.1
with a softlink of and including

Code: Select all

/usr/include/wx
Monster has the same setup, in

Code: Select all

/usr
and such. The code is C++ and routinely pulled from github as changes are made and the code is improved.

Essentially, Tilt compiles with zero issues and Monster is a MONSTER about it.

On Monster ::

Code: Select all

...
/usr/bin/ld: /usr/include/wx/event.h:419: undefined reference to `wxTrapInAssert'
...
/usr/bin/ld: /usr/include/wx/containr.h:247: undefined reference to `wxControlContainerBase::UpdateCanFocusChildren()'
/usr/bin/ld: ProgramGUI.o: in function `wxCreateApp()':
/home/john/thor-linux/Server/src/ProgramGUI.cpp:9: undefined reference to `wxAppConsoleBase::CheckBuildOptions(char const*, char const*)'
/usr/bin/ld: ProgramGUI.o: in function `main':
/home/john/thor-linux/Server/src/ProgramGUI.cpp:80: undefined reference to `wxEntryStart(int&, char**)'
/usr/bin/ld: ProgramGUI.o: in function `wxAppConsoleBase::SetInitializerFunction(wxAppConsole* (*)())':
/usr/include/wx/app.h:454: undefined reference to `wxAppConsoleBase::ms_appInitFn'
/usr/bin/ld: ProgramGUI.o: in function `wxAppConsoleBase::GetInstance()':
/usr/include/wx/app.h:462: undefined reference to `wxAppConsoleBase::ms_appInstance'
/usr/bin/ld: ProgramGUI.o: in function `A*******s::GUI::GUI()':
/home/john/thor-linux/Server/inc/GUI.h:21: undefined reference to `wxApp::wxApp()'
/usr/bin/ld: SocketServer.o: in function `A*******s::SocketServer::SetContext(boost::asio::ssl::context*)':
/home/user/thor-linux/Server/src/SocketServer.cpp:51: undefined reference to `wxGetTextFromUser(wxString const&, wxString const&, wxString const&, wxWindow*, int, int, bool)'
/usr/bin/ld: /home/user/thor-linux/Server/src/SocketServer.cpp:65: undefined reference to `wxGetTextFromUser(wxString const&, wxString const&, wxString const&, wxWindow*, int, int, bool)'
collect2: error: ld returned 1 exit status
make: *** [Makefile:24: server] Error 1
The

Code: Select all

main()
is below:

Code: Select all

int main(int argc, char** argv)
{
/*Ensure running as root*/
#ifndef _WIN32
    // if(geteuid() != 0)
    // {
    //     std::cerr << "This program must run as root. Please restart the process as a root user." << std::endl;
    //     return -1;
    // }
#endif

#ifdef _WIN32
    socketThread = std::thread([]()
    {
        RunSocketServer();
    });
#else
    pthread_t* threadObject = &socketThreadObject;
    socketThread = std::thread([threadObject]()
    {
        socketThreadObject = pthread_self();
        RunSocketServer();
    });
#endif

    wxEntryStart(argc, argv);
    wxTheApp->CallOnInit();
    // wxTheApp->OnInit();
    wxTheApp->OnRun();
    wxTheApp->OnExit();
    wxTheApp->CleanUp();
What is /wrong/? Is this not installed or built correctly?

DavidHart
Site Admin
Site Admin
Posts: 4064
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: GTK3 Woes

Post by DavidHart » Tue Mar 30, 2021 10:10 am

Hi,

Just to make sure I understand:
you have a standard wx3.1 install on one computer, and your program compiles and links correctly against this.
you have a static-link wx3.1 install on the other computer, and your program fails to link against that.

Various questions:
  • Which wxWidgets version (or versions) are these? Are they self-builds? If not, where did they come from?
    Why is one static-link? Is it important, or would you be happy if I just suggested the obvious solution of replacing it with a dynamic-link one.
  • Are you sure the 'Monster' box has only one wxWidgets installed? What is the output of doing, in a terminal:
    wx-config --list
    If you have a debian-based distro (I presume this is Linux), try also doing, as root:
    #> update-alternatives --display wx-config
  • How are you building the program? If in a terminal, what is your build command(s)? If in an IDE or with a makefile, what are your compilation and linker settings?
Regards,

David

Post Reply