conan-io / conan

Conan - The open-source C and C++ package manager
https://conan.io
MIT License
7.97k stars 952 forks source link

[bug] QNX 7 builds are failing due to the -std=c++11 #9391

Open raghucsbe opened 2 years ago

raghucsbe commented 2 years ago

Environment Details (include every applicable attribute)

Steps to reproduce (Include if Applicable)

Building Alexa Auto SDK for QNX platform on Mac QNX SDP 7.0 is installed. QNX profile :

include(default)
[settings]
os=Neutrino
os.version=7.0
arch=armv8
compiler=qcc
compiler.version=5.4
compiler.libcxx=cxx
[options]
[build_requires]
[env]
CC="qcc -Vgcc_ntoaarch64le -Y_cxx"
CXX="q++ -lang-c++ -Vgcc_ntoaarch64le -Y_cxx"
CPP="qcc -Vgcc_ntoaarch64le -E"
QNX_HOST=/Users/<name>/qnx700/host/darwin/x86_64
QNX_TARGET=/Users/<name>/qnx700/target/qnx7

Command used to build

$  conan create modules/core --profile aac-qnx -b missing

It is observed that the conan is additionally adding -std=c++11 to the compile flag that caused the qcc compile to fail. When manually removed the flag the compilation goes thru.

Logs (Executed commands with output) (Include/Attach if Applicable)

Building CXX object CMakeFiles/AACECore.dir/engine/src/Logger/Sinks/FileSink.cpp.o
/Users/<user>/qnx700/host/darwin/x86_64/usr/bin/q++  -lang-c++ -Vgcc_ntoaarch64le -Y_cxx -lang-c++ -DAACECore_EXPORTS -DAAC_DEFAULT_LOGGER_ENABLED -DAAC_DEFAULT_LOGGER_LEVEL -DAAC_DEFAULT_LOGGER_LEVEL_INFO -DAAC_DEFAULT_LOGGER_SINK -DAAC_DEFAULT_LOGGER_SINK_CONSOLE -DNDEBUG -DRAPIDJSON_HAS_STDSTRING -I/Users/<user>/.conan/data/rapidjson/1.1.0/_/_/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/include -I/Users/<user>/.conan/data/nlohmann_json/3.8.0/_/_/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/include -I/Users/<user>/.conan/data/sqlite3/3.32.3/_/_/package/fcff8ec1a1f8a9d4a09d4f949e4c4f01048812f2/include -I/Users/<user>/.conan/data/aac-module-core/dev/_/_/build/419913d4b251896f5fc5501f6a4fce19cce715ac/AACECore -I/Users/<user>/.conan/data/aac-module-core/dev/_/_/build/419913d4b251896f5fc5501f6a4fce19cce715ac/engine/include -I/Users/<user>/.conan/data/aac-module-core/dev/_/_/build/419913d4b251896f5fc5501f6a4fce19cce715ac/platform/include -Wall -O2   -O3 -DNDEBUG -O3 -DNDEBUG  -fPIC -std=c++11 -Wp,-MD,CMakeFiles/AACECore.dir/engine/src/Logger/Sinks/FileSink.cpp.o.d -Wp,-MT,CMakeFiles/AACECore.dir/engine/src/Logger/Sinks/FileSink.cpp.o -Wp,-MF,CMakeFiles/AACECore.dir/engine/src/Logger/Sinks/FileSink.cpp.o.d -o CMakeFiles/AACECore.dir/engine/src/Logger/Sinks/FileSink.cpp.o -c /Users/<user>/.conan/data/aac-module-core/dev/_/_/build/419913d4b251896f5fc5501f6a4fce19cce715ac/engine/src/Logger/Sinks/FileSink.cpp

Build error:

