This repository was archived by the owner on Dec 6, 2024. It is now read-only.
fix: Fixing static compilation issues when installing modules with pip#57
Open
zhiyuan1i wants to merge 1 commit intoQwenLM:masterfrom
Open
fix: Fixing static compilation issues when installing modules with pip#57zhiyuan1i wants to merge 1 commit intoQwenLM:masterfrom
zhiyuan1i wants to merge 1 commit intoQwenLM:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Error message: When trying to link the libre2.a static library, "relocation R_X86_64_TPOFF32 against symbol '_ZN3re25hooks7contextE' can not be used when making a shared object; recompile with -fPIC "problem. This means that the library is not compiled with the -fPIC option, which prevents it from being linked to a shared object.
Error analysis: This error is caused by an attempt to link a static library (in this case libre2.a) that is not compiled with the -fPIC (Position Independent Code) option. Location-independent code means that a program can be executed anywhere in memory, which is important for generating dynamic link libraries. When creating shared or dynamic libraries, you need all object code to be location-independent.
Possible fix description: We can fix this problem by adding the -fPIC option in CMakeLists.txt. We add the -fPIC option when compiling the re2 library, but this changes the upstream content. So I chose to make sure that all targets defined in CMakeLists.txt are set to generate location-independent code by default. This can be done by adding the following line at the top of the CMakeLists.txt file:
This way, when you build the libre2.a library again and try to install qwen-cpp, the problem should be resolved.