Opened 9 years ago

Closed 9 years ago

#49074 closed defect (fixed)

qt5-mac @5.4.2: error: declaration of anonymous struct must be a definition

Reported by: fpvvd1@… Owned by: MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)
Priority: Normal Milestone:
Component: ports Version: 2.3.4
Keywords: elcapitan Cc: casey.webster@…, epaell, kurtjaeke@…, michaelld (Michael Dickens), aelhossi@…, maehne (Torsten Maehne), ramundsen85, anthonygelibert (Anthony Gelibert), mkae (Marko Käning), jakubzeman@…
Port: qt5-mac

Description (last modified by ryandesign (Ryan Carsten Schmidt))

OS X El Capitan (10.11)

Error: org.macports.build for port qt5-mac returned: command execution failed
Please see the log file for port qt5-mac for details:
    /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_aqua_qt5-mac/qt5-mac/main.log
To report a bug, follow the instructions in the guide:
    http://guide.macports.org/#project.tickets
Error: Processing of port qt5-mac failed

main.log (tail):

macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_aqua_qt5-mac/qt5-mac/work/qt-everywhere-opensource-src-5.4.2/qtbase/lib -framework QtCore -framework DiskArbitration -framework IOKit -framework Security -lz -framework SystemConfiguration -framework CoreFoundation -framework CoreServices -lssl -lcrypto 
:info:build mv -f QtNetwork ../../lib/QtNetwork.framework/Versions/5/QtNetwork
:info:build ln -s Versions/Current/QtNetwork ../../lib/QtNetwork.framework/QtNetwork
:info:build rm -f ../../lib/QtNetwork.framework/Versions/Current
:info:build ln -s 5 ../../lib/QtNetwork.framework/Versions/Current
:info:build make[3]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_aqua_qt5-mac/qt5-mac/work/qt-everywhere-opensource-src-5.4.2/qtbase/src/network'
:info:build make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_aqua_qt5-mac/qt5-mac/work/qt-everywhere-opensource-src-5.4.2/qtbase/src'
:info:build make[1]: *** [sub-src-make_first] Error 2
:info:build make[1]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_aqua_qt5-mac/qt5-mac/work/qt-everywhere-opensource-src-5.4.2/qtbase'
:info:build make: *** [module-qtbase-make_first] Error 2
:info:build make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_aqua_qt5-mac/qt5-mac/work/qt-everywhere-opensource-src-5.4.2'
:info:build Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_aqua_qt5-mac/qt5-mac/work/qt-everywhere-opensource-src-5.4.2" && /usr/bin/make -j2 -w 
:info:build Exit code: 2
:error:build org.macports.build for port qt5-mac returned: command execution failed
:debug:build Error code: CHILDSTATUS 55341 2
:debug:build Backtrace: command execution failed
    while executing
"system -nice 0 $fullcmdstring"
    ("eval" body line 1)
    invoked from within
"eval system $notty $nice \$fullcmdstring"
    invoked from within
"command_exec build"
    (procedure "portbuild::build_main" line 8)
    invoked from within
"portbuild::build_main org.macports.build"
    ("eval" body line 1)
    invoked from within
"eval $procedure $targetname"
:info:build Warning: targets not executed for qt5-mac: org.macports.activate org.macports.build org.macports.destroot org.macports.install
:notice:build Please see the log file for port qt5-mac for details:
    /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_aqua_qt5-mac/qt5-mac/main.log

Attachments (7)

main.log (1.7 MB) - added by fpvvd1@… 9 years ago.
patch-lalr.diff (1.4 KB) - added by casey.webster@… 9 years ago.
patch-qcocoacursor.diff (645 bytes) - added by casey.webster@… 9 years ago.
Portfile.diff (471 bytes) - added by casey.webster@… 9 years ago.
jzeman_main.log.gz (7.3 MB) - added by jakubzeman@… 9 years ago.
patch-chromium_tbd_libraries.diff (854 bytes) - added by ramundsen85 9 years ago.
patch to chromium, try to use tbd library version if dylib is not available in sysroot path
Portfile-2.diff (532 bytes) - added by ramundsen85 9 years ago.
patch including Portfile.diff and chromium patch

Change History (36)

Changed 9 years ago by fpvvd1@…

Attachment: main.log added

comment:1 Changed 9 years ago by ryandesign (Ryan Carsten Schmidt)

Description: modified (diff)
Keywords: elcapitan added; QT removed
Owner: changed from macports-tickets@… to mcalhoun@…
Summary: Error: Processing of port qt5-mac failedqt5-mac @5.4.2: error: declaration of anonymous struct must be a definition

Maybe updating to 5.5.0 would help.

comment:2 Changed 9 years ago by casey.webster@…

Cc: casey.webster@… added

Cc Me!

comment:3 Changed 9 years ago by casey.webster@…

The patches for qcocoacursor.mm and lalr.cpp in the link above for qt 5.5 are not specific to qt 5.5 and fix the problems building 5.4.2 on el capitan.

I've created patches for lalr.cpp and qcocoacursor.mm taken from the links in the 5.5.0 bug and have successfully built and installed qt-5@5.4.2 with them. I will attach both diffs to this bug as well as a diff of my modified Portfile to apply them (probably not the way the maintainer will do it, but good enough for anyone else who wants to build before port tree is updated.

Changed 9 years ago by casey.webster@…

Attachment: patch-lalr.diff added

Changed 9 years ago by casey.webster@…

Attachment: patch-qcocoacursor.diff added

Changed 9 years ago by casey.webster@…

Attachment: Portfile.diff added

comment:4 Changed 9 years ago by epaell

Cc: elenc@… added

Cc Me!

comment:5 Changed 9 years ago by kurtjaeke@…

Cc: kurtjaeke@… added

Cc Me!

comment:6 in reply to:  3 ; Changed 9 years ago by hardwhack

Replying to casey.webster@…:

The patches for qcocoacursor.mm and lalr.cpp in the link above for qt 5.5 are not specific to qt 5.5 and fix the problems building 5.4.2 on el capitan.

I've created patches for lalr.cpp and qcocoacursor.mm taken from the links in the 5.5.0 bug and have successfully built and installed qt-5@5.4.2 with them. I will attach both diffs to this bug as well as a diff of my modified Portfile to apply them (probably not the way the maintainer will do it, but good enough for anyone else who wants to build before port tree is updated.

Tried cleaning, applying patch to Portfile, copying diff files to files dir and building. After about ~45 minutes of building, the build failed. It got a LOT farther than without the patches however. The log file is 169MB! big so I am still trying to find out what the failure is.

comment:7 Changed 9 years ago by michaelld (Michael Dickens)

Cc: michaelld@… added

Cc Me!

comment:8 Changed 9 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: aelhossi@… added

Has duplicate #49247.

comment:9 in reply to:  6 Changed 9 years ago by aelhossi@…

Replying to pjkim00@…:

Replying to casey.webster@…:

The patches for qcocoacursor.mm and lalr.cpp in the link above for qt 5.5 are not specific to qt 5.5 and fix the problems building 5.4.2 on el capitan.

I've created patches for lalr.cpp and qcocoacursor.mm taken from the links in the 5.5.0 bug and have successfully built and installed qt-5@5.4.2 with them. I will attach both diffs to this bug as well as a diff of my modified Portfile to apply them (probably not the way the maintainer will do it, but good enough for anyone else who wants to build before port tree is updated.

Tried cleaning, applying patch to Portfile, copying diff files to files dir and building. After about ~45 minutes of building, the build failed. It got a LOT farther than without the patches however. The log file is 169MB! big so I am still trying to find out what the failure is.

Same thing for me. I applied the batch, and I now I passed the initial error, but got much more errors. Any solution for this!

comment:10 Changed 9 years ago by maehne (Torsten Maehne)

Cc: Torsten.Maehne@… added

Cc Me!

comment:11 Changed 9 years ago by ramundsen85

I ran into the same problem as mentioned before. This is due to a library which is not found by clang++:

:info:build [4153/10366] SOLINK(module) ffmpegsumo.so, POSTBUILDS
:info:build FAILED: if [ ! -e ffmpegsumo.so -o ! -e ffmpegsumo.so.TOC ] || otool -l ffmpegsumo.so | grep -q LC_REEXPORT_DYLIB ; then /usr/bin/clang++ -bundle -Wl,-search_paths_first -stdlib=libc++ -Wl,-dead_strip -mmacosx-version-min=10.7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -Lgen/third_party/ffmpeg -arch x86_64 -L. -o ffmpegsumo.so @ffmpegsumo.so.rsp && { otool -l ffmpegsumo.so | grep LC_ID_DYLIB -A 5; nm -gP ffmpegsumo.so | cut -f1-2 -d' ' | grep -v U$; true; } > ffmpegsumo.so.TOC; else /usr/bin/clang++ -bundle -Wl,-search_paths_first -stdlib=libc++ -Wl,-dead_strip -mmacosx-version-min=10.7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -Lgen/third_party/ffmpeg -arch x86_64 -L. -o ffmpegsumo.so @ffmpegsumo.so.rsp && { otool -l ffmpegsumo.so | grep LC_ID_DYLIB -A 5; nm -gP ffmpegsumo.so | cut -f1-2 -d' ' | grep -v U$; true; } > ffmpegsumo.so.tmp && if ! cmp -s ffmpegsumo.so.tmp ffmpegsumo.so.TOC; then mv ffmpegsumo.so.tmp ffmpegsumo.so.TOC ; fi; fi
:info:build clang: error: no such file or directory: '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/lib/libz.dylib'

The first one is libz.dylib from the log above, others will follow. A complete list:

  • libz.dylib
  • libssl.dylib
  • libcrypto.dylib
  • libresolv.dylib
  • libbsm.dylib
  • libcups.dylib

It seems that, beginning with Xcode 7, .tbd libraries instead of .dylib are used. Please refer to https://forums.developer.apple.com/message/8609#8609

For those who are curious, the .tbd files are new "text-based stub libraries", that provide a much more compact version of the stub libraries for use in the SDK, and help to significantly reduce its download size.

In the folder /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/lib/ only the .tbd version of the mentioned libraries is available, whereas the .dylib file can be found at /usr/lib.

According to the link above, adding a flag for every library might be a solution, but that didn't work for me. I also failed to include the /usr/lib path or the tbd suffix to the qmake environment by altering make.conf for the chosen platform macx-clang.

I could finish the build with symlinks from /usr/lib to the sysroot path set for clang++. But this is no proper solution to fix the Portfile, I guess.

comment:12 Changed 9 years ago by ramundsen85

Cc: framic5@… added

Cc Me!

comment:13 Changed 9 years ago by michaelld (Michael Dickens)

So the real issue here is not Apple's new TBD libraries. The issue is that this Qt module (qtwebengine) isn't looking for dependencies in the MacPorts ${prefix}. It has a bunch of hard-wired dependencies, which point to ${SDK}/usr/lib ... not even /usr/lib (which, as you say, might work). So, the better solution will be to get qtwebengine finding the libraries in the correct location.

comment:14 Changed 9 years ago by casey.webster@…

Replying to framic5@…:

I ran into the same problem as mentioned before. This is due to a library which is not found by clang++:

...

The first one is libz.dylib from the log above, others will follow. A complete list:

  • libz.dylib
  • libssl.dylib
  • libcrypto.dylib
  • libresolv.dylib
  • libbsm.dylib
  • libcups.dylib

I have the first three of those libraries in the macport tree provided by the 'openssl and zlib` packages, so you might try installing those and see if it helps. The last three I have in /usr/lib. Perhaps try installing openssl and zlib then attempt to build the port normally.

Version 0, edited 9 years ago by casey.webster@… (next)

comment:15 in reply to:  14 Changed 9 years ago by ramundsen85

Replying to casey.webster@…:

I have the first three of those libraries in the macport tree provided by the 'openssl and zlib` packages, so you might try installing those and see if it helps.

I have both ports installed, as dependency of qt5-mac. So, nothing changed. This provides libz.dylib, libssl.dylib, libcrypto.dylib in second location, ${prefix}/lib. (/opt/local/lib for me)

comment:16 Changed 9 years ago by michaelld (Michael Dickens)

These libraries are installed by MacPorts as dependencies of qt5-mac (and, qt4-mac too). The issue is in finding them. qtwebengine isn't "doing the right thing" here by hard-wiring where to find these when not using the internal version (provided inside qt5-mac).

comment:17 Changed 9 years ago by casey.webster@…

Ok, I was grasping at straws trying to reconcile why it builds for me and not others.

comment:18 Changed 9 years ago by michaelld (Michael Dickens)

NP. I've no idea why it would build for you & not others. It doesn't build for me because of the TBD libraries issue.

comment:19 Changed 9 years ago by anthonygelibert (Anthony Gelibert)

Cc: anthony.gelibert@… added

Cc Me!

comment:20 Changed 9 years ago by mkae (Marko Käning)

Cc: mk@… added

Cc Me!

comment:21 in reply to:  18 Changed 9 years ago by casey.webster@…

Replying to michaelld@…:

NP. I've no idea why it would build for you & not others. It doesn't build for me because of the TBD libraries issue.

Figured out it is building for me because my default python is 3.4. Qt runs a python script that bails on a print without parenthesis causing a SyntaxError to be raised and fails to retrieve a python version number. It then assumes python < 2.7 and disables qtwebengine from being built. That explains why I am "successfully" building Qt while others are running into errors in Qtwebengine.

cd qtwebengine/ && ( test -e Makefile || /opt/local/var/macports/build/_usr_local_ports_aqua_qt5-mac/qt5-mac/work/qt-everywhere-opensource-src-5.4.2/qtbase/bin/qmake /opt/local/var/macports/build/_usr_local_ports_aqua_qt5-mac/qt5-mac/work/qt-everywhere-opensource-src-5.4.2/qtwebengine/qtwebengine.pro -o Makefile ) && /Applications/Xcode.app/Contents/Developer/usr/bin/make -f Makefile
cd qttools/ && ( test -e Makefile || /opt/local/var/macports/build/_usr_local_ports_aqua_qt5-mac/qt5-mac/work/qt-everywhere-opensource-src-5.4.2/qtbase/bin/qmake /opt/local/var/macports/build/_usr_local_ports_aqua_qt5-mac/qt5-mac/work/qt-everywhere-opensource-src-5.4.2/qttools/qttools.pro -o Makefile ) && /Applications/Xcode.app/Contents/Developer/usr/bin/make -f Makefile
Info: creating cache file /opt/local/var/macports/build/_usr_local_ports_aqua_qt5-mac/qt5-mac/work/qt-everywhere-opensource-src-5.4.2/qttools/.qmake.cache
  File "<string>", line 1
    import sys; print sys.version_info.major
                        ^
