Libraries aui,html,core,net,xrc,xml,base not found during linking

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.
ultrajunkie
Knows some wx things
Knows some wx things
Posts: 29
Joined: Sun May 30, 2021 10:11 am

Libraries aui,html,core,net,xrc,xml,base not found during linking

Post by ultrajunkie »

I have built the latest wxWidgets version 3.2.1 and try to rebuild one of my applications in debug mode using Codelite to see if the setup is (still) working.

What I find is that the linker searches for the following files:

wxmsw32u_auid
wxmsw32u_htmld
wxmsw32u_cored
wxmsw32u_netd
wxmsw32u_xrcd
wxmsw32u_xmld
wxmsw32u_based

while the libraries were named during compilation:

wxmsw32ud_aui
wxmsw32ud_html
wxmsw32ud_core
wxmsw32ud_net
wxmsw32ud_xrc
wxmsw32ud_xml
wxmsw32ud_base

This of course leads to file not found errors and linking fails. It seems to be an issue together with the latest version of Codelite (16.5.0) but I can't find any place where to change it. With the version 16.2.0 it compiles without errors.

Building the Release version works well because of the missing "d". Any ideas?
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Libraries aui,html,core,net,xrc,xml,base not found during linking

Post by ONEEYEMAN »

Hi,
There is some inconsistency in your setup.
How did you build wx and your application initially?
And did you use exactly the same commands with the update?

Thank you.
ultrajunkie
Knows some wx things
Knows some wx things
Posts: 29
Joined: Sun May 30, 2021 10:11 am

Re: Libraries aui,html,core,net,xrc,xml,base not found during linking

Post by ultrajunkie »

yes, the build batch file was the same as for the previous versions, and during the update of Codelite I kept the settings.

d:
rem cd \Programmierung\wxWidgets-3.1.5\build\msw
rem cd \Programmierung\wxWidgets-3.2.0\build\msw
cd \Programmierung\wxWidgets-3.2.1\build\msw

mingw32-make -j 4 -f makefile.gcc UNICODE=1 SHARED=1 BUILD=debug clean
mingw32-make -j 4 -f makefile.gcc UNICODE=1 SHARED=1 BUILD=release clean
mingw32-make -j 4 -f makefile.gcc UNICODE=1 SHARED=0 BUILD=debug clean
mingw32-make -j 4 -f makefile.gcc UNICODE=1 SHARED=0 BUILD=release clean

mingw32-make -f makefile.gcc UNICODE=1 SHARED=1 BUILD=debug
mingw32-make -f makefile.gcc UNICODE=1 SHARED=0 BUILD=debug
mingw32-make -f makefile.gcc UNICODE=1 SHARED=1 BUILD=release
mingw32-make -f makefile.gcc UNICODE=1 SHARED=0 BUILD=release
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Libraries aui,html,core,net,xrc,xml,base not found during linking

Post by ONEEYEMAN »

Hi,
What is the purpose you are building both static and shared libraries?
Is it possible there is a conflict between this 2?

Thank you.
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Libraries aui,html,core,net,xrc,xml,base not found during linking

Post by doublemax »

Code: Select all

wxmsw32u_auid
wxmsw32u_htmld
wxmsw32u_cored
wxmsw32u_netd
wxmsw32u_xrcd
wxmsw32u_xmld
wxmsw32u_based
The "d" at the end of the library names is very suspicious, i've never seen that before. Double check the library names in the project settings.
Use the source, Luke!
ultrajunkie
Knows some wx things
Knows some wx things
Posts: 29
Joined: Sun May 30, 2021 10:11 am

Re: Libraries aui,html,core,net,xrc,xml,base not found during linking

Post by ultrajunkie »

These are the linker options: $(shell wx-config --libs aui,html,core,net,xrc,xml,base)

I checked the makefile for one sample, and it seems that there the real lib names are concatenated from various informations incl. unicode and debug flag.However I haven't found any place yet where Codelite does the same as I start to suspect that the problem is there.

Regarding the built of both lib and dll: I want to have the freedom to use both. The selection is done by environment variables (not very convenient but working). And, as said before: It worked fine with wxWidgets 3.2.0 and Codelite 16.2.0
Manolo
Can't get richer than this
Can't get richer than this
Posts: 827
Joined: Mon Apr 30, 2012 11:07 pm

Re: Libraries aui,html,core,net,xrc,xml,base not found during linking

Post by Manolo »

I see the name of each lib wrongly constructed.
Two potential origins:
1) Your environment vars aren't finely adjusted/selected for each case (shared, debug)
2) wx-config is not used properly. According to https://sites.google.com/site/wxconfig/ you should use something as
wx-config --wxcfg=gcc_dll\mswud for a shared debug case. Notice that this wxcfg flag may be not present in your wx-config version.

It can be also a combiantion of both.
ultrajunkie
Knows some wx things
Knows some wx things
Posts: 29
Joined: Sun May 30, 2021 10:11 am

Re: Libraries aui,html,core,net,xrc,xml,base not found during linking

Post by ultrajunkie »

The environment variables are all properly set.

Eran from Codelite confirmed that it is a bug in their wx-config tool.

For the time being I switched back to Codelite 16.2.0 and will try with the next version.

Anyway: thanks to everybody contributing to the analysis!
ultrajunkie
Knows some wx things
Knows some wx things
Posts: 29
Joined: Sun May 30, 2021 10:11 am

Re: Libraries aui,html,core,net,xrc,xml,base not found during linking

Post by ultrajunkie »

It looks like.

