Failed to compile shared library
Open
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 1.2k
- Forks
- 409
- PR merge metrics
- No merged PRs in 30d
Description
base) ➜ build_debug git:(preview) ✗ make cpuinfo
Consolidate compiler generated dependencies of target cpuinfo
[ 0%] Linking C shared library ../../lib/libcpuinfo.so
/usr/bin/ld: CMakeFiles/cpuinfo.dir/src/init.c.o: in function `cpuinfo_initialize':
/home/zhimin/Projects/Matazure/galois/third_party/cpuinfo/src/init.c:30: undefined reference to `cpuinfo_x86_linux_init'
/usr/bin/ld: CMakeFiles/cpuinfo.dir/src/init.c.o: relocation R_X86_64_PC32 against undefined hidden symbol `cpuinfo_x86_linux_init' can not be used when making a shared object
/usr/bin/ld: final link failed: bad value
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [third_party/cpuinfo/CMakeFiles/cpuinfo.dir/build.make:145: lib/libcpuinfo.so] Error 1
make[2]: *** [CMakeFiles/Makefile2:55466: third_party/cpuinfo/CMakeFiles/cpuinfo.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:55473: third_party/cpuinfo/CMakeFiles/cpuinfo.dir/rule] Error 2
make: *** [Makefile:19806: cpuinfo] Error 2
third_party/cpuinfo/src/cpuinfo/internal-api.h: 51
CPUINFO_PRIVATE void cpuinfo_x86_linux_init(void);
CPUINFO_PRIVATE will make cpuinfo_x86_linux_init symbol to be hidden, so we can not use it in the shared library?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with third_party/cpuinfo/src/cpuinfo/internal-api.h at the CPUINFO_PRIVATE declaration and trace the cpuinfo_x86_linux_init entry point referenced by src/init.c. Reproduce the failure with make cpuinfo and inspect the shared-library link step. Done means the cpuinfo target links successfully without the undefined hidden-symbol error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100