Opened 12 years ago

Closed 12 years ago

#36339 closed defect (fixed)

qt4-mac does not work with clang 3.0 or older

Reported by: bgschaid@… Owned by: michaelld (Michael Dickens)
Priority: Normal Milestone:
Component: ports Version: 2.1.2
Keywords: Cc:
Port: qt4-mac

Description

During a regular upgrade compilation fails because during linking the library -ldbus-1 is not found. My guess is that the compiler (/usr/bin/clang) does not automatically search /opt/local/lib (there is no -L-entry pointing to that).

I copy the call in question into the description and attach the log-file separately

:info:build /usr/bin/clang++ -headerpad_max_install_names -arch x86_64 -Wl,-syslibroot,/Applications/Xc
ode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -single_module -dyna
miclib -compatibility_version     4.8 -current_version    4.8.3 -install_name     /opt/local/Library/Fr
ameworks/QtDBus.framework/Versions/4/QtDBus -Xarch_x86_64 -mmacosx-version-min=10.7 -Xarch_x86_64 -mmac
osx-version-min=10.7 -o QtDBus .obj/release-shared/qdbusconnection.o .obj/release-shared/qdbusconnectio
ninterface.o .obj/release-shared/qdbuserror.o .obj/release-shared/qdbusintegrator.o .obj/release-shared
/qdbusmessage.o .obj/release-shared/qdbusserver.o .obj/release-shared/qdbusabstractinterface.o .obj/rel
ease-shared/qdbusinterface.o .obj/release-shared/qdbusxmlparser.o .obj/release-shared/qdbusutil.o .obj/
release-shared/qdbusintrospection.o .obj/release-shared/qdbusabstractadaptor.o .obj/release-shared/qdbusinternalfilters.o .obj/release-shared/qdbusmetaobject.o .obj/release-shared/qdbusxmlgenerator.o .obj/release-shared/qdbusmisc.o .obj/release-shared/qdbusargument.o .obj/release-shared/qdbusreply.o .obj/release-shared/qdbusmetatype.o .obj/release-shared/qdbusextratypes.o .obj/release-shared/qdbuscontext.o .obj/release-shared/qdbuspendingcall.o .obj/release-shared/qdbuspendingreply.o .obj/release-shared/qdbus_symbols.o .obj/release-shared/qdbusservicewatcher.o .obj/release-shared/qdbusunixfiledescriptor.o .obj/release-shared/qdbusvirtualobject.o .obj/release-shared/moc_qdbusconnectioninterface.o .obj/release-shared/moc_qdbusserver.o .obj/release-shared/moc_qdbusconnection.o .obj/release-shared/moc_qdbusabstractadaptor.o .obj/release-shared/moc_qdbusvirtualobject.o .obj/release-shared/moc_qdbusconnection_p.o .obj/release-shared/moc_qdbuspendingcall_p.o  -F/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_aqua_qt4-mac/qt4-mac/work/qt-everywhere-opensource-src-4.8.3/Library/Frameworks -F/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_aqua_qt4-mac/qt4-mac/work/qt-everywhere-opensource-src-4.8.3/lib  -F/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_aqua_qt4-mac/qt4-mac/work/qt-everywhere-opensource-src-4.8.3/Library/Frameworks -F/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_aqua_qt4-mac/qt4-mac/work/qt-everywhere-opensource-src-4.8.3/lib -L/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_aqua_qt4-mac/qt4-mac/work/qt-everywhere-opensource-src-4.8.3/lib -framework QtXml -framework QtCore -ldbus-1 -lpthread 
:info:build ld: warning: directory not found for option '-F/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_aqua_qt4-mac/qt4-mac/work/qt-everywhere-opensource-src-4.8.3/Library/Frameworks'
:info:build ld: warning: directory not found for option '-F/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_aqua_qt4-mac/qt4-mac/work/qt-everywhere-opensource-src-4.8.3/Library/Frameworks'
:info:build ld: library not found for -ldbus-1
:info:build clang: error: linker command failed with exit code 1 (use -v to see invocation)
:info:build make[1]: *** [../../lib/QtDBus.framework/QtDBus] Error 1

Attachments (3)

qt4-mac-main.log (13.6 KB) - added by bgschaid@… 12 years ago.
qt4-mac-main-mp-clang.log (1.7 MB) - added by bgschaid@… 12 years ago.
Compilation log with mp-clang-3.2
qt4-mac.XCode4.5.main.log.gz (51.9 KB) - added by bgschaid@… 12 years ago.
Failure with XCode 4.5 and OS X 10.7

Download all attachments as: .zip

Change History (21)

Changed 12 years ago by bgschaid@…

Attachment: qt4-mac-main.log added

comment:1 Changed 12 years ago by bgschaid@…

Installed the MacPorts-clang (3.2) and chose it with select.

Now there is a different failure (and the reason is not as obvious to me). I'll attach a log

Anyway: I think that the port should either list a working clang as a requirement or add the -L/opt/local/lib-option so that it plays nicely with the Apple-clang

Changed 12 years ago by bgschaid@…

Attachment: qt4-mac-main-mp-clang.log added

Compilation log with mp-clang-3.2

comment:2 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Owner: changed from macports-tickets@… to michaelld@…

The first log you attached is incomplete (contains lines that say "Skipping completed") so we cannot learn much from it. Always clean and try again before filing a bug report.

You did not state which version of Xcode you have. But it is true that older versions of clang did not support the LIBRARY_PATH environment variable that MacPorts sets, and rely instead of proper -L flags being passed in LDFLAGS. MacPorts also tries to set up -L flags, but perhaps qt4-mac doesn't honor that. We should fix qt4-mac to use proper -L flags. You should be able to work around it by upgrading to Xcode 4.4 or 4.5; we recommend using the latest released Xcode version anyway.

Selecting a different compiler is intended for use by you for compiling your own software; it is not intended for MacPorts to use such a compiler when compiling ports. See UsingTheRightCompiler.

comment:3 in reply to:  2 Changed 12 years ago by bgschaid@…

Replying to ryandesign@…:

The first log you attached is incomplete (contains lines that say "Skipping completed") so we cannot learn much from it. Always clean and try again before filing a bug report.

Sorry. Will do the next time

You did not state which version of Xcode you have. But it is true that older versions of clang did not support the LIBRARY_PATH environment variable that MacPorts sets, and rely instead of proper -L flags being passed in LDFLAGS. MacPorts also tries to set up -L flags, but perhaps qt4-mac doesn't honor that. We should fix qt4-mac to use proper -L flags. You should be able to work around it by upgrading to Xcode 4.4 or 4.5; we recommend using the latest released Xcode version anyway.

I just checked. My current version is Xcode 4.4.1 so 4.4.x doesn't honor the LIBRARY_PATH too. Will upgrade to 4.5 (wasn't aware that it is out) ASAP and retry

Selecting a different compiler is intended for use by you for compiling your own software; it is not intended for MacPorts to use such a compiler when compiling ports. See UsingTheRightCompiler.

OK. That was just a trying that because at the time it seemed to be the best explantation "if -L/opt/local/lib is not set then the person making the port used a MacPorts-compiler". 2 weeks ago my Xcode-version was up-to-date according to the AppStore (seems like the official release for 4.5 was Sept.19th) and I don't check that too often

comment:4 Changed 12 years ago by michaelld (Michael Dickens)

When you upload a log file, try to remember to compress it first -- you'd be surprised how small even qt4-mac's can get! Not the end of the world if you don't, but for those of us with "slow" internet every little bit helps.

I've now upgraded to XCode 4.5.0, and will try this issue out. Clang was originally blocked as a compiler because it did not honor CPATH or LIBRARY_PATH; seems like that might still be an issue.

comment:5 Changed 12 years ago by michaelld (Michael Dickens)

The "mp-clang-3.2" log file shows that MacPorts actually provided Apple's clang instead of MacPorts' clang. Go figure.

Someone else using 10.8.2 and XCode 4.5.0's clang reports success compiling qt4-mac with that compiler; Qt 4.8 isn't meant to work with clang yet, but it might work. Hopefully Qt 5.0 will add mkspec files for clang for macx. In the mean time, hopefully upgrading to XCode 4.5.0's clang helped. In my initial testing, this version of clang seems to be working as expected.

comment:6 in reply to:  5 Changed 12 years ago by bgschaid@…

Replying to michaelld@…:

The "mp-clang-3.2" log file shows that MacPorts actually provided Apple's clang instead of MacPorts' clang. Go figure.

Sorry. Haven't checked that

Someone else using 10.8.2 and XCode 4.5.0's clang reports success compiling qt4-mac with that compiler; Qt 4.8 isn't meant to work with clang yet, but it might work. Hopefully Qt 5.0 will add mkspec files for clang for macx. In the mean time, hopefully upgrading to XCode 4.5.0's clang helped. In my initial testing, this version of clang seems to be working as expected.

Updated to XCode 4.5 (but still am on 10.7) and it still fails in the same way

  • can't find the jpeg and the tiff-library (although they're installed)
  • fails while linking dbus-1

I tried to trick the linking process by creating symolic links from the /opt/local/lib/libdbus* into /usr/lib but the error message stay the same. When I go to the build directory and hand-run the failing command the message stays the same. If I add -L/opt/local/lib it links without problems

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

Can you upload the log file for the latest failure?

Changed 12 years ago by bgschaid@…

Failure with XCode 4.5 and OS X 10.7

comment:8 in reply to:  7 Changed 12 years ago by bgschaid@…

Replying to michaelld@…:

Can you upload the log file for the latest failure?

Done (and this time zipped and after a clean .... )

This is the one without the symbolic links in /usr/lib (I think you meant that)

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

Thanks. What does "/usr/bin/clang --version" return?

comment:10 in reply to:  9 Changed 12 years ago by bgschaid@…

Replying to michaelld@…:

Thanks. What does "/usr/bin/clang --version" return?

Apple clang version 3.1 (tags/Apple/clang-318.0.54) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.4.2
Thread model: posix

comment:11 Changed 12 years ago by michaelld (Michael Dickens)

OK; thanks. What a pain: XCode 4.5.0 on 10.8.2 returns "Apple clang version 4.1". So, different default clang for different OS versions using the same XCode. I'll check in an update that should fix this issue with the next iteration of qt4-mac changes; hopefully later today. I've got to work out the "logic" behind when to use clang and when not to.

comment:12 Changed 12 years ago by michaelld (Michael Dickens)

In the mean time, if you want to compile qt4-mac, you can append "configure.compiler=llvm-gcc-4.2" to your "install qt4-mac" command line.

comment:13 in reply to:  12 Changed 12 years ago by bgschaid@…

Replying to michaelld@…:

In the mean time, if you want to compile qt4-mac, you can append "configure.compiler=llvm-gcc-4.2" to your "install qt4-mac" command line.

Thanks. But as this is merely an upgrade (I was just upgrading because it is there. Currently everything is working for me). I'll stick with the outdated version and give you feedback once it starts working again

comment:14 Changed 12 years ago by michaelld (Michael Dickens)

I'm almost there; should be today I do this checkin. I'm wondering: After you "upgraded" XCode.app via the Apple App Store, did you start it up and re-install the command-line tools? After I upgraded from 4.4 to 4.5, I had to do this manually before "/usr/bin/clang" was upgraded. Not sure why, or if maybe this would have self-re-installed without me doing the manual, but my doing so did change the Apple clang version installed.

comment:15 Changed 12 years ago by bgschaid@…

Sorry for sending you on a wild goose chase.

I started XCode after updating it from the AppStore and then a progress appeared with something about "System files being updated". So I assumed that these were the command line utilities. But obviously it was not and I had to upgrade them via the settings-dialog (I don't remember doing this the last time). Anyway. reported version is now

Apple clang version 4.1 (tags/Apple/clang-421.11.65) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.4.2
Thread model: posix

and compilation works. If you want the log from that (or only the header of this) say so

Well. The basic problem that old clang is not correctly detected by cmake still remains.

Unrelated rant: Am I the only one who thinks that maintaining a Mac is more complicated than keeping a Linux-machine up to date? "yum update" (or so) and the compiler, the system and everything is updated ... Sorry. I'm finished

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

Summary: -ldbus-1 not found during building of qt4-mac@4.8.3qt4-mac does not work with clang older than 4.0

No problems; it was productive for me and I -guarantee- that without changing the clang blocklist I'll get ticket on that subject sooner or later. So, I'll just get it over with sooner :)

Yes, updating OSX is more complicated than Linux, in a general sense. I've worked with Macs for coming up 30 years and Linux off and on for about 15 years now, and while things have improved in both worlds I'd say Linux is the easier to work with overall in terms of system maintenance. Of course, I can't do everything on Linux that I need to be able to do, so I have to compete with OSX too. I refuse to compete with Windows any longer, so at least that headache is removed ...

comment:17 Changed 12 years ago by michaelld (Michael Dickens)

Summary: qt4-mac does not work with clang older than 4.0qt4-mac does not work with clang 3.0 or older

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

Resolution: fixed
Status: newclosed

Done in r98334.

Note: See TracTickets for help on using tickets.