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. aligned_alloc is not available despite C++17 flag
Forum Updated to NodeBB v4.3 + New Features

aligned_alloc is not available despite C++17 flag

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 4 Posters 2.5k Views 3 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.
  • StokestackS Offline
    StokestackS Offline
    Stokestack
    wrote on last edited by Stokestack
    #1

    Hi all. I'm building on a Mac with an attempt to specify C++17 in my Qt 5.12 project file as follows:

    CONFIG += c++17

    also added:
    QMAKE_CXXFLAGS += -std=c++17

    A clang version inquiry returns:
    Apple LLVM version 10.0.0 (clang-1000.11.45.5)

    In a C++ source file in an object method, I'm trying to do an aligned_alloc. But regardless of including stdlib.h or cstdlib, this is not a recognized function, with or without "std::".

    Anybody have an insight on this? Thanks!

    1 Reply Last reply
    0
    • Kent-DorfmanK Offline
      Kent-DorfmanK Offline
      Kent-Dorfman
      wrote on last edited by Kent-Dorfman
      #2

      Have you verified that other c++17 features are available when including the flags?
      First, see if the problem is specific to your Qt project, or if it is a problem with any c++17 compilation on your MAC platform.

      I'd also look to see if you have multiple c++ compilers on your machine, and maybe the default Qt proejct build is using one other than you think.

      I'm also curious why even need aligned_alloc, as any compiler I've ever used will automatically set allocation on the native word size boundary. In the old days this was often necessary to avoid odd-address violations, but in modern architectures you sometimes still pay a performance penalty when aligning data at odd addresses.

      StokestackS 1 Reply Last reply
      1
      • Kent-DorfmanK Kent-Dorfman

        Have you verified that other c++17 features are available when including the flags?
        First, see if the problem is specific to your Qt project, or if it is a problem with any c++17 compilation on your MAC platform.

        I'd also look to see if you have multiple c++ compilers on your machine, and maybe the default Qt proejct build is using one other than you think.

        I'm also curious why even need aligned_alloc, as any compiler I've ever used will automatically set allocation on the native word size boundary. In the old days this was often necessary to avoid odd-address violations, but in modern architectures you sometimes still pay a performance penalty when aligning data at odd addresses.

        StokestackS Offline
        StokestackS Offline
        Stokestack
        wrote on last edited by
        #3

        @Kent-Dorfman Thanks for your answer.

        I'm using a third-party library that wants buffers at certain alignments. I don't know what the compiler will do, so I thought it'd be best to make sure. Also, some video encoders want buffers aligned to specific multiples.

        Indeed it looks like this is a system-wide problem. I created an Xcode C++ project and set the language target at C++17 (sort of; see screen shots). Again, align_alloc was missing.

        Here are the available compilers listed in Xcode, and what Qt is using. It's odd that C++ 17 language dialect is listed, but LLVM only says "C++ 11 support."

        0_1551405537980_compilers.png

        jsulmJ 1 Reply Last reply
        0
        • StokestackS Stokestack

          @Kent-Dorfman Thanks for your answer.

          I'm using a third-party library that wants buffers at certain alignments. I don't know what the compiler will do, so I thought it'd be best to make sure. Also, some video encoders want buffers aligned to specific multiples.

          Indeed it looks like this is a system-wide problem. I created an Xcode C++ project and set the language target at C++17 (sort of; see screen shots). Again, align_alloc was missing.

          Here are the available compilers listed in Xcode, and what Qt is using. It's odd that C++ 17 language dialect is listed, but LLVM only says "C++ 11 support."

          0_1551405537980_compilers.png

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Stokestack Try to include <cstdlib> as shown here: https://en.cppreference.com/w/cpp/memory/c/aligned_alloc

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          StokestackS 1 Reply Last reply
          0
          • jsulmJ jsulm

            @Stokestack Try to include <cstdlib> as shown here: https://en.cppreference.com/w/cpp/memory/c/aligned_alloc

            StokestackS Offline
            StokestackS Offline
            Stokestack
            wrote on last edited by Stokestack
            #5

            @jsulm Thanks. I had tried that. It's an Apple problem. Confirmed defect: My report has already been tagged as a dupe.

            1 Reply Last reply
            2
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Hi,

              What report would that be ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              StokestackS 1 Reply Last reply
              0
              • SGaistS SGaist

                Hi,

                What report would that be ?

                StokestackS Offline
                StokestackS Offline
                Stokestack
                wrote on last edited by Stokestack
                #7

                @SGaist The Apple bug report that was flagged as a dupe of Radar 19226311. Curiously, that one is categorized as closed; but clearly the problem isn't fixed. I can't see any more details than that.

                I encourage other Apple developers to file bug reports on this issue, in case it's being blown off.

                jsulmJ 1 Reply Last reply
                0
                • StokestackS Stokestack

                  @SGaist The Apple bug report that was flagged as a dupe of Radar 19226311. Curiously, that one is categorized as closed; but clearly the problem isn't fixed. I can't see any more details than that.

                  I encourage other Apple developers to file bug reports on this issue, in case it's being blown off.

                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @Stokestack Can you post a link to that closed bug ticket?

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  StokestackS 1 Reply Last reply
                  0
                  • jsulmJ jsulm

                    @Stokestack Can you post a link to that closed bug ticket?

                    StokestackS Offline
                    StokestackS Offline
                    Stokestack
                    wrote on last edited by
                    #9

                    @jsulm No. All I have is the number. It's not publicly accessible.

                    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