@glaringlee
Thank you so much for replying and trying to help! I really appreciate this!
This is also what I found in another repo on github while searching the web for similar errors.
So I have changed the CMakelists.txt file as follows:
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++14 -stdlib=libstdc++ ${TORCH_CXX_FLAGS}")
But now I’m getting the following compiler errors:

  
      github.com
  
  
    shyney7/libtorch-cross-RTOS-test/blob/fa8f42964be0b4e194f402f8296909f0e438d470/Compilerlogs/comperr_with-stdlib=libstdc++_flag.md 7
```console
marcel@ubuntu:~/Documents/libtorch_cross_test/build$ cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/qnx_7.0.0_linux_x86_64.cmake ..
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /home/marcel/qnx700/host/linux/x86_64/usr/bin/ntox86_64-gcc
-- Check for working C compiler: /home/marcel/qnx700/host/linux/x86_64/usr/bin/ntox86_64-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /home/marcel/qnx700/host/linux/x86_64/usr/bin/ntox86_64-c++
-- Check for working CXX compiler: /home/marcel/qnx700/host/linux/x86_64/usr/bin/ntox86_64-c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found


  This file has been truncated. show original

  
  
    
    
  
  


I have also opened an issue on github describing everything and with all the files from a repo I created.

  
      github.com/pytorch/pytorch
  
  
    
  
	  
  

  
    
      Compiling errors when trying to cross-compile the C++ API for RTOS (QNX) 11
    

    
      
        opened 
        
          
        
        May 12, 2020
      
      


      
        
          
          shyney7
        
      
    
  



  I am currently trying to implement the Pytorch C++ API into production. RTOS are indispensable in production environments so I'm trying...



    module: cpp
    triaged


  
  
    
    
  
  





 glaringlee:

And another thing is that, I think it would be better to add your libtorch path into CMAKE_FIND_ROOT_PATH and put back CMAKE_FIND_ROOT_PATH_MODE_PACKAGE from BOTH to ONLY.


I’ve tried this by moving the libtorch folder to the QNX Target Environment as stated here (QNX Docs 4):
/home/marcel/qnx700/target/qnx7/x86_64/lib/libtorch/
And changed the line in the CMakelists.txt as follows:
list(APPEND CMAKE_PREFIX_PATH "${QNX_TARGET}/x86_64/lib/libtorch")
But this change did not lead to a succesful build and I’m getting the same compiler errors as shown above.
Compiler Errors 1