Opened 7 months ago

Closed 3 months ago

Last modified 3 months ago

#15567 closed defect (fixed)

`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 (9)

comment:1 Changed 7 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 7 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 5 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 5 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 5 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 5 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 3 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 3 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 3 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.

Note: See TracTickets for help on using tickets.