Closed Hou-Xiaoxuan closed 5 months ago
@Hou-Xiaoxuan Currently gcc/g++ isn't supported while compiling pipy. You'll have to install and compile with clang. Please try:
export CC=clang
export CXX=clang
and then cmake and make again
@Hou-Xiaoxuan Currently gcc/g++ isn't supported while compiling pipy. You'll have to install and compile with clang. Please try:
export CC=clang export CXX=clang
and then cmake and make again
The previous problem was solved, but a new problem was encountered, which seemed to be a problem with zlib's compilation options.
[100%] Building C object CMakeFiles/pipy.dir/deps/sqlite-3.43.2/sqlite3.c.o
[100%] Linking CXX shared library libpipy.so
/usr/bin/ld: deps/zlib-1.3/libz.a(trees.c.o): warning: relocation against `_length_code' in read-only section `.text'
/usr/bin/ld: deps/zlib-1.3/libz.a(trees.c.o): relocation R_X86_64_PC32 against symbol `_length_code' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [CMakeFiles/pipy.dir/build.make:2330: libpipy.so] Error 1
make[1]: *** [CMakeFiles/Makefile2:472: CMakeFiles/pipy.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
@Hou-Xiaoxuan This issue is supposed to be solved in 370bf9aff8650fd7c7e930bbfbfcb4edbf433b36 where zlib version was bumped to v1.3.1 already. Please check with that version and see if it works.
@Hou-Xiaoxuan This issue is supposed to be solved in 370bf9a where zlib version was bumped to v1.3.1 already. Please check with that version and see if it works.
No, updating to the latest source didn't solve my problem.
According to the error message, I added set(CMAKE_POSITION_INDEPENDENT_CODE ON)
at the top of CMakeLists.txt
and compiled successfully.
Could you please merge this change into the main branch, placing it where appropriate (since this option seems to be effective only when compiling dynamic libraries.
For example(I don't familiar with other options):
No, updating to the latest source didn't solve my problem. According to the error message, I added
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
at the top ofCMakeLists.txt
and compiled successfully.
POSITION_INDEPENDENT_CODE
or -fPIC
flag is turned ON by default for SHARED
and MODULE
library targets. And this holds true for current CMAKE file. One can verify that this flag is handled properly by cmake via adding -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
when invoking cmake.
I gave it a try on Mac M1 using LLVM@17 and compilation works fine.
Please advise if you are encountering issues on any different platform and steps on how can we reproduce that?
No, updating to the latest source didn't solve my problem. According to the error message, I added
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
at the top ofCMakeLists.txt
and compiled successfully.
POSITION_INDEPENDENT_CODE
or-fPIC
flag is turned ON by default forSHARED
andMODULE
library targets. And this holds true for current CMAKE file. One can verify that this flag is handled properly by cmake via adding-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
when invoking cmake.I gave it a try on Mac M1 using LLVM@17 and compilation works fine.
Please advise if you are encountering issues on any different platform and steps on how can we reproduce that?
I'm developing under both macos m1 and x86 linux, and macos has never had a similar problem.
I have tested on my local machine (archlinux WSL) and cloud ide(Debian GNU/Linux 11), they all triggered the problem.
test steps:
build git:(main) export CXX=clang++
build git:(main) export CC=clang
build git:(main) cmake -DPIPY_SHARED=ON ..
build git:(main) make -j4
have tested on my local machine (archlinux WSL) and cloud ide(Debian GNU/Linux 11), they all triggered the problem.
Thanks for the details. Fix for problem has already been merged
Use
PIPY_SHARED
to complied as dynamic library. Reproduction method:system info, test in two machine.