SyntaxError: invalid syntax
  File "<string>", line 1
    import sys; print sys.version_info.minor
                        ^
SyntaxError: invalid syntax
Info: creating cache file /opt/local/var/macports/build/_usr_local_ports_aqua_qt5-mac/qt5-mac/work/qt-everywhere-opensource-src-5.4.2/qtwebengine/.qmake.cache

Using Python version ., but at least Python version 2.7 is required to build Qt WebEngine.
QtWebEngine will not be built.
% python --version
Python 3.4.3

comment:22 Changed 9 years ago by jakubzeman@…

Cc: jakubzeman@… added

Cc Me!

comment:23 Changed 9 years ago by jakubzeman@…

After applying the patches the build took much more time but at the end it failed. See attached lo (jzeman_main.log).

Changed 9 years ago by jakubzeman@…

Attachment: jzeman_main.log.gz added

comment:24 in reply to:  23 Changed 9 years ago by michaelld (Michael Dickens)

Replying to jakubzeman@…:

After applying the patches the build took much more time but at the end it failed. See attached lo (jzeman_main.log).

You're getting the TBD libraries issue, same as the rest of us. Maybe we should just disable building Qtwebengine? What's it used for anyway?

comment:25 Changed 9 years ago by jakubzeman@…

Here is a workaround:

sudo port install zlib openssl xorg-libsm libgnomecups
sudo su -
cd /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/lib
cp /usr/lib/libresolv.* .
cp /usr/lib/libbsm.* .
cp /usr/lib/libcups.* .
cp /usr/lib/libcrypto.* .
cp /usr/lib/libssl.* .
cp /usr/lib/libz.* .
Last edited 9 years ago by jakubzeman@… (previous) (diff)

comment:26 in reply to:  25 Changed 9 years ago by ramundsen85

Replying to jakubzeman@…:

Here is a workaround:

Certainly your workaround will work, but let me comment on this. Installing ports zlib openssl xorg-libsm libgnomecups is not necessary for this, because all libraries are installed in /opt/local/lib. All libraries are already available at /usr/lib without installing ports. Besides that, xorg-libsm provides libSM.dylib and not libbsm.dylib, libgnomecups provides libgnomecups-1.0.dylib and not libcups.dylib.

Instead of copying the libraries from /usr/lib I would recommend symlinks as mentioned above. For example with lib.dylib:

sudo ln -s /usr/lib/libz.dylib /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/lib/libz.dylib

comment:27 Changed 9 years ago by ramundsen85

After making some progress with manual changes for the first libraries, I found a general solution. The problem can be tracked down to hard-coded relations in the chromium part of qtwebengine. On the project page one can find a solution: https://codereview.qt-project.org/#/c/127759/

Until this change is included in a newer version of Qt5, a patch to chromium can be used. If no dylib variant is found in the sysroot path, the library tbd version is used. This allowed a successful build of qt5-mac for me.

Changed 9 years ago by ramundsen85

patch to chromium, try to use tbd library version if dylib is not available in sysroot path

Changed 9 years ago by ramundsen85

Attachment: Portfile-2.diff added

patch including Portfile.diff and chromium patch

comment:28 in reply to:  27 Changed 9 years ago by hardwhack

Replying to framic5@…:

Until this change is included in a newer version of Qt5, a patch to chromium can be used. If no dylib variant is found in the sysroot path, the library tbd version is used. This allowed a successful build of qt5-mac for me.

Applied patches and building.... still building.... how long will build take?...... looking good so far.... still building... cows back home.... good gravy, when will it end?.... can't hold .. on .. much.. longer.... put me out of my misery!

It worked! Thanks framic and casey and everyone else who contributes to Macports.

Edited: Rereading my reply, I see how you could interpret with irony and I did not intend any. The entire open source movement, of which Macports is a integral part for Mac users, is a great and noble human endeavor. I try to contribute with the meagre knowledge and skills I have (and kick in money here and there), but my hats off to you guys. If you guys are ever in Los Angeles, I'll buy you a beer.

Last edited 9 years ago by hardwhack (previous) (diff)

comment:29 Changed 9 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

Resolution: fixed
Status: newclosed

The upstream patch is now part of qt5 (r142505)

Note: See TracTickets for help on using tickets.