Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for QNX 7.1 build #3360

Merged
merged 1 commit into from
Mar 28, 2023
Merged

Conversation

chachoi
Copy link
Contributor

@chachoi chachoi commented Mar 13, 2023

Description

This PR adds necessary changes which will allow Fast-DDS to build with QNX 7.1:

  • I added QNX related build files: Makefile, nto folder, common.mk, and qnx.nto.toolchain.cmake.
  • I added a qnx_patches folder with patches for external libraries i.e. asio, fastcdr, and foonathan_memory_vendor.
  • I added QNX specific changes to CMakeLists. All of the changes in CMakeLists are wrapped in if(QNX) or if(NOT QNX) so that other builds are not affected. Some google tests are disabled because QNX 7.1 cannot compile the WillOnce function.
  • I changed the shared memory directory from /dev/shm to /dev/shmem for QNX. This change is wrapped in #ifdef QNXNTO.

Build instructions for QNX 7.1:

# Clone the repo
git clone git@github.com:chachoi/Fast-DDS.git && cd Fast-DDS

# Initialize external repos
vcs import < fastrtps.repos
git submodule update --init ./thirdparty/asio/ ./thirdparty/fastcdr ./thirdparty/tinyxml2/

# Apply QNX patches to external libraries
cd ./thirdparty/asio
git apply ../../build_qnx/qnx_patches/asio_qnx.patch
cd ../fastcdr
git apply ../../build_qnx/qnx_patches/fastcdr_qnx.patch
cd ../tinyxml2
unix2dos ../../build_qnx/qnx_patches/tinyxml2_qnx.patch
git apply ../../build_qnx/qnx_patches/tinyxml2_qnx.patch
cd ../../

# Clone googletest
git clone git@github.com:google/googletest.git
cd googletest
git checkout v1.13.0
git apply ../build_qnx/qnx_patches/googletest_qnx.patch
cd -

# Source the QNX environment script
source <path-to-qnxsdp-env.sh>/qnxsdp-env.sh

# Build Fast-DDS and its dependencies
cd build_qnx && make -j 4

Libraries will be installed to ${QNX_TARGET}/${CPUVARDIR}/usr/lib.

To build examples and tests, change -DEPROSIMA_BUILD_TESTS=OFF and -DCOMPILE_EXAMPLES=OFF in common.mk to -DEPROSIMA_BUILD_TESTS=ON and -DCOMPILE_EXAMPLES=ON .

Examples will be installed to ${QNX_TARGET}/${CPUVARDIR}/usr/bin/Fast-DDS_examples.
Tests will be installed to ${QNX_TARGET}/${CPUVARDIR}/usr/bin/Fast-DDS_test.

Contributor Checklist

  • Commit messages follow the project guidelines.
  • The code follows the style guidelines of this project.
  • N/A Tests that thoroughly check the new feature have been added/Regression tests checking the bug and its fix have been added; the added tests pass locally
  • N/A Any new/modified methods have been properly documented using Doxygen.
  • N/A Changes are ABI compatible.
  • N/A Changes are API compatible.
  • New feature has been added to the versions.md file (if applicable).
  • N/A New feature has been documented/Current behavior is correctly described in the documentation.
  • N/A Applicable backports have been included in the description.

Reviewer Checklist

  • The PR has a milestone assigned.
  • Check contributor checklist is correct.
  • Check CI results: changes do not issue any warning.
  • Check CI results: failing tests are unrelated with the changes.

Copy link
Contributor

@jsan-rt jsan-rt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First of all, thanks for all the work done on putting this PR together.

Other than the suggestions and questions already in the relevant files I have some concerns regarding the extensive Makefile usage. Is it required? On the common.mk file it seems like it ends up building all components in the standard CMake way. Also, a user that downloads the repository may be confused by a top level Makefile that fails due to a missing file (since recurse.mk is a QNX feature).

.gitignore Outdated
Comment on lines 450 to 455
build_fast-dds/
build_fastcdr/
build_foonathan_memory/
build_googletest/
build_tinyxml2/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to have this object folders inside the standard build folder?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

CMakeLists.txt Outdated
@@ -549,6 +567,45 @@ if(INSTALL_TOOLS)
)
endif()

if(COMPILE_EXAMPLES AND QNX)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is better to keep this in line with the rest of the logic. COMPILE_EXAMPLES builds, INSTALL_EXAMPLES moves them to the proper place.

Probably is also a good idea to nest it inside the already existing INSTALL_EXAMPLES check.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. Done.