Codelite comes with a wx-config.exe, and I guess it is the same as the one you mention. I was thinking of trying the version coming with 16.2.0 and copy it into the 16.5.0 installation but since I am only a hobby programmer when it comes to wxWidgets my time for playing around is limited. Otherwise I would love to also contribute to some of the open source projects I am taking benefit of...

Nevertheless I checked the links and found the problem. The fix implemented by asmwarrior is wrong for non-monolithic libs:

Code: Select all

     const auto& libs = parser.get_libs();
     for(const auto& lib : libs) {
         if(lib == "base") {
             // monolithic lib
             stringstream libname;
             // example: libwxmsw31u.a
-            libname << "wxmsw" << build_cfg["WXVER_MAJOR"] << build_cfg["WXVER_MINOR"] << "u";
+            libname << "wxmsw" << build_cfg["WXVER_MAJOR"] << build_cfg["WXVER_MINOR"] << "u" << debug_lib_suffix;
             ss << "-l" << libname.str() << " ";
         } else {
             // translate lib name to file name
             const auto& libs = parser.get_libs();
             for(const auto& lib : libs) {
                 if(libs_map.count(lib)) {
-                    ss << "-l" << libs_map[lib] << " ";
+                    ss << "-l" << libs_map[lib] << debug_lib_suffix << " ";  <-- This is the issue. The "d" is appended at the end!
                 }
             }
         }
What I didn't see is where the lib filename comes from in that case. There is no reference to libs_map, and there the debug suffix needs to be placed in the middle.
ollydbg23
Super wx Problem Solver
Super wx Problem Solver
Posts: 438
Joined: Fri Dec 12, 2008 10:31 am

Re: Libraries aui,html,core,net,xrc,xml,base not found during linking

Post by ollydbg23 »

ultrajunkie wrote: Mon Dec 05, 2022 10:19 am ...
Nevertheless I checked the links and found the problem. The fix implemented by asmwarrior is wrong for non-monolithic libs:
I'm sorry, I'm the github user "asmwarrior". Yes, I'm using the monolithic shared libs (both release and debug libs). I have also tested the non-monolithic libs (release libs supplied by pacman in msys2).

But I haven't tested the debug version of non-monolithic libs. Hope we can find a way to fix it.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Libraries aui,html,core,net,xrc,xml,base not found during linking

Post by ONEEYEMAN »

Hi,
Is there a reason people who is NOT C::B devs still using monolithic build? :-)

Thank you.
ultrajunkie
Knows some wx things
Knows some wx things
Posts: 29
Joined: Sun May 30, 2021 10:11 am

Re: Libraries aui,html,core,net,xrc,xml,base not found during linking

Post by ultrajunkie »

@ollydbg23: no need to apologize. As a clarification: my comment was definitely not meant as an offense :wink:. I'm just used to call a spade a spade. "incorrect" might have been softer... I am very thankful that you and countless other developers maintain open source code for people like me! =D>

Regarding the solution: My suggestion is to take the lib_path(xxx) string (providing it's the full file name as string), split it at the "_" sign and then reconcatenate it using the flags. Would need one extra line of code if my thoughts are correct. I was anyway surprised by the difference in the construct.
ollydbg23
Super wx Problem Solver
Super wx Problem Solver
Posts: 438
Joined: Fri Dec 12, 2008 10:31 am

Re: Libraries aui,html,core,net,xrc,xml,base not found during linking

Post by ollydbg23 »

ultrajunkie wrote: Tue Dec 06, 2022 8:51 am @ollydbg23: no need to apologize. As a clarification: my comment was definitely not meant as an offense :wink:. I'm just used to call a spade a spade. "incorrect" might have been softer... I am very thankful that you and countless other developers maintain open source code for people like me! =D>

Regarding the solution: My suggestion is to take the lib_path(xxx) string (providing it's the full file name as string), split it at the "_" sign and then reconcatenate it using the flags. Would need one extra line of code if my thoughts are correct. I was anyway surprised by the difference in the construct.
Hi, ultrajunkie, thanks for the encouragement.

I'm preparing a fix, see here: fix a bug in generating debug lib names for non monolithic libraries

I have not got a non monolithic libraries in my local PC, so can you help to test it?

EDIT:

fix a bug in generating debug lib names for non monolithic libraries by asmwarrior Pull Request #14 eranif/wx-config-msys2

I have create a Pull Request here.
ultrajunkie
Knows some wx things
Knows some wx things
Posts: 29
Joined: Sun May 30, 2021 10:11 am

Re: Libraries aui,html,core,net,xrc,xml,base not found during linking

Post by ultrajunkie »

sure I can test it. As I am not working with Github I will only need a location where I can download the updated wx-config.exe. I will also have a look at the fix you propose just to doublecheck (but first the coffee has to do its work after a full moon night...) :D

One more thing that comes to my mind:
The lib wxmsw32u(d)_qa is only needed (or usefull) when the compiler is VC. Nevertheless it is searched when using only "--libs" as switch, and linking stops with error if it doesn't exist.

I have 2 workarounds now:
  • 1. copy the libs from the VC collection
  • 2. change the bakefile to generate it always
A potential solution for me would be to take only the libraries where a file exists and skip the others. Then linking would only fail in case of unresolved references. What do you think?

EDIT: I checked the proposed change. If I see it correctly you don't need the separation into monolithic and non-monolithic anymore as the correct libname(s) are already in the lib_map list. You would just need to add all libs found to the ss variable (depending on the number of entries):

Code: Select all

            for(const auto& lib : libs) {
                if(libs_map.count(lib)) {
                    ss << "-l" << libs_map[lib] << " ";
                }
	    }
Last edited by ultrajunkie on Wed Dec 07, 2022 1:27 pm, edited 1 time in total.
Post Reply