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. stdlib.h exists but it's not found
Forum Updated to NodeBB v4.3 + New Features

stdlib.h exists but it's not found

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 1.1k Views 2 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.
  • M Offline
    M Offline
    Mark81
    wrote on last edited by
    #1

    I'm trying to compile an existing application in my cross-compile environment.
    In the .pro file I added the include path to the actual sysroot:

    INCLUDEPATH += /local/STM32MP15-Ecosystem-v1.0.0/Developer-Package/SDK/sysroots/cortexa7t2hf-neon-vfpv4-openstlinux_weston-linux-gnueabi/usr/include/c++/8.2.0/arm-openstlinux_weston-linux-gnueabi
    INCLUDEPATH += /local/STM32MP15-Ecosystem-v1.0.0/Developer-Package/SDK/sysroots/cortexa7t2hf-neon-vfpv4-openstlinux_weston-linux-gnueabi/usr/include
    

    in this way some libraries are found (i.e. ssl and bits/c++config.h.
    But I get an error here:

    /local/STM32MP15-Ecosystem-v1.0.0/Developer-Package/SDK/sysroots/cortexa7t2hf-neon-vfpv4-openstlinux_weston-linux-gnueabi/usr/include/c++/8.2.0/cstdlib:75:15: fatal error: stdlib.h: No such file or directory
    #include_next <stdlib.h>

    Using the IDE, I went to that line and pressed F2: it brought me to the correct file:

    /local/STM32MP15-Ecosystem-v1.0.0/Developer-Package/SDK/sysroots/cortexa7t2hf-neon-vfpv4-openstlinux_weston-linux-gnueabi/usr/include/stdlib.h
    

    It's weird to me because the path is exacly what I've added to the INCLUDEPATH variable.
    So, why the IDE can find the file, while the compiler cannot?

    aha_1980A 1 Reply Last reply
    0
    • M Mark81

      I'm trying to compile an existing application in my cross-compile environment.
      In the .pro file I added the include path to the actual sysroot:

      INCLUDEPATH += /local/STM32MP15-Ecosystem-v1.0.0/Developer-Package/SDK/sysroots/cortexa7t2hf-neon-vfpv4-openstlinux_weston-linux-gnueabi/usr/include/c++/8.2.0/arm-openstlinux_weston-linux-gnueabi
      INCLUDEPATH += /local/STM32MP15-Ecosystem-v1.0.0/Developer-Package/SDK/sysroots/cortexa7t2hf-neon-vfpv4-openstlinux_weston-linux-gnueabi/usr/include
      

      in this way some libraries are found (i.e. ssl and bits/c++config.h.
      But I get an error here:

      /local/STM32MP15-Ecosystem-v1.0.0/Developer-Package/SDK/sysroots/cortexa7t2hf-neon-vfpv4-openstlinux_weston-linux-gnueabi/usr/include/c++/8.2.0/cstdlib:75:15: fatal error: stdlib.h: No such file or directory
      #include_next <stdlib.h>

      Using the IDE, I went to that line and pressed F2: it brought me to the correct file:

      /local/STM32MP15-Ecosystem-v1.0.0/Developer-Package/SDK/sysroots/cortexa7t2hf-neon-vfpv4-openstlinux_weston-linux-gnueabi/usr/include/stdlib.h
      

      It's weird to me because the path is exacly what I've added to the INCLUDEPATH variable.
      So, why the IDE can find the file, while the compiler cannot?

      aha_1980A Offline
      aha_1980A Offline
      aha_1980
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Mark81 said in stdlib.h exists but it's not found:

      In the .pro file I added the include path to the actual sysroot:

      This is almost never the correct way to do.

      You should have an environment-setup script to setup your compiler. These scripts setup different environment variables. These variables must be added to the cross-compile Kit in Creator.

      Then it should work.

      Regards

      Qt has to stay free or it will die.

      1 Reply Last reply
      2
      • M Offline
        M Offline
        Mark81
        wrote on last edited by Mark81
        #3

        Thanks. I found the script you're talking about. It has a lot of variables. I need to set all of them?

        SDKTARGETSYSROOT
        PATH
        PKG_CONFIG_SYSROOT_DIR
        PKG_CONFIG_PATH
        CONFIG_SITE
        OECORE_NATIVE_SYSROOT
        OECORE_TARGET_SYSROOT
        OECORE_ACLOCAL_OPTS
        OECORE_BASELIB
        OECORE_TARGET_ARCH
        OECORE_TARGET_OS
        CC
        CXX
        CPP
        AS
        LD
        GDB
        STRIP
        RANLIB
        OBJCOPY
        OBJDUMP
        AR
        NM
        M4
        TARGET_PREFIX
        CONFIGURE_FLAGS
        CFLAGS
        CXXFLAGS
        LDFLAGS
        CPPFLAGS
        KCFLAGS
        OECORE_DISTRO_VERSION
        OECORE_SDK_VERSION
        ARCH
        CROSS_COMPILE
        
        1 Reply Last reply
        0
        • Kent-DorfmanK Offline
          Kent-DorfmanK Offline
          Kent-Dorfman
          wrote on last edited by
          #4

          A couple of things come to mind that you should be aware of:

          1. are you sure you regenerated the makefile after adding the INCLUDEPATH directives?
          2. if so, try switching the order of the INCLUDEPATH directives to search the C headers first, as #include_next works differently than #include
          3. if the inclusion is in your project code, and not in generated code, then replace <stdlib.h> with <cstdlib>, as that is the prefered inclusion for C++ code.
          M 1 Reply Last reply
          0
          • Kent-DorfmanK Kent-Dorfman

            A couple of things come to mind that you should be aware of:

            1. are you sure you regenerated the makefile after adding the INCLUDEPATH directives?
            2. if so, try switching the order of the INCLUDEPATH directives to search the C headers first, as #include_next works differently than #include
            3. if the inclusion is in your project code, and not in generated code, then replace <stdlib.h> with <cstdlib>, as that is the prefered inclusion for C++ code.
            M Offline
            M Offline
            Mark81
            wrote on last edited by
            #5

            @Kent-Dorfman

            1. I ran qmake again
            2. I've just do that - same error
            3. unfortunately that include is indeed in line75 of ctsdlib (/local/STM32MP15-Ecosystem-v1.0.0/Developer-Package/SDK/sysroots/cortexa7t2hf-neon-vfpv4-openstlinux_weston-linux-gnueabi/usr/include/c++/8.2.0/cstdlib)

            Anyway I agree with @aha_1980 - I guess the right way is to provide the correct environment. But appliying all of those vars it cannot build anything at all (it doesn't find the compiler). So I bet only few of them are mandatory.

            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