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

prevent setting CONNEXTDDS_ARCH when a more proper one exists #137

Open
wants to merge 5 commits into
base: rolling
Choose a base branch
from

Conversation

WanruXX
Copy link

@WanruXX WanruXX commented Nov 21, 2023

The original line 519-523 may result in an improper architect is selected while a proper one can exist.

For example, if you have
CMAKE_HOST_SYSTEM_NAME=Linux
CMAKE_HOST_SYSTEM_PROCESSOR=x86_64
architectures_installed=[armv8Linux4.4gcc5.4.0;x64Linux4gcc7.3.0]

the original cmake will set CONNEXTDDS_ARCH as armv8Linux4.4gcc5.4.0 at line 523 and break the foreach loop in the first entry without looking at the latter possible architectures.

After the change, armv8Linux4.4gcc5.4.0 will be put into a architecture_candidates list and continue searching, if x64Linux4gcc7.3.0 can be found then it will select this one, if not it will select armv8Linux4.4gcc5.4.0 as the best choice.

Copy link
Collaborator

@fujitatomoya fujitatomoya left a comment

Choose a reason for hiding this comment

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

overall, this is enhancement. besides the comments in the implementation, i have a question.

what could be the situation that we might have, architectures_installed=[armv8Linux4.4gcc5.4.0;x64Linux4gcc7.3.0]?

@WanruXX
Copy link
Author

WanruXX commented Nov 28, 2023

theoratically we shouldn't have that situation... but unfortunately i don't know how the platform team in our department installed our rti that we have multiple libraries installed in our development environment for 300 developers😅
image

Copy link
Collaborator

@fujitatomoya fujitatomoya left a comment

Choose a reason for hiding this comment

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

the actual use case is unclear for me, could be cross-build environment or something. (I see QNX! nice!) originally this cmake helper tries to find the appropriate library as much as possible, so i guess this can be better enhancement. lgtm

@fujitatomoya fujitatomoya self-assigned this Nov 28, 2023
@fujitatomoya
Copy link
Collaborator

@asorbini requesting another review.

"-DCONNEXTDDS_ARCH= to specify your RTI Connext DDS "
" architecture")
endif()
else()
message(STATUS "Selected CONNEXTDDS_ARCH: ${CONNEXTDDS_ARCH}")
Copy link
Collaborator

Choose a reason for hiding this comment

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

I am afraid that this status message could not be output if the guessed_architecture is matched, but the original logic did.

Copy link
Author

Choose a reason for hiding this comment

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

indeed, i modified the message in the case the guessed_architecture exists, please refer to below

" architecture")
else()
if(NOT CONNEXTDDS_ARCH)
list(GET architecture_candidates 0 CONNEXTDDS_ARCH)
Copy link
Collaborator

Choose a reason for hiding this comment

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

what if the architectures_installed is empty, is it safe to get the item from architecture_candidates?

Copy link
Author

@WanruXX WanruXX Nov 29, 2023

Choose a reason for hiding this comment

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

in this case the CONNEXTDDS_ARCH will be not set so will print out the message in line 540, which means the user didn't install any non-foreign architectures that would fit their operation system. The build will fail in this case and the original logic both.

Copy link
Collaborator

@iuhilnehc-ynos iuhilnehc-ynos Nov 30, 2023

Choose a reason for hiding this comment

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

I don't think the following error message is expected.

CMake Error at CMakeLists.txt:(line number) (list):
  list GET given empty list

Copy link
Author

@WanruXX WanruXX Nov 30, 2023

Choose a reason for hiding this comment

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

sorry for not examining carefully, i made the change for checking it 455302d#diff-3861ef3a2ee61ce1bc76d23a0207a4b3d235cbbf3b63b91b33e61d58e7527564R535

@@ -462,7 +462,7 @@ function(rti_guess_connextdds_arch)
if(EXISTS "${CONNEXTDDS_DIR}/lib/${guessed_architecture}")
set(CONNEXTDDS_ARCH "${guessed_architecture}")
message(STATUS
"Guessed ${CONNEXTDDS_DIR}/lib/${guessed_architecture} exists")
"Guessed ${CONNEXTDDS_DIR}/lib/${guessed_architecture} exists and is selected")
Copy link
Author

@WanruXX WanruXX Nov 29, 2023

Choose a reason for hiding this comment

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

i changed the message here since it will skip the message in line 546

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants