This is the sequence of steps I took to produce and then resolve a linker error on my desktop running ArchLinux.
- Clone the repository.
git clone https://github.com/chapel-lang/chapel.git
- Checkout the latest stable release.
git checkout 1.26.0
- Following the instructions under the "Using Chapel in its Preferred Configuration" heading on the Quickstart page in the documentation, set the
CHPL_LLVMenvironment variable to the version of LLVM installed on your system.
- Use one of the provided scripts to set other variables.
make -j 6
The check fails with the output below.
[Info] Running minimal test script: $CHPL_HOME/util/test/checkChplInstall [Info] Found executable chpl in /home/jan/Packages/chapel/bin/linux64-x86_64/chpl. [Info] Found $CHPL_HOME directory: /home/jan/Packages/chapel [Info] /home/jan/.chpl does not exist. Creating it. [Info] Temporary test job directory: /home/jan/.chpl/chapel-test-yFawbT [Info] Compiling $CHPL_HOME/test/release/examples/hello6-taskpar-dist.chpl [Info] Compiling with CHPL_TARGET_COMPILER=llvm [Fail] Test job failed to compile - Chapel is not installed correctly [Fail] Compilation output: /usr/bin/ld: /tmp/chpl-jan.deleteme-SMB4h7/chpl__module.o: relocation R_X86_64_32S against `.bss' can not be used when making a PIE object; recompile with -fPIE /usr/bin/ld: failed to set dynamic section sizes: bad value clang-13: error: linker command failed with exit code 1 (use -v to see invocation) error: Make Binary - Linking make: *** [Makefile:202: check] Error 1
-fPIE in the error output, my crude instinct was to try to set the
-fPIC compiler flag to see what that would do. I didn't immediately find a way to do that, but I did discover the
CHPL_LIB_PIC environment variable in the Chapel documentation. So I decided to experiment with it.
- Set the
make -j 6
The check appears to pass with the following output.
[Info] Running minimal test script: $CHPL_HOME/util/test/checkChplInstall [Info] Found executable chpl in /home/jan/Packages/chapel/bin/linux64-x86_64/chpl. [Info] Found $CHPL_HOME directory: /home/jan/Packages/chapel [Info] /home/jan/.chpl does not exist. Creating it. [Info] Temporary test job directory: /home/jan/.chpl/chapel-test-bN1Tkv [Info] Compiling $CHPL_HOME/test/release/examples/hello6-taskpar-dist.chpl [Info] Compiling with CHPL_TARGET_COMPILER=llvm [Info] Test job compiled into /home/jan/.chpl/chapel-test-bN1Tkv/hello6-taskpar-dist [Info] $CHPL_LAUNCHER=none is compatible with test script. [Info] Running test job. [Info] Test job complete. SUCCESS: 'make check' passed!
When is it appropriate/necessary to set the
CHPL_LIB_PIC environment variable?
Also, here's the output of
machine info: Linux monolith 5.17.4-arch1-1 #1 SMP PREEMPT Wed, 20 Apr 2022 18:29:28 +0000 x86_64 CHPL_HOME: /home/jan/Packages/chapel * script location: /home/jan/Packages/chapel/util/chplenv CHPL_TARGET_PLATFORM: linux64 CHPL_TARGET_COMPILER: llvm CHPL_TARGET_ARCH: x86_64 CHPL_TARGET_CPU: native CHPL_LOCALE_MODEL: flat CHPL_COMM: none CHPL_TASKS: qthreads CHPL_LAUNCHER: none CHPL_TIMERS: generic CHPL_UNWIND: none CHPL_MEM: jemalloc CHPL_ATOMICS: cstdlib CHPL_GMP: bundled CHPL_HWLOC: bundled CHPL_RE2: bundled CHPL_LLVM: system * CHPL_AUX_FILESYS: none
The error I saw looks similar to the ones seen in this topic.