Opened 8 years ago

Last modified 8 years ago

#51844 closed defect

qt4-mac link error lc++ not found — at Version 10

Reported by: kenneth.f.cunningham@… Owned by: michaelld@…
Priority: Normal Milestone:
Component: ports Version: 2.3.4
Keywords: haspatch Cc: jeremyhu@…
Port: qt4-mac

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

MacOSX 10.6.8, is setup using LibcxxOnOlderSystems>

Installing qt4-mac fails with error -lc++ not found. Log attached.

Trying link manually, with verbose setting:

$ pwd
/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.7/src/tools/moc
$ /opt/local/bin/clang++-mp-3.7 -v -L/opt/local/lib -Wl,-headerpad_max_install_names -stdlib=libc++ -arch x86_64 -Wl,-syslibroot,/Xcode3/SDKs/MacOSX10.6.sdk -Xarch_x86_64 -mmacosx-version-min=10.6 -Xarch_x86_64 -mmacosx-version-min=10.6 -o ../../../bin/moc release-shared/moc.o release-shared/preprocessor.o release-shared/generator.o release-shared/parser.o release-shared/token.o release-shared/main.o    -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.7/src/tools/bootstrap -lbootstrap -framework CoreServices -framework ApplicationServices -lz -lz
clang version 3.7.1 (tags/RELEASE_371/final)
Target: x86_64-apple-darwin10.8.0
Thread model: posix
 "/opt/local/libexec/llvm-3.7/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.6.0 -o ../../../bin/moc -lcrt1.10.6.o -L/opt/local/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.7/src/tools/bootstrap -headerpad_max_install_names -syslibroot /Xcode3/SDKs/MacOSX10.6.sdk release-shared/moc.o release-shared/preprocessor.o release-shared/generator.o release-shared/parser.o release-shared/token.o release-shared/main.o -lbootstrap -framework CoreServices -framework ApplicationServices -lz -lz -lc++ -lSystem /opt/local/libexec/llvm-3.7/bin/../lib/clang/3.7.1/lib/darwin/libclang_rt.osx.a
ld: library not found for -lc++
clang: error: linker command failed with exit code 1 (use -v to see invocation)

libc++ is present in /usr/local, and other ports seem to install OK.

$ pwd
/usr/lib
$ ls -la libc*
-rwxr-xr-x  1 root  admin  1186580 12 Jan  2016 libc++.1.dylib
lrwxr-xr-x  1 root  admin       14 12 Jan  2016 libc++.dylib -> libc++.1.dylib
-rwxr-xr-x  1 root  admin   431040 24 Nov  2015 libc++abi.dylib
lrwxr-xr-x  1 root  wheel       15 25 Feb  2015 libc.dylib -> libSystem.dylib

might be related to this ticket but seems different, as "-stdlib=libc++" seems to be present in the command line above.

My macports.conf relevant part:

# $Id: macports.conf.in 117120 2014-02-17 00:55:33Z jmr@macports.org $

cxx_stdlib         libc++
buildfromsource    always
delete_la_files    yes
default_compilers  macports-clang-3.7 macports-clang-3.4 macports-clang-3.3 gcc-4.2 apple-gcc-4.2 gcc-4.0
build_arch         x86_64

Thanks.

Change History (12)

Changed 8 years ago by kenneth.f.cunningham@…

Attachment: main.log.bz2 added

comment:1 Changed 8 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Resolution: wontfix
Status: newclosed

You're using an SDK (-syslibroot /Xcode3/SDKs/MacOSX10.6.sdk). The libc++ port installs to the system, not the SDK. That's not something we support very well. I suggest you use the system libraries and headers.

comment:2 Changed 8 years ago by kenneth.f.cunningham@…

Thanks Jeremy -- immediate insight as always -- indeed, the qt4-mac port file injects a reference to an SDK into configure that messes up the build on this platform.

This can be overridden with "sudo port install qt4-mac configure.sdkroot="/" which then does get past the lc++ errors.

(another error then crops up with a missing libobjc which is a separate issue).

comment:3 Changed 8 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Resolution: wontfix
Status: closedreopened

Ok, then lets reopen this as an issue with qt4-mac if it's not honoring the correct settings and going off and using the SDK on its own.

comment:4 Changed 8 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Cc: michaelld@… removed
Owner: changed from macports-tickets@… to michaelld@…
Status: reopenednew

comment:5 Changed 8 years ago by kenneth.f.cunningham@…

Michael -- I think the issue might come down to some kind of a test to see if a user is running an installation with LibcxxOnOlderSystems. If so, the SDK setting in the portfile's logic for this can be adjusted (unset, basically).

There are several other build issues I had to then overcome with Makefile adjustments besides this issue to get qt4-mac to build. List them here, or separate tickets - or email them to you directly?

Last edited 8 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:6 Changed 8 years ago by kenneth.f.cunningham@…

OK - I realize now that the qt4-mac portfile is incredibly complicated. I suspect that the underlying issue could be that the mkspec chosen for this platform doesn't take into account the libc++ modification done to 10.6.8. It chooses macx-g++ as the mkspec, and (deference here to someone who knows better) might better be choosing macx-clang-libc++.

To compile it as it is, I did

"sudo port install qt4-mac configure.sdkroot="/"

to get started, then manually altered a couple of Makefiles to correct errors

in src/corelib/Makefile

add -lobjc to
LFLAGS        = -L/opt/local/lib -lobjc -Wl,-headerpad_max_install_names -stdlib=libc++ -Wl,-syslibroot,/ -arch x86_64 -Wl,-syslibroot,/ -single_module -dynamiclib -compatibility_version	4.8 -current_version	4.8.7 -install_name	/opt/local/libexec/qt4/Library/Frameworks/QtCore.framework/Versions/4/QtCore -Xarch_x86_64 -mmacosx-version-min=10.6 -Xarch_x86_64 -mmacosx-version-min=10.6

and

in src/plugins/bearer/corewlan/Makefile

add -framework Security 
LIBS          = $(SUBLIBS) -F/System/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.7/lib  -framework Foundation -framework SystemConfiguration -framework CoreWLAN -F/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.7/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.7/lib -framework QtNetwork -framework QtCore -framework Security

I believe that was all that was needed.

comment:7 Changed 8 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Is there a particular reason you are trying to install qt4? It was last touched about 5 years ago. Most clients moved on to qt5 years ago.

comment:8 Changed 8 years ago by kenneth.f.cunningham@…

It's a requirement of the most recent version of OpenSCAD, which apparently hasn't yet been brought up to QT5.

comment:9 Changed 8 years ago by kenneth.f.cunningham@…

Jeremy and Michael -- here's a diff file for the qt4-mac Portfile that successfully builds on snowleopard with libcxx installed. I made it specific for snowleopard - but it's possible that 10.7 and 10.8 with libc++ enabled might need to use it as well.

Changed 8 years ago by kenneth.f.cunningham@…

Attachment: qt4-SL-Libcxx-fix.diff added

Fix to build qt4-mac on snowleopard with libcxx installed

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

Description: modified (diff)
Keywords: haspatch added
Note: See TracTickets for help on using tickets.