Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Simd features on specific files - cannot enable exceptions
Forum Update on Monday, May 27th 2025

Simd features on specific files - cannot enable exceptions

Scheduled Pinned Locked Moved Unsolved General and Desktop
10 Posts 2 Posters 2.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    manoh
    wrote on 20 May 2016, 09:47 last edited by
    #1

    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???

    K 1 Reply Last reply 20 May 2016, 10:44
    0
    • M manoh
      20 May 2016, 09:47

      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???

      K Offline
      K Offline
      kshegunov
      Moderators
      wrote on 20 May 2016, 10:44 last edited by kshegunov
      #2

      @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?

      Read and abide by the Qt Code of Conduct

      M 1 Reply Last reply 20 May 2016, 11:07
      0
      • K kshegunov
        20 May 2016, 10:44

        @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?

        M Offline
        M Offline
        manoh
        wrote on 20 May 2016, 11:07 last edited by
        #3

        @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.
        
        K 1 Reply Last reply 20 May 2016, 13:40
        0
        • M manoh
          20 May 2016, 11:07

          @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.
          
          K Offline
          K Offline
          kshegunov
          Moderators
          wrote on 20 May 2016, 13:40 last edited by
          #4

          @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.

          Read and abide by the Qt Code of Conduct

          M 1 Reply Last reply 20 May 2016, 13:50
          1
          • K kshegunov
            20 May 2016, 13:40

            @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.

            M Offline
            M Offline
            manoh
            wrote on 20 May 2016, 13:50 last edited by manoh
            #5

            @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
            
            K 1 Reply Last reply 20 May 2016, 14:06
            0
            • M manoh
              20 May 2016, 13:50

              @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
              
              K Offline
              K Offline
              kshegunov
              Moderators
              wrote on 20 May 2016, 14:06 last edited by
              #6

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

              Read and abide by the Qt Code of Conduct

              M 1 Reply Last reply 23 May 2016, 09:19
              0
              • K kshegunov
                20 May 2016, 14:06

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

                M Offline
                M Offline
                manoh
                wrote on 23 May 2016, 09:19 last edited by
                #7

                @kshegunov

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

                K 1 Reply Last reply 23 May 2016, 09:38
                0
                • M manoh
                  23 May 2016, 09:19

                  @kshegunov

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

                  K Offline
                  K Offline
                  kshegunov
                  Moderators
                  wrote on 23 May 2016, 09:38 last edited by kshegunov
                  #8

                  @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?

                  Read and abide by the Qt Code of Conduct

                  M 1 Reply Last reply 24 May 2016, 08:28
                  0
                  • K kshegunov
                    23 May 2016, 09:38

                    @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?

                    M Offline
                    M Offline
                    manoh
                    wrote on 24 May 2016, 08:28 last edited by
                    #9

                    @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

                    K 1 Reply Last reply 25 May 2016, 11:35
                    0
                    • M manoh
                      24 May 2016, 08:28

                      @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

                      K Offline
                      K Offline
                      kshegunov
                      Moderators
                      wrote on 25 May 2016, 11:35 last edited by kshegunov
                      #10

                      @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.

                      Read and abide by the Qt Code of Conduct

                      1 Reply Last reply
                      0

                      1/10

                      20 May 2016, 09:47

                      • Login

                      • Login or register to search.
                      1 out of 10
                      • First post
                        1/10
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved