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 the RPATH within the CMake setup. #69

Merged
merged 1 commit into from
Feb 7, 2025
Merged

Add the RPATH within the CMake setup. #69

merged 1 commit into from
Feb 7, 2025

Conversation

fruffy
Copy link
Contributor

@fruffy fruffy commented Feb 7, 2025

Not entirely sure whether this is the right way to do it.

Fixes #51.

@fruffy fruffy requested a review from vgurevich February 7, 2025 00:41
CMakeLists.txt Outdated
@@ -48,6 +48,11 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_INSTALL_PREFIX}/lib")
set(CMAKE_PREFIX_PATH "${CMAKE_INSTALL_PREFIX}")

# Relative RPATH setup.
list(APPEND CMAKE_INSTALL_RPATH $ORIGIN/../lib))

Choose a reason for hiding this comment

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

You might need to escape the $ somehow so it doesn't get expanded as a make or shell variable. In a Makefile, you generally need '$$ORIGIN' for that. Not sure what cmake needs.

Copy link
Contributor Author

@fruffy fruffy Feb 7, 2025

Choose a reason for hiding this comment

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

Allegedly, CMake is okay with $ORIGIN as is, only ${} needs to be escaped. But unfortunately I am unable to test that right now.

@vgurevich
Copy link
Contributor

Thanks, @fruffy -- works for me:

ubuntu@ip-172-31-32-12:~/open-p4studio$ echo $LD_LIBRARY_PATH    # It is not set

ubuntu@ip-172-31-32-12:~/open-p4studio$ ldd $SDE_INSTALL/bin/p4c-barefoot
	linux-vdso.so.1 (0x00007ffe1434b000)
	libboost_iostreams.so.1.67.0 => /home/ubuntu/open-p4studio/install/bin/../lib/libboost_iostreams.so.1.67.0 (0x00007fc254daf000)
	libprotobuf.so.25.0.0 => /home/ubuntu/open-p4studio/install/bin/../lib/libprotobuf.so.25.0.0 (0x00007fc254562000)
	libabsl_log_internal_check_op.so.2308.0.0 => /home/ubuntu/open-p4studio/install/bin/../lib/libabsl_log_internal_check_op.so.2308.0.0 (0x00007fc254558000)
	libabsl_status.so.2308.0.0 => /home/ubuntu/open-p4studio/install/bin/../lib/libabsl_status.so.2308.0.0 (0x00007fc25452e000)
	libabsl_log_internal_message.so.2308.0.0 => /home/ubuntu/open-p4studio/install/bin/../lib/libabsl_log_internal_message.so.2308.0.0 (0x00007fc25450e000)
	libabsl_log_internal_nullguard.so.2308.0.0 => /home/ubuntu/open-p4studio/install/bin/../lib/libabsl_log_internal_nullguard.so.2308.0.0 (0x00007fc254507000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fc2544e8000)
...

@fruffy fruffy merged commit 0f2ad6f into main Feb 7, 2025
3 checks passed
@fruffy fruffy deleted the fruffy/rpath branch February 7, 2025 13:25
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.

Fix RPATH in p4c-barefoot
3 participants