Results 1 to 4 of 4

Thread: change linker in qmake

  1. #1
    Join Date
    Dec 2009
    Posts
    4
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default change linker in qmake

    hello,

    i want to use another linker than g++ in qmake,
    i find that i can change the compiler my defining something as:
    QMAKE_CXX=mpicxx
    but it works only for doing the object files .o ,for the last step ,linking, Qt
    still use g++ and i got some error then:

    [dma@maestro sphere]$ make
    mpicxx -c -pipe -Wall -W -O2 -g -pipe -m64 -DNO_GRAPHIC -DNO_TEXT -DOPTIM -DMPICH_IGNORE_CXX_SEEK -DSPHERE_MPI -DQT_NO_DEBUG -DQT_SHARED -DQT_THREAD_SUPPORT -I/usr/lib64/qt-3.3/mkspecs/default -I. -I. -I/usr/local/CCfits -I/usr/local/include/CCfits -I/usr/local/cfitsio -I/usr/include/CCfits -I/usr/local/boost_1_42_0 -I/usr/local/include -I/usr/lib64/qt-3.3/include -o sphere.o sphere.cpp
    In file included from sphere.cpp:48:
    interp_1d.h:165: warning: `struct Spline_interp' has virtual functions but non-virtual destructor
    interp_1d.h:221: warning: `struct BaryRat_interp' has virtual functions but non-virtual destructor
    In file included from sphere.cpp:50:
    interp_2d.h: In constructor `Spline2D_interp::Spline2D_interp(const VecDoub_I&, const VecDoub_I&, const MatDoub_I&)':
    interp_2d.h:48: warning: `Spline2D_interp::yv' will be initialized after
    interp_2d.h:47: warning: `const VecDoub&Spline2D_interp::x1'
    interp_2d.h:52: warning: when initialized here
    In file included from main_computation.cpp:18,
    from scanning.cpp:103,
    from sphere.cpp:164:
    computation_optim.cpp: In function `int main(int, char**)':
    computation_optim.cpp:7: warning: ignoring #pragma omp parallel
    In file included from sphere.cpp:164:
    scanning.cpp:84: warning: unused variable 'start'
    scanning.cpp:106: warning: unused variable 'stop'
    PSF_cartesian_centered.cpp:66: warning: unused variable 'idx0'
    PSF_cartesian_centered.cpp:67: warning: unused variable 'idx1'
    psf_interpolation.cpp:42: warning: unused variable 'psf_real'
    scanning.cpp:121: warning: label `label' defined but not used
    interp_1d.h: At global scope:
    interp_1d.h:253: warning: unused parameter 'jl'
    sphere.cpp: In function `int main(int, char**)':
    sphere.cpp:76: warning: 'rank' might be used uninitialized in this function
    g++ -o sphere FitsImage.o rgb.o sphere.o -L/usr/lib64/qt-3.3/lib -L/usr/X11R6/lib64 -L/opt/fontconfig-2.4.2/lib -L/usr/local/cfitsio -L/usr/local/cfitsio/lib -lCCfits -lcfitsio -L/usr/local/lib -lqt-mt -lXext -lX11 -lm
    sphere.o(.text+0x19e5): In function `main':
    /user3/dma/sphere/sphere.cpp:71: undefined reference to `MPI::Init(int&, char**&)'
    sphere.o(.text+0x19eb): In function `main':
    /opt/mpich2-1.0.4p1/src/include/mpicxx.h:1227: undefined reference to `MPI::ERRORS_THROW_EXCEPTIONS'
    sphere.o(.text+0x19f1):/opt/mpich2-1.0.4p1/src/include/mpicxx.h:1227: undefined reference to `MPI::COMM_WORLD'
    sphere.o(.text+0x19f6):/opt/mpich2-1.0.4p1/src/include/mpicxx.h:1227: undefined reference to `MPI_Comm_set_errhandler'
    sphere.o(.text+0x1a06):/opt/mpich2-1.0.4p1/src/include/mpicxx.h:1116: undefined reference to `MPI::COMM_WORLD'
    sphere.o(.text+0x1a13):/opt/mpich2-1.0.4p1/src/include/mpicxx.h:1116: undefined reference to `MPI_Comm_rank'
    sphere.o(.text+0x1a31):/opt/mpich2-1.0.4p1/src/include/mpicxx.h:1216: undefined reference to `MPI::COMM_WORLD'
    sphere.o(.text+0x1a3e):/opt/mpich2-1.0.4p1/src/include/mpicxx.h:1216: undefined reference to `MPI_Comm_size'
    sphere.o(.text+0x1d77):/opt/mpich2-1.0.4p1/src/include/mpicxx.h:123: undefined reference to `MPI_Error_string'
    sphere.o(.text+0x4d45): In function `main':
    /user3/dma/sphere/sphere.cpp:208: undefined reference to `MPI::Finalize()'
    collect2: ld returned 1 exit status
    make: *** [sphere] Error 1
    so i have to link manually as this :
    [dma@maestro sphere]$ mpicxx -o sphere FitsImage.o rgb.o sphere.o -L/usr/lib64/qt-3.3/lib -L/usr/X11R6/lib64 -L/opt/fontconfig-2.4.2/lib -L/usr/local/cfitsio -L/usr/local/cfitsio/lib -lCCfits -lcfitsio -L/usr/local/lib -lXext -lX11 -lm

    here is my .pro file:

    ################################################## ####################
    # Automatically generated by qmake (2.01a) ven. déc. 4 10:29:59 2009
    ################################################## ####################

    TEMPLATE = app
    TARGET =
    DEPENDPATH += .
    INCLUDEPATH += .
    INCLUDEPATH += /usr/local/CCfits
    INCLUDEPATH += /usr/local/include/CCfits
    INCLUDEPATH += /usr/local/cfitsio
    INCLUDEPATH += /usr/include/CCfits # on vegadrs.obs-azur.fr
    INCLUDEPATH += /usr/local/boost_1_42_0 # include mpi support
    INCLUDEPATH += /usr/local/include
    DEFINES = NO_GRAPHIC NO_TEXT OPTIM MPICH_IGNORE_CXX_SEEK SPHERE_MPI #VIEW # due to a bug in MPI 2 standart

    # Input
    HEADERS += FitsImage.h rgb.h type_definition.h sphere.h cpm.h \
    get_image_number_in_file.cpp PSF_cartesian_centered.cpp psf_translate_interpol_avg.cpp \
    alpha_prime.cpp init_PSF_center.cpp PSF_core_computation.cpp rotation_Mprime.cpp \
    computation.cpp PSF_core_disk.cpp scanning.cpp \
    data.cpp psf_interpolation.cpp PSF_cartesian.cpp \
    field_rotation.cpp psf_move_visu.cpp sumXk.cpp \
    nr3.h interp_1d.h interp_linear.h interp_2d.h functions.hpp #imageviewer.h LabelImage.h
    SOURCES += FitsImage.cxx rgb.cpp sphere.cpp #imageviewer.cpp LabelImage.cpp

    # library
    LIBS += -L/opt/fontconfig-2.4.2/lib
    LIBS += -L/usr/local/cfitsio -L/usr/local/cfitsio/lib
    LIBS += -lCCfits -lcfitsio
    LIBS += -L/usr/local/lib

    # openMP
    # C++ flags
    #QMAKE_CXXFLAGS += -fopenmp
    # linker options
    #QMAKE_LFLAGS += -fopenmp

    #QMAKE_CXX=icc

    QMAKE_CXX=mpicxx

    regards,

    Damien

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: change linker in qmake

    QMAKE_LINK and QMAKE_LINK_SHLIB are the relevant variables.

  3. #3
    Join Date
    Dec 2009
    Posts
    4
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default Re: change linker in qmake

    thank you it works now

    strange that i did not find it in qmake doc

    Damien

    Quote Originally Posted by wysota View Post
    QMAKE_LINK and QMAKE_LINK_SHLIB are the relevant variables.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: change linker in qmake

    They are not mentioned there. Those variables are set by QMAKESPEC and shouldn't be changed.

Similar Threads

  1. DockWidgetArea change and layout direction change
    By mstegehu in forum Qt Programming
    Replies: 1
    Last Post: 21st February 2012, 21:24
  2. Linker Lib .a into My VLC project
    By nhs_0702 in forum Qt Programming
    Replies: 1
    Last Post: 13th March 2010, 12:21
  3. need script to change qmake .pro file
    By rajeshs in forum Qt Programming
    Replies: 5
    Last Post: 7th July 2007, 17:53
  4. Linker Errors
    By MarkoSan in forum Qt Programming
    Replies: 5
    Last Post: 7th March 2006, 18:30
  5. Qt 4.1.1 linker warnings
    By Matt Smith in forum Installation and Deployment
    Replies: 0
    Last Post: 26th February 2006, 22:14

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.