Solved qt5.4.1 missing lQt5Gui - with clang++

I compiled QT 5.4.1 from ports devel/qt5 and also the x11/qt5-x11extras

I added qmake as a global variable, and now I'm trying to compile a very basic test.cpp file that looks like this:

Code:
#include <QTextStream>
#include <QDebug>

QTextStream cin(stdin);
QTextStream cout(stdout);
QTextStream cerr(stderr);

int main() {

    int num1(1234), num2(2345);
    cout << oct << num2 << '\t'
        << hex << num1 << '\t';
    qDebug() << "QDebug, the same idea using <<";
    qDebug("QDebug with place holders: %d ", num1);

    return 0;

}

I use: qmake -project to create a .pro qt file, then I use qmake to create a MakeFile. Then, when I run make I get the following error:

Code:
clang++ -pthread -Wl,-rpath,/usr/local/lib -o qt main.o   -lQt5Gui -lQt5Core -lGL
/usr/bin/ld: cannot find -lQt5Gui
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
*** Error code 1

Stop.

I understand, based on this error, that the lQt5Gui is missing. I'm not sure at what point I skipped this lib. What am I doing wrong ? How can I add the lQt5Gui lib. ?

This is the .pro file:
Code:
######################################################################
# Automatically generated by qmake (3.0) Sun May 3 21:54:13 2015
######################################################################

TEMPLATE = app
TARGET = qt
INCLUDEPATH += .

# Input
SOURCES += main.cpp

I've tried to attach the MakeFile in here, but it seems it exceeds the maximum number of characters allowed per post. If it's needed, however, I can annex it separately.
 
I don't think you are doing anything wrong. It doesn't work here (FreeBSD 10.1) either, but it should.

I have installed lang/clang35 and added
Code:
QMAKE_CXX=clang++35
QMAKE_LINK=clang++35
to the project file to make it work...

EDIT: The actual problem seems to be with the system linker /usr/bin/ld. As a test I've replaced it with a newer version and then everything works with the system compiler without the QMAKE_* lines. But that is hardly a solution... ld in FreeBSD base is pretty old.
 
This is great information. I'll try to install clang35 and also update ld and see how that goes. Thanks tobik. I'll come back with updates shortly.

Update: I'm trying to uninstall clang33 (which seems to be my default version). The pkg does not acknowledge the existence of clang(xx) in any shape or flavor, so I assume, it was not installed as a binary pkg. I went to /usr/ports/lang/clang33 and attempted make desinstall, but make does not know of any clang installation either. I'm not sure how it was pushed into the:
Code:
 10.0-RELEASE FreeBSD 10.0-RELEASE #0 r260789
I'd like to be able to remove clang33 before installing clang35(or 36). So, I'm currently installing clang33 from ports and then planning to uninstall it, which seems a bit silly.

Update: I installed clang36 from ports and added the two options you suggested in the .pro file. I created a new Makefile file that now uses clang++36 instead. The error persists. On clang --version I get back:
Code:
FreeBSD clang version 3.3 (tags/RELEASE_33/final 183502) 20130610
Target: x86_64-unknown-freebsd10.0
Thread model: posix
I wonder if this has anything to do with it. Shouldn't it return version 3.6 ? Also, as an alternative, how do I update ld? It doesn't seem to be in the ports (at least I can't find it).
 
Update: I'm trying to uninstall clang33 (which seems to be my default version). The pkg does not acknowledge the existence of clang(xx) in any shape or flavor, so I assume, it was not installed as a binary pkg. I went to /usr/ports/lang/clang33 and attempted make desinstall, but make does not know of any clang installation either. I'm not sure how it was pushed into the:
Code:
 10.0-RELEASE FreeBSD 10.0-RELEASE #0 r260789
I'd like to be able to remove clang33 before installing clang35(or 36). So, I'm currently installing clang33 from ports and then planning to uninstall it, which seems a bit silly.

The base system (practically everything else but /usr/local/*) is not under ports-mgmt/pkg control in any way. This means only /usr/local/* contents can be installed/deinstalled with pkg(8). Don't bother trying to uninstall the base system compiler, install the newer compiler you want to use from ports/packager and tell the build utilities you're using to use the compiler from /usr/local. Usually you just set CC to /usr/local/bin/clang36 (and same for CXX etc.).

The reason you are still seeing 3.3 as the version in clang --version is because the lang/clang36 port doesn't install an executable named clang, only /usr/local/bin/clang36. This is to avoid a name clash between the port and the base system compiler.
 
Back
Top