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

Fixes build error requires dynamic R_X86_64_PC32 #919

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kunaldeo
Copy link

@kunaldeo kunaldeo commented Aug 5, 2024

Tested on the latest Arch Linux distro

Summary

Fixes build error requires dynamic R_X86_64_PC32

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Docs
  • [*] Build-related changes
  • Other, please describe:

If changing the UI of web configuration, please provide the before/after screenshot:

Does this PR introduce a breaking change? (check one)

  • Yes
  • [* ] No

If yes, please describe the impact and migration path for existing setups:

The PR fulfills these requirements:

  • When resolving a specific issue, it's referenced in the PR's body (e.g. Fixes: #xxx[,#xxx], where "xxx" is the issue number)

To avoid wasting your time, it's best to open a feature request issue first and wait for approval before working on it.

Other information:

Tested on the latest Arch Linux distro
@awawa-dev
Copy link
Owner

Hi
Last CI build for Arch Linux is compiling fine (https://github.com/awawa-dev/HyperHDR/actions/runs/10213624169/job/28259386992) : did they change something again? I'm reluctant to include heavy artillery like fPIC always and everywhere for the whole application because of other architectures we have to remember, especially ARM. Maybe it would be enough to add information to the build instructions (https://github.com/awawa-dev/HyperHDR/wiki/Compiling-HyperHDR) that this option can be enabled via an additional CMake configuration parameter in case of problems?

@kunaldeo
Copy link
Author

kunaldeo commented Aug 5, 2024

Your concerns are valid. I noticed the error while building smart-pipewire. We can do either of the following

  1. Add an option
    option(ENABLE_PIC "Enable Position Independent Code" OFF)
if(ENABLE_PIC)
  set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif()
  1. Only do it for smart-pipewire. This options makes sense more for shared libs anyways.
    set_target_properties(smart-pipewire PROPERTIES POSITION_INDEPENDENT_CODE ON)

Build Error:

/usr/bin/ld.gold: warning: ../../../image/CMakeFiles/image.dir/VideoMemoryManager.cpp.o: unknown program property type -1342144512 in .note.gnu.property section
/usr/bin/ld.gold: error: ../../../image/CMakeFiles/image.dir/ColorRgb.cpp.o: requires dynamic R_X86_64_PC32 reloc against '_ZN8ColorRgb5BLACKE' which may overflow at runtime; recompile with -fPIC
/usr/bin/ld.gold: error: ../../../image/CMakeFiles/image.dir/Image.cpp.o: requires dynamic R_X86_64_PC32 reloc against '_ZTVSt15_Sp_counted_ptrIP9ImageDataI8ColorRgbELN9gnu_cxx12_Lock_policyE2EE' which may overflow at runtime; recompile with -fPIC
/usr/bin/ld.gold: error: ../../../image/CMakeFiles/image.dir/Image.cpp.o: requires dynamic R_X86_64_PC32 reloc against '_ZTVSt15_Sp_counted_ptrIP9ImageDataI8ColorRgbELN9gnu_cxx12_Lock_policyE2EE' which may overflow at runtime; recompile with -fPIC
/usr/bin/ld.gold: error: ../../../image/CMakeFiles/image.dir/VideoMemoryManager.cpp.o: requires dynamic R_X86_64_PC32 reloc against '_ZN18VideoMemoryManager10videoCacheE' which may overflow at runtime; recompile with -fPIC
collect2: error: ld returned 1 exit status
make[2]:  [sources/grabber/linux/pipewire/CMakeFiles/smart-pipewire.dir/build.make:151: lib/libsmart-pipewire.so] Error 1
make[1]:  [CMakeFiles/Makefile2:2236: sources/grabber/linux/pipewire/CMakeFiles/smart-pipewire.dir/all] Error 2

@awawa-dev
Copy link
Owner

I've just tested it on latest Arch rolled version (not docker) and it compiles fine:
https://pastebin.com/iZaBjCXU
Are you sure you are using latest HyperHDR master brach and did you clean all old files in the build folder and configure again with cmake?

@kunaldeo
Copy link
Author

kunaldeo commented Aug 5, 2024

Yes I am using latest master branch. I also rebuilt it with new build folder. Can you try with gold linker (ld.gold).

@awawa-dev
Copy link
Owner

Hmm... -- Linker: GNU gold

@awawa-dev
Copy link
Owner

Could you provide logs from the CMake configuration phase & the full buildlog?

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.

2 participants