CMakeLists.txt Outdated
Comment on lines 588 to 607
if(EPROSIMA_BUILD_TESTS AND QNX)
install(DIRECTORY ${PROJECT_BINARY_DIR}/test/
DESTINATION bin/Fast-DDS_test
PATTERN "*.cmake" EXCLUDE
PATTERN "*.d" EXCLUDE
PATTERN "*.dir" EXCLUDE
PATTERN "*.internal" EXCLUDE
PATTERN "*.make" EXCLUDE
PATTERN "*.marks" EXCLUDE
PATTERN "*.o" EXCLUDE
PATTERN "*.ts" EXCLUDE
PATTERN "*.txt" EXCLUDE
PATTERN "CMakeFiles" EXCLUDE
PATTERN "Makefile" EXCLUDE
PATTERN "cmake" EXCLUDE
)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/test/certs
DESTINATION bin/Fast-DDS_test
)
endif()
Copy link
Contributor

@jsan-rt jsan-rt Mar 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typically ctest runs the test binaries from the build directory. Why do you need to install them explicitly?

Also, this should be moved to the CMakeLists.txt inside the test subfolder.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I install them directly because the test binaries compiled for QNX can only be run on QNX targets, not on your Ubuntu build machine.

I moved it to the CMakeLists.txt inside the test subfolder.

versions.md Outdated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New commits on master branch are causing conflicts here. Please rebase.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This patch should be its own PR on the foonathan_memory_vendor repository since we are already doing some patching there.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created a PR on the foonathan_memory_vendor.

@chachoi chachoi force-pushed the master branch 6 times, most recently from 8cad29e to 8cf397f Compare March 22, 2023 15:36
@chachoi
Copy link
Contributor Author

chachoi commented Mar 22, 2023

First of all, thanks for all the work done on putting this PR together.

Other than the suggestions and questions already in the relevant files I have some concerns regarding the extensive Makefile usage. Is it required? On the common.mk file it seems like it ends up building all components in the standard CMake way. Also, a user that downloads the repository may be confused by a top level Makefile that fails due to a missing file (since recurse.mk is a QNX feature).

Thank you for the feedback @jsantiago-eProsima.

Yes, the Makefiles are required because that is how QNX builds work. I moved all QNX related build files under build_qnx so that users would not be confused.

Copy link
Contributor

@jsan-rt jsan-rt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look great, thank you. Just a small nitpick that I didn't catch on the first pass left.

Also, it would be really helpful if you could make a Pull Request to Fast DDS' documentation repository detailing the build procedure so it can be referenced there instead of in a Pull Request.

GTest::gmock
${CMAKE_DL_LIBS})
add_gtest(RTPSWriterTests SOURCES ${RTPSWRITERTESTS_SOURCE})
if(NOT QNX)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a small nitpick. Since we no longer need to build the RTPSWriterTests due to the WillOnce issue, better to move this before the set(RTPSWRITERTESTS_SOURCE RTPSWriterTests.cpp)

@chachoi chachoi force-pushed the master branch 2 times, most recently from b6a8835 to 38c4ca6 Compare March 23, 2023 14:24
@jsan-rt jsan-rt added the ci-pending PR which CI is running label Mar 23, 2023
@chachoi
Copy link
Contributor Author

chachoi commented Mar 23, 2023

Changes look great, thank you. Just a small nitpick that I didn't catch on the first pass left.

Also, it would be really helpful if you could make a Pull Request to Fast DDS' documentation repository detailing the build procedure so it can be referenced there instead of in a Pull Request.

Thanks @jsantiago-eProsima .

That sounds good. I will start to work on documenting the build procedure. Once I am done, I will submit a PR on the documentation repository.

@chachoi
Copy link
Contributor Author

chachoi commented Mar 24, 2023

Hello @jsantiago-eProsima,

I opened a PR which adds instructions for building.

Thanks.

@chachoi chachoi requested a review from jsan-rt March 24, 2023 21:11
Signed-off-by: James Choi <chachoi@blackberry.com>
@jsan-rt
Copy link
Contributor

jsan-rt commented Mar 27, 2023

@richiprosima please test this

Copy link
Contributor

@jsan-rt jsan-rt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with green CI

@jsan-rt
Copy link
Contributor

jsan-rt commented Mar 28, 2023

Failing test is unrelated.

@jsan-rt jsan-rt added ready-to-merge Ready to be merged. CI and changes have been reviewed and approved. and removed ci-pending PR which CI is running labels Mar 28, 2023
@MiguelCompany MiguelCompany merged commit 8d2e7dc into eProsima:master Mar 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge Ready to be merged. CI and changes have been reviewed and approved.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants