Opened 11 years ago

Closed 11 years ago

#39786 closed defect (fixed)

wxWidgets @2.9.5 universal build fails

Reported by: ryandesign (Ryan Carsten Schmidt) Owned by: jyrkiwahlstedt
Priority: Normal Milestone:
Component: ports Version:
Keywords: haspatch Cc: mojca (Mojca Miklavec), cooljeanius (Eric Gallager), vortexfive@…
Port: wxWidgets30

Description

wxWidgets @2.9.4_2 is installed universal but I can upgrade it to 2.9.5 because:

clang: error: cannot use 'precompiled-header' output with multiple -arch options

Attachments (2)

main.log (131.7 KB) - added by ryandesign (Ryan Carsten Schmidt) 11 years ago.
wxWidgets30-universal.patch (3.7 KB) - added by mojca (Mojca Miklavec) 11 years ago.
A patch that enables universal build of wxWidgets30

Download all attachments as: .zip

Change History (10)

Changed 11 years ago by ryandesign (Ryan Carsten Schmidt)

Attachment: main.log added

comment:1 Changed 11 years ago by mojca (Mojca Miklavec)

Cc: mojca@… added

Cc Me!

comment:2 Changed 11 years ago by mojca (Mojca Miklavec)

llvm also fails with

/app/wxWidgets-2.9.5/build/bk-make-pch ./.pch/wxprec_basedll/wx/wxprec.h.gch wx/wxprec.h /usr/bin/llvm-g++-4.2 -I./.pch/wxprec_basedll -D__WXOSX_COCOA__      -DWXBUILDING      -I../src/regex  -DwxUSE_GUI=0 -DWXMAKINGDLL_BASE -DwxUSE_BASE=1 -dynamic -fPIC -DPIC -Wall -Wundef -Wunused-parameter -Wno-ctor-dtor-privacy -Woverloaded-virtual -Wno-deprecated-declarations -D_FILE_OFFSET_BITS=64 -I/app/wxWidgets-2.9.5/build/lib/wx/include/osx_cocoa-unicode-2.9 -I../include -I/opt/local/include -I/opt/local/include -DWX_PRECOMP -I/opt/local/include/SDL -D_GNU_SOURCE=1 -D_THREAD_SAFE -pipe -O2 -arch x86_64 -arch i386 -fno-common -fvisibility=hidden -fvisibility-inlines-hidden

llvm-g++-4.2: -E, -S, -save-temps and -M options are not allowed with multiple -arch flags

comment:3 Changed 11 years ago by mojca (Mojca Miklavec)

Outside of wxWidgets the following works for me:

export CC=clang
export CXX=clang++
export CFLAGS=-I/opt/local/include
export CXXFLAGS=-I/opt/local/include
export LDFLAGS=-L/opt/local/lib

../wxWidgets-2.9.5/configure --prefix=/opt/local --disable-dependency-tracking --mandir=/opt/local/share/man --with-libiconv-prefix=/opt/local --with-libjpeg --with-libtiff --with-libpng --with-zlib --with-opengl --with-cocoa --disable-sdltest --enable-unicode --enable-display --enable-xrc --enable-universal_binary=i386,x86_64 --with-sdl --with-macosx-sdk=no --with-macosx-version-min=no

The last two arguments are not too important, but --enable-universal_binary=i386,x86_64 seems to be, else some trivial patch to configure script is needed.

I need to check again, but I believe that adding -arch i386 -arch x86_64 flags to CFLAGS and LDFLAGS leads to the above mentioned problems.

I'll attach some patches.

comment:4 Changed 11 years ago by mojca (Mojca Miklavec)

One of the problems with current patch is that it skips this test:

    if echo $OSX_ARCH_OPTS | grep -q ","; then
        AC_MSG_WARN([Disabling dependency tracking due to universal binary build.])
        disable_macosx_deps=yes

        dnl HACK: PCH could be made to work by precompiling for each architecture into separate directories
        dnl and including all architecture directories with each compiler invocation.
        dnl That would require a major rework of Bakefile and at the same time it would be nice to have
        dnl Objective-C++ precompiled headers.
        AC_MSG_WARN([Disabling precompiled headers due to universal binary build.])
        bk_use_pch=no
    fi

and possibly some other places like:

    AC_MSG_CHECKING([for architectures to use in universal binary])
    AC_MSG_RESULT([$OSX_ARCH_OPTS])

    dnl NOTE: Only the compiler driver needs arch flags.  The link editor
    dnl is incapable of using them but the compiler driver (which we use
    dnl as LD when building dynamic libraries) uses them to invoke the
    dnl real ld multiple times.  If we moved to libtool -dynamic we would
    dnl need no arch flags because libtool automatically invokes ld for
    dnl every architecture found in the fat input files.
    dnl
    dnl For static library builds, AR/RANLIB automatically create proper
    dnl fat archives although AR is unable to update them once RANLIB has
    dnl made them into proper fat archives.  Fortunately, our link process
    dnl simply removes the .a file before using ar to create a new one.
    dnl If we did move to libtool -static we still wouldn't need arch flags
    dnl because libtool automatically figures it out based on input.
    retest_macosx_linking=yes

because it sets OSX_ARCH_OPTS to -arch i386 -arch x86_64 instead of i386,x86_64.

It would be a lot cleaner to specify the flags in command line rather than patching OSX_ARCH_OPTS in configure script. Apart from this there is another patch for install_name_too, but I don't understand that one.

Changed 11 years ago by mojca (Mojca Miklavec)

Attachment: wxWidgets30-universal.patch added

A patch that enables universal build of wxWidgets30

comment:5 Changed 11 years ago by mojca (Mojca Miklavec)

Keywords: haspatch added
Version: 2.1.3

I attached a new patch which seems to fix the issue for me. Just a few question/notes:

  • Why does port request 10.6? Docs seem to suggest that it should work on 10.5.
  • There is one patch remaining. I have no idea why it is needed and it works for me without that patch.
  • There is no real need to use --with-macosx-sdk=no and --with-macosx-version-min=no, but I find it pointless that the scripts try to pass extra flags to compiler (-mmacosx-version-min=10.5). And the way those flags are implemented in current wxWidgets30, the flags don't work for me at all in some cases.
  • Can wxWidgets-devel be updated as well, please? If that is done, a number of tickets may be closed: #39806, #37624, #39409

comment:6 Changed 11 years ago by cooljeanius (Eric Gallager)

Cc: egall@… added

Cc Me!

comment:7 Changed 11 years ago by mojca (Mojca Miklavec)

Cc: vortexfive@… added

comment:8 Changed 11 years ago by mojca (Mojca Miklavec)

Resolution: fixed
Status: newclosed

Fixed in r108788.

Note: See TracTickets for help on using tickets.