In file included from /Users/<user>/.conan/data/aac-module-core/dev/_/_/build/419913d4b251896f5fc5501f6a4fce19cce715ac/engine/src/Logger/Sinks/FileSink.cpp:26:0:
/Users/<user>/.conan/data/aac-module-core/dev/_/_/build/419913d4b251896f5fc5501f6a4fce19cce715ac/engine/src/Logger/Sinks/FileSink.cpp: In static member function 'static std::__1::shared_ptr<aace::engine::logger::sink::FileSink> aace::engine::logger::sink::FileSink::create(const string&, const string&, const string&, uint32_t, uint32_t, bool)':
/Users/<user>/.conan/data/aac-module-core/dev/_/_/build/419913d4b251896f5fc5501f6a4fce19cce715ac/engine/src/Logger/Sinks/FileSink.cpp:50:41: error: no matching function for call to 'stat::stat(const value_type*, stat*)'
         ThrowIf(stat(path.c_str(), &info) != 0, "invalidPath");
                                         ^
/Users/<user>/.conan/data/aac-module-core/dev/_/_/build/419913d4b251896f5fc5501f6a4fce19cce715ac/engine/include/AACE/Engine/Core/EngineMacros.h:32:13: note: in definition of macro 'ThrowIf'
         if (arg) {                            \
             ^
In file included from /Users/<user>/.conan/data/aac-module-core/dev/_/_/build/419913d4b251896f5fc5501f6a4fce19cce715ac/engine/src/Logger/Sinks/FileSink.cpp:22:0:
/Users/<user>/qnx700/target/qnx7/usr/include/sys/stat.h:212:8: note: candidate: stat::stat()
 struct stat {
        ^
/Users/<user>/qnx700/target/qnx7/usr/include/sys/stat.h:212:8: note:   candidate expects 0 arguments, 2 provided
/Users/<user>/qnx700/target/qnx7/usr/include/sys/stat.h:212:8: note: candidate: constexpr stat::stat(const stat&)
/Users/<user>/qnx700/target/qnx7/usr/include/sys/stat.h:212:8: note:   candidate expects 1 argument, 2 provided
/Users/<user>/qnx700/target/qnx7/usr/include/sys/stat.h:212:8: note: candidate: constexpr stat::stat(stat&&)
/Users/<user>/qnx700/target/qnx7/usr/include/sys/stat.h:212:8: note:   candidate expects 1 argument, 2 provided
memsharded commented 2 years ago

Hi @raghucsbe

We would need the conanfile.py, or even better, a small reproducible example that we could use to test this. The thing is that the injected flags, like stdcpp flags, depends on the used tools. The new integrations in conan.tools.cmake will be different than the previous cmake or cmake_find_package generators, and different build systems, like Autotools will also have a different behavior. Could you please provide a reproducible example? Thanks!

Johnnyxy commented 2 years ago

Hi @raghucsbe I am building for QNX 7.0 on nearly a daily basis. To determine how the command line gets modified and the std parameter gets added, you have to provide the way you invoke the QCC. Like through CMake or Conan directly?

In any case your problem could originate from missing stuff from the QNX SDP headers. The QCC doc for the std parameter says:

This option restricts the language libraries (libc, libc++) to the specified ISO standard, which hides any function calls and symbols that aren't part of that standard. To include everything that's defined in the header files, such as functions that are part of the POSIX standard, also use the -D option to define _QNX_SOURCE. See “Conforming to standards” in the “Compiling and Debugging” chapter of the QNX Neutrino Programmer's Guide.

The Conforming to standards docs from QNX says:

If you want to conform to a given language standard, you can use the -std=language option for qcc. This option can cause certain portions of the header files to be omitted, which is likely to cause problems because functions that are defined by POSIX or that are specific to QNX Neutrino won't be defined.

You can then use the qcc -D option to define feature-test macros to specify the portions that you want to include. Here are the most commonly used feature-test macros: _QNX_SOURCE Include everything defined in the header files. This is defined by default if you don't specify a language standard.

You could try that until the source for the parameter injection is found.

Best Regards