Porting nghttp2 to QNX
The nghttp2 is a widely used HTTP/2 library and was initially designed for Linux-based systems. To port it to QNX, several modifications are necessary:
CMake configuration adjustments
Modify the tests/CMakeLists.txt file to include QNX-specific build instructions:
if(QNX)
add_executable(main ${MAIN_SOURCES})
else()
add_executable(main EXCLUDE_FROM_ALL ${MAIN_SOURCES})
endif()
This change ensures that the test suite is correctly built when targeting QNX.
Codebase-level changes
Added
#ifdef __QNX__
blocks in source files to include QNX-specific headers like <sys/time.h>, which are not always present in Linux code.Ensure compatibility with QNX toolchains that might lack GNU-specific extensions or macros:
#if defined(__QNX__) #include <sys/time.h> #endif
This modification ensures that QNX-specific headers are included only when compiling QNX, preventing potential compilation errors on other platforms.
For more information, visit "Including QNX OS-specific code" in the Programmer's Guide.
Build system changes
Use a custom build script to:
Define QNX-specific compiler flags (e.g., QCC, CPPFLAGS, LDFLAGS).
Set environment variables to guide the QNX toolchain (cross compilation).
For more information, refer to the nghttp2 repo on GitHub.