Skip to content

Instantly share code, notes, and snippets.

@pavly-gerges
Created June 5, 2024 23:02
Show Gist options
  • Save pavly-gerges/3e08f7fbde06ce67bc106797203283df to your computer and use it in GitHub Desktop.
Save pavly-gerges/3e08f7fbde06ce67bc106797203283df to your computer and use it in GitHub Desktop.
Unusual position independent error
electrostat-lab@electrostat-workstation:~/Sandbox/Electrostatic-Sandbox/electrostatic-sandbox-framework$ ./helper-scripts/ci-cd/compile-e4j.sh
Compiling and Assembling e4j-core
BUILD SUCCESSFUL in 1s
7 actionable tasks: 2 executed, 5 up-to-date
Compiling e4j-native
> Task :electrostatic4j-native:compileX86
-- GCC: /usr/bin/gcc
-- GPP: /usr/bin/g++
-- Compiler Options: -O2
-- Target architecture: x86
-- Toolchain Includes: /usr/include/
-- JAVA_HOME: /usr/lib/jvm/jdk-20.0.2
-- Included-library: /home/electrostat-lab/Sandbox/Electrostatic-Sandbox/electrostatic-sandbox-framework/electrostatic-core
-- Compiling for 32-bit Intel Chipset
-- Building binary for: Linux
-- Target Binary Instruction-set: x86
-- Configuring done
-- Generating done
-- Build files have been written to: /home/electrostat-lab/Sandbox/Electrostatic-Sandbox/electrostatic-sandbox-framework/electrostatic4j/electrostatic4j-native/cmake-build/x86
[ 50%] Linking C shared library libelectrostatic4j.so
[100%] Built target electrostatic4j
renamed './electrostatic4j-native/cmake-build/x86/libelectrostatic4j.so' -> './electrostatic4j-native/build/lib/linux/x86/libelectrostatic4j.so'
> Task :electrostatic4j-native:compileX86_64
Run Failed !
-- GCC: /usr/bin/gcc
-- GPP: /usr/bin/g++
-- Compiler Options: -O2
-- Target architecture: x86-64
-- Toolchain Includes: /usr/include/
-- JAVA_HOME: /usr/lib/jvm/jdk-20.0.2
-- Included-library: /home/electrostat-lab/Sandbox/Electrostatic-Sandbox/electrostatic-sandbox-framework/electrostatic-core
-- Compiling for 64-bit Intel Chipset
-- Building binary for: Linux
-- Target Binary Instruction-set: x86-64
-- Configuring done
-- Generating done
-- Build files have been written to: /home/electrostat-lab/Sandbox/Electrostatic-Sandbox/electrostatic-sandbox-framework/electrostatic4j/electrostatic4j-native/cmake-build/x86-64
[ 50%] Linking C shared library libelectrostatic4j.so
CMakeFiles/electrostatic4j.dir/build.make:103: recipe for target 'libelectrostatic4j.so' failed
CMakeFiles/Makefile2:94: recipe for target 'CMakeFiles/electrostatic4j.dir/all' failed
Makefile:102: recipe for target 'all' failed
/usr/bin/ld: /home/electrostat-lab/Sandbox/Electrostatic-Sandbox/electrostatic-sandbox-framework/electrostatic-core/build/x86-64/libelectrostatic-a.a(init_protocol.c.o): relocation R_X86_64_PC32 against symbol `serial' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
make[2]: *** [libelectrostatic4j.so] Error 1
make[1]: *** [CMakeFiles/electrostatic4j.dir/all] Error 2
make: *** [all] Error 2
mv: cannot stat './electrostatic4j-native/cmake-build/x86-64/libelectrostatic4j.so': No such file or directory
@pavly-gerges
Copy link
Author

Compiling the electrostatic-core native library with -fPIC has fixed this problem so far!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment