Simd features on specific files - cannot enable exceptions



  • Hi,

    i want to enable sse and avx just for specific source files. This works, but i'm using on some other files exceptions and i cannot prevent qmake to not generate CXXFlags with -fno_exceptions. If i delete -fno_expcetions at the generated makefile the static lib does compile at all.

    My pro-file looks like this:

    # target should be a non-qt static lib
    CONFIG -= qt
    CONFIG += staticlib
    CONFIG += warn_on c++11 debug_and_release exceptions simd
    
    TEMPLATE = lib
    TAREGET = mylibrary
    
    INCLUDEPATH += include 
    
    SSE2_SOURCES += fooSse2.cpp
    
    AVX2_SOURCES +=fooAvx2.cpp
    
    SOURCES += bar.cpp
    

    Does somebody know why i cannot enable exceptions???


  • Qt Champions 2016

    @manoh
    I don't think this flag is at all relevant for static libraries. What happens when you actually link the static lib with CONFIG += exceptions ion your project?



  • @kshegunov

    The static lib does not compile: -fno_exceptions

    Compiler output:

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c -pipe -stdlib=libc++ -O2 -fPIC -std=gnu++11 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -mmacosx-version-min=10.7 -Wall -W -fno-exceptions -DQT_NO_MTDEV -DQT_NO_LIBUDEV -DQT_NO_EVDEV -DQT_NO_TSLIB -DQT_NO_LIBINPUT -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -I../../../lib/libimagedecoder -I. -I../../../lib/include -I../../../lib/src -I../../../lib/other_headers -I/usr/local/opt/openssl/include -I/Users/asdf/Qt/5.6/clang_64/mkspecs/macx-clang -o .obj/IImageDecoder.o ../../../lib/foo.cpp
    ../../../lib/foo.cpp:123:6: error: cannot use 'throw' with
          exceptions disabled
                                            throw std::invalid_argument("The given arguments to ..."
                                            ^
    ../../../lib/foo.cpp:203:6: error: cannot use 'throw' with
          exceptions disabled
                                            throw std::invalid_argument("The given arguments to ..."
                                            ^
    2 errors generated.
    

  • Qt Champions 2016

    @manoh said:

    The static lib does not compile: -fno_exceptions

    I see. Perhaps I'm in error, it's been known to happen. They should be enabled by default (as per the qmake docs`), but try something like this:

    CONFIG -= qt exceptions_off
    CONFIG += staticlib
    CONFIG += warn_on c++11 debug_and_release exceptions simd
    

    As a side question, what version of Qt (hence qmake) are you using?

    Kind regards.



  • @kshegunov

    Thanks for answers!

    I tried this before i wrote my first post and this does not work :-( I think i have to write a custom compiler (after the weekend).

    $ qmake -v
    QMake version 3.0
    Using Qt version 5.6.0 in /Users/asdf/Qt/5.6/clang_64/lib
    

  • Qt Champions 2016

    @manoh
    I can reproduce this on Linux, so it's probably a bug in qmake. Do you mind reporting it on the bugtracker?



  • @kshegunov

    I'm not sure if this is bug or if i cannot use simd config-option this way.


  • Qt Champions 2016

    @manoh
    I didn't use simd for my tests, only the excetpions/exceptions_off options.

    I'm just getting forgetful in my old age. I did use simd, removing it fixes the issue. Where did that configuration option came from anyway?



  • @kshegunov
    I searched on the internet and read some threads, documentation and source code...
    At least i was grepping at Qt/5.6/Src/qtbase/src/gui for simd
    There is QMAKESPEC file at mkspecs/features/simd.prf


  • Qt Champions 2016

    @manoh
    To be honest I don't know if this is a bug, or expected behaviour. I advise asking on the interest mailing list how/if you can use that config option. Sorry, I couldn't be of more help.

    Kind regards.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.