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 Updated to NodeBB v4.3 + New Features

Simd features on specific files - cannot enable exceptions

Scheduled Pinned Locked Moved Unsolved General and Desktop
10 Posts 2 Posters 2.2k Views 1 Watching
  • 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.
  • manohM Offline
    manohM Offline
    manoh
    wrote on 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???

    kshegunovK 1 Reply Last reply
    0
    • manohM manoh

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

      kshegunovK Offline
      kshegunovK Offline
      kshegunov
      Moderators
      wrote on 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

      manohM 1 Reply Last reply
      0
      • kshegunovK kshegunov

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

        manohM Offline
        manohM Offline
        manoh
        wrote on 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.
        
        kshegunovK 1 Reply Last reply
        0
        • manohM manoh

          @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.
          
          kshegunovK Offline
          kshegunovK Offline
          kshegunov
          Moderators
          wrote on 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

          manohM 1 Reply Last reply
          1
          • kshegunovK kshegunov

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

            manohM Offline
            manohM Offline
            manoh
            wrote on 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
            
            kshegunovK 1 Reply Last reply
            0
            • manohM manoh

              @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
              
              kshegunovK Offline
              kshegunovK Offline
              kshegunov
              Moderators
              wrote on 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

              manohM 1 Reply Last reply
              0
              • kshegunovK kshegunov

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

                manohM Offline
                manohM Offline
                manoh
                wrote on last edited by
                #7

                @kshegunov

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

                kshegunovK 1 Reply Last reply
                0
                • manohM manoh

                  @kshegunov

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

                  kshegunovK Offline
                  kshegunovK Offline
                  kshegunov
                  Moderators
                  wrote on 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

                  manohM 1 Reply Last reply
                  0
                  • kshegunovK kshegunov

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

                    manohM Offline
                    manohM Offline
                    manoh
                    wrote on 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

                    kshegunovK 1 Reply Last reply
                    0
                    • manohM manoh

                      @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

                      kshegunovK Offline
                      kshegunovK Offline
                      kshegunov
                      Moderators
                      wrote on 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

                      • Login

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