[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-buildsystem
Subject:    Re: using check_cxx_source_runs
From:       Leo Franchi <lfranchi () kde ! org>
Date:       2009-03-12 19:55:20
Message-ID: 8EC258CA-4470-4561-BD31-B6E27EDD9938 () kde ! org
[Download RAW message or body]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 12 Mar 2009, at 19:49, Alexander Neundorf wrote:

> On Thursday 12 March 2009, Leo Franchi wrote:
>> hey,
>>
>> sorry for the new thread, i just subscribed. i can't figure out how  
>> to
>> set the library path for the linker, so no matter what I do it always
>> fails to find -lQtScript. in the cmake docs i see i can set the vars
>> CMAKE_REQUIRED_FLAGS, CMAKE_REQUIRED_DEFINITIONS,
>> CMAKE_REQUIRED_INCLUDES, and CMAKE_REQUIRED_LIBRARIES, but even  
>> though
>> I add the libraries I want to link to the CMAKE_REQUIRED_LIBRARIES
>> variable, the paths that are needed to find them are not there.
>>
>> i'm pretty sure i'm missing something very basic, but I can't get the
>> test program to compile.
>
> Can you please post a minimal example ?
> So I can just try and see what goes wrong ?


Yep, so the source that we are trying to compile is this:
*
  * Copyright (C) 2009 Ian Monroe <ian@monroe.nu>
  * released under public domain or:
(snipped)
*/

#include <KDE/KApplication>
#include <KDE/KAboutData>
#include <KDE/KCmdLineArgs>
#include <QtScript/QScriptEngine>
#include <QtCore/QStringList>

#define FAIL 0xA

int main(int argc, char **argv)
{
     KAboutData about( "findgeneratorplugins", "", ki18n("Generator  
Exists?"), "1.0", ki18n("Find if the QtScript Plugins Are Installed"),  
KAboutData::License_LGPL_V2 );
     KCmdLineArgs::init( argc, argv, &about );
     KApplication app;

     QStringList allowedBindings;
     allowedBindings << "qt.core" << "qt.gui" << "qt.sql" << "qt.xml"  
<< "qt.uitools" << "qt.network";
     QScriptEngine engine;
     foreach( QString binding, allowedBindings )
     {
         if( !engine.importExtension( binding ).isUndefined() )
         { // undefined indiciates success
             qDebug( binding.toLatin1() +  " not found" );
             return FAIL;
         }
     }
     return 0;
}


and the cmake stuff is this:

include(CheckCXXSourceRuns)

file( READ "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/ 
QtScriptBindingsTest.cpp" source )
message(STATUS "Checking if the QtScript Qt Bindings are installed.")

#set( BINDINGS_RUN_RESULT -10 )
set(CMAKE_REQUIRED_DEFINTIONS ${QT_DEFINITIONS} ${KDE4_DEFINITIONS} )
set(CMAKE_REQUIRED_INCLUDES ${QT_QTCORE_INCLUDE_DIR} $ 
{QT_QTSCRIPT_INCLUDE_DIR} ${KDE4_INCLUDES})
set(CMAKE_REQUIRED_LIBRARIES QtScript kdeui)
message( STATUS "includes ${CMAKE_REQUIRED_INCLUDES} libraries $ 
{CMAKE_REQUIRED_LIBRARIES}" )
CHECK_CXX_SOURCE_RUNS( "${source}" BINDINGS_RUN_RESULT)

here is the output of the cmake run (from CMakeError.log):

Building CXX object CMakeFiles/cmTryCompileExec.dir/src.cxx.o
/usr/bin/g++-4.2    -fno-common -Woverloaded-virtual - 
fvisibility=hidden -fvisibility-inlines-hidden  -DBINDINGS_RUN_RESULT - 
I/opt/ports/include/taglib -I/opt/ports/libexec/qt4-mac/include/QtCore  
- -I/opt/ports/libexec/qt4-mac/include/QtScript -I/opt/ports/include -I/ 
opt/ports/include/KDE -I/opt/ports/libexec/qt4-mac/include/phonon -I/ 
opt/ports/libexec/qt4-mac/include/QtXmlPatterns -I/opt/ports/libexec/ 
qt4-mac/include/QtWebKit -I/opt/ports/libexec/qt4-mac/include/QtHelp - 
I/opt/ports/libexec/qt4-mac/include/QtAssistant -I/opt/ports/libexec/ 
qt4-mac/include/QtDBus -I/opt/ports/libexec/qt4-mac/include/QtTest -I/ 
opt/ports/libexec/qt4-mac/include/QtUiTools -I/opt/ports/libexec/qt4- 
mac/include/QtSvg -I/opt/ports/libexec/qt4-mac/include/QtXml -I/opt/ 
ports/libexec/qt4-mac/include/QtSql -I/opt/ports/libexec/qt4-mac/ 
include/QtOpenGL -I/opt/ports/libexec/qt4-mac/include/QtNetwork -I/opt/ 
ports/libexec/qt4-mac/include/QtDesigner -I/opt/ports/libexec/qt4-mac/ 
include/Qt3Support -I/opt/ports/libexec/qt4-mac/include/QtGui -I/opt/ 
ports/libexec/qt4-mac/include/Qt -I/opt/ports/libexec/qt4-mac/mkspecs/ 
default -I/opt/ports/libexec/qt4-mac/include   -o CMakeFiles/ 
cmTryCompileExec.dir/src.cxx.o -c /Users/leofranchi/kde/amarok-build/ 
CMakeFiles/CMakeTmp/src.cxx
Linking CXX executable cmTryCompileExec
/opt/ports/bin/cmake -E cmake_link_script CMakeFiles/ 
cmTryCompileExec.dir/link.txt --verbose=1
/usr/bin/g++-4.2     -fno-common -Woverloaded-virtual - 
fvisibility=hidden -fvisibility-inlines-hidden  -DBINDINGS_RUN_RESULT - 
I/opt/ports/include/taglib -Wl,-search_paths_first - 
headerpad_max_install_names -fPIC CMakeFiles/cmTryCompileExec.dir/ 
src.cxx.o  -o cmTryCompileExec  -lQtScript -lkdeui
ld: library not found for -lQtScript
collect2: ld returned 1 exit status
gmake[2]: Leaving directory `/Users/leofranchi/kde/amarok-build/ 
CMakeFiles/CMakeTmp'
gmake[1]: Leaving directory `/Users/leofranchi/kde/amarok-build/ 
CMakeFiles/CMakeTmp'
gmake[2]: *** [cmTryCompileExec] Error 1
gmake[1]: *** [cmTryCompileExec/fast] Error 2

cheers,
leo

- ---
Leo Franchi				(650) 704 3680
Tufts University 2010

lfranchi@kde.org
leonardo.franchi@tufts.edu

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.10 (Darwin)

iEYEARECAAYFAkm5aKkACgkQDIxsnB9isr8qqgCcCRj1p42ZFYqBLe/4tDOBwcr1
m20AoKOeLqA7DLK6WWfjAnG1V6JWzYY3
=c1ng
-----END PGP SIGNATURE-----
_______________________________________________
Kde-buildsystem mailing list
Kde-buildsystem@kde.org
https://mail.kde.org/mailman/listinfo/kde-buildsystem
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic