Opened 12 months ago

Last modified 3 weeks ago

#15567 reopened defect

`wx-config --libs xxx` outputs reference to non-existing library in monolithic static build

Reported by: mojca Owned by:
Priority: normal Milestone: 3.0.1
Component: build Version: 3.0.0
Keywords: monolithic wx-config Cc: rzvncj@…, wojdyr@…
Blocked By: Blocking:
Patch: yes

Description

I'm not sure if this is a bug or my misunderstanding or anything else.

I fetched wxWidgets 2.9.5 from the git tag and configured them on 10.6 using

export MACOSX_DEPLOYMENT_TARGET=10.5
../wxWidgets/configure --disable-shared --enable-monolithic --enable-aui --enable-universal_binary=i386,x86_64,ppc --disable-precomp-headers --with-cocoa --enable-unicode --with-macosx-sdk=/Developer/SDKs/MacOSX10.5.sdk

The build succeeds and I end up with the following files in lib:

libwx_osx_cocoau-2.9.a
libwx_osx_cocoau_gl-2.9.a
libwxjpeg-2.9.a
libwxpng-2.9.a
libwxregexu-2.9.a
libwxscintilla-2.9.a
libwxtiff-2.9.a

Then I try to build xCHM whose only reference to aui in configure.ac is the following:

AM_PATH_WXCONFIG(2.8.0, wxWin=1, wxWin=0, [std,aui])

which seems to end up in configure as

WX_LIBS_STATIC=`$WX_CONFIG_WITH_ARGS --static --libs std,aui 2>/dev/null`

Running it separately results in

$ wx-config --static --libs std,aui
-L/path/to/wx/lib   -framework IOKit -framework Carbon -framework Cocoa -framework AudioToolbox -framework System -framework OpenGL -framework QuickTime /path/to/wx/lib/libwx_osx_cocoau_aui-2.9.a /path/to/wx/lib/libwx_osx_cocoau-2.9.a -framework WebKit -lwxregexu-2.9 -lwxtiff-2.9 -lwxjpeg-2.9 -lwxpng-2.9 -lz -lpthread -liconv 

But libwx_osx_cocoau_aui-2.9.a clearly doesn't exist and the build fails with:

g++  -arch ppc -arch i386 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5 -I/path/to/wx/lib/wx/include/osx_cocoa-unicode-static-2.9 -I/path/to/wx/include -D_FILE_OFFSET_BITS=64 -D__WXMAC__ -D__WXOSX__ -D__WXOSX_COCOA__ -W -Wall -g -O2  -arch ppc -arch i386 -arch x86_64 -mmacosx-version-min=10.5 -o xchm chmapp.o chmfile.o chmframe.o chmfshandler.o chminputstream.o chmfontdialog.o chmhtmlnotebook.o chmsearchpanel.o chmhtmlwindow.o chmfinddialog.o chmindexpanel.o chmlistctrl.o hhcparser.o chm_lib.o lzx.o -L/path/to/wx/lib   -framework IOKit -framework Carbon -framework Cocoa -framework AudioToolbox -framework System -framework OpenGL -framework QuickTime /path/to/wx/lib/libwx_osx_cocoau_aui-2.9.a /path/to/wx/lib/libwx_osx_cocoau-2.9.a -framework WebKit -lwxregexu-2.9 -lwxtiff-2.9 -lwxjpeg-2.9 -lwxpng-2.9 -lz -lpthread -liconv  
powerpc-apple-darwin10-g++-4.2.1: /path/to/wx/lib/libwx_osx_cocoau_aui-2.9.a: No such file or directory
i686-apple-darwin10-g++-4.2.1: /path/to/wx/lib/libwx_osx_cocoau_aui-2.9.a: No such file or directory
i686-apple-darwin10-g++-4.2.1: /path/to/wx/lib/libwx_osx_cocoau_aui-2.9.a: No such file or directory
lipo: can't figure out the architecture type of: /var/folders/rp/rpuaZ9PvGJKYcFw7CCjw+k+++TI/-Tmp-//ccct2Dhp.out
make[2]: *** [xchm] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

What am I missing?

Change History (12)

comment:1 Changed 12 months ago by mojca

I forgot to add that I can safely remove the library from the command line and the build then succeeds. But I suspect that the flag should either not be there (returned by wx-config) or the library should exist.

comment:2 Changed 12 months ago by vadz

  • Keywords monolithic wx-config added
  • Summary changed from libwx_osx_cocoau_aui-2.9.a requested, but missing on Mac OS X in a static & monolithic build to `wx-config --libs aui` outputs reference to non-existing library in monolithic static build

The "libs" argument of AM_PATH_WXCONFIG only works with the (default) multilib build. Now, perhaps, in an ideal world, wx-config should recognize the monolithic build specially and ignore the --libs argument when using it. And there is even some code already in it to do it (see if is_monolithic test). But I don't really know how is this supposed to work and am not that interested in finding out... So for now, if you use monolithic build, just don't specify any libraries.

Of course, if anybody is willing to debug and fix wx-config, it would be welcome.

comment:3 Changed 10 months ago by wojdyr

continuing #15689 ...

I think it's simple to fix, although I haven't tested it yet

  • wx-config.in

     
    12031203 
    12041204    # Only add additional info if --libs was specified and not just --optional-libs 
    12051205    if [ -n "$output_option_libs" ]; then 
    1206         # Core libs are already built into the blob. 
    1207         for i in std @STD_GUI_LIBS@ @STD_BASE_LIBS@; do 
     1206        # Almost all libs are already built into the blob. 
     1207        nonstd_libs_in_monolib="aui stc richtext ribbon propgrid" 
     1208        for i in std @STD_GUI_LIBS@ @STD_BASE_LIBS@ $nonstd_libs_in_monolib; do 
    12081209            wx_libs=`remove_field $i $wx_libs` 
    12091210        done 

comment:4 Changed 10 months ago by vadz

  • Patch set
  • Summary changed from `wx-config --libs aui` outputs reference to non-existing library in monolithic static build to `wx-config --libs xxx` outputs reference to non-existing library in monolithic static build

This does look like it ought to fix it, but I wonder if we could do it in the other way, i.e. by only taking into account the libraries which are not included in the monolithic build (what are they, actually?) instead of listing here all libraries which are included in it. This would be slightly more maintenable, I think.

comment:5 Changed 10 months ago by wojdyr

  • Cc wojdyr@… added

that's a good question (which libraries are not included). In my build the only not included library seems to be gl.

comment:6 Changed 10 months ago by vadz

  • Milestone set to 3.0.1
  • Status changed from new to confirmed
  • Version changed from 2.9.5 to 3.0.0

Looking at build/bakefiles/monolithic.bkl this is indeed the only one (AFAIR for historical reason: this was the only independent library before the multi lib build was introduced). So would something like this work?

  • wx-config.in

    diff --git a/wx-config.in b/wx-config.in
    index d405729..ede8583 100755
    a b if is_monolithic; then 
    12031203 
    12041204    # Only add additional info if --libs was specified and not just --optional-libs 
    12051205    if [ -n "$output_option_libs" ]; then 
    1206         # Core libs are already built into the blob. 
    1207         for i in std @STD_GUI_LIBS@ @STD_BASE_LIBS@; do 
    1208             wx_libs=`remove_field $i $wx_libs` 
    1209         done 
     1206        # The only library we need to add when using monolithic build is the gl 
     1207        # one as all the others are already included into the main one. 
     1208        if match_field gl $wx_libs; then 
     1209            wx_libs=gl 
     1210        else 
     1211            wx_libs= 
     1212        fi 
    12101213 
    1211         wx_libs=`order_libs $wx_libs` 
    12121214        wx_libs="@WXCONFIG_LDFLAGS_GUI@ `lib_flags_for $wx_libs`" 
    12131215 
    12141216        # We still need the core lib deps for a static build though 

comment:7 Changed 8 months ago by wojdyr

I think it works (I tested it only by calling wx-config --libs with different arguments and reading output)

comment:8 Changed 8 months ago by VZ

  • Resolution set to fixed
  • Status changed from confirmed to closed

(In [75712]) Fix wx-config --libs in monolithic build.

Don't include non-existent libraries (which are built as part of the main
monolithic one) in this case.

Closes #15567.

comment:9 Changed 8 months ago by VZ

(In [75713]) Fix wx-config --libs in monolithic build.

Don't include non-existent libraries (which are built as part of the main
monolithic one) in this case.

Closes #15567.

comment:10 Changed 3 weeks ago by david_costanzo

  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopening. I think the fix is either incorrect or incomplete.

I am using 3.0.1 built as a monolithic static library using mingw on cygwin. I am trying to build GalaXQL, which someone has ported to wxWidgets 3.0. This application uses wxGLCanvas.

My problem is that "wx-config --libs gl" outputs a reference to a non-existing library, which looks to be covered by this bug. In particular, it outputs

/cygdrive/e/wxWidgets-3.0.1-galaxql/lib/libwx_mswu_gl-3.0.a

whereas the library is really

/cygdrive/e/wxWidgets-3.0.1-galaxql/lib/libwx_mswu_gl-3.0-i686-w64-mingw32.a

This worked in wxWidgets 2.8.

For now, I have worked around this by using a $(subst) call in my Makefile, but I consider this a hack and would like to remove it.

WXLDFLAGS__ = $(shell $(WX_CONFIG) --libs core,base,gl,html,stc)
WXLDFLAGS_  = $(subst gl-3.0.a,gl-3.0-i686-w64-mingw32.a,$(WXLDFLAGS__))

comment:11 Changed 3 weeks ago by david_costanzo

Since bug [15689] (problems with --libs stc) was marked as a duplicate of this, I suppose I should add the problem I had with --libs stc here, instead of creating a new ticket as I had planned.

My problem is that wx-config --libs stc does not output any reference to wxscintilla (it's not that the referenced library doesn't exist, it's that the existing library is not referenced). Again, I have worked around this in my Makefile.

WXLDFLAGS__ = $(shell $(WX_CONFIG) --libs core,base,gl,html,stc)
WXLDFLAGS_  = $(subst gl-3.0.a,gl-3.0-i686-w64-mingw32.a,$(WXLDFLAGS__))
WXLDFLAGS   = $(subst -lrpcrt4,-lrpcrt4 -lwxscintilla-3.0-i686-w64-mingw32,$(WXLDFLAGS_))

Here, it's important that the wxscintilla library come after the main wxwidgets library, which is why I put it after "-lrpcrt4". And I had to snag a windows-specific library, rather than always append it, so that my Makefile would work on GNU/Linux.

comment:12 Changed 3 weeks ago by vadz

What exactly are the configure options you use? I'm going to need to be able to reproduce this to have any chance of fixing it, I don't understand what the problem is by just looking at the code, especially the one with the missing "host" part.

Note: See TracTickets for help on using tickets.