nicehash / nheqminer

Equihash miner for NiceHash
https://www.nicehash.com
MIT License
768 stars 583 forks source link

Linking nheqminer failed Ubuntu 17.04 #303

Open brentmsmith opened 7 years ago

brentmsmith commented 7 years ago

I compiled with gcc-5 and g++-5 and all seems to compile fine but the make dies at the last stage: make -j 8 [ 27%] Built target cpu_xenoncat [ 27%] Built target cuda_djezo [ 27%] Linking CXX executable nheqminer /usr/bin/ld: /usr/lib/x86_64-linux-gnu/librt.a(shm_open.o): relocation R_X86_64_32 against ``.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/lib/x86_64-linux-gnu/librt.a(shm_unlink.o): relocation R_X86_64_32 against ``.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: final link failed: Nonrepresentable section on output collect2: error: ld returned 1 exit status CMakeFiles/nheqminer.dir/build.make:502: recipe for target 'nheqminer' failed make[2]: *** [nheqminer] Error 1 CMakeFiles/Makefile2:68: recipe for target 'CMakeFiles/nheqminer.dir/all' failed make[1]: *** [CMakeFiles/nheqminer.dir/all] Error 2 Makefile:127: recipe for target 'all' failed make: *** [all] Error 2 Not sure exactly what this is telling me. Any advice would be appreciated.

qrkourier commented 7 years ago

I am able to reproduce this failure on Ubuntu Zesty 17.04 even after adding -fPIC to the compiler flags.

cmake .. \
  -DCUDA_NVCC_FLAGS="-ccbin gcc-4.9" \
  -DCMAKE_C{XX,}_FLAGS="-fPIC" \
  -DBUILD_SHARED_LIBS=ON && \
    make -j $(nproc)

I'm working off of HEAD@b9900ff except for the following change to allow the "build" dir to exist inside the working copy:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f906675..a0f5419 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -184,9 +184,9 @@ if (USE_CPU_TROMP)
 endif()
 if (USE_CPU_XENONCAT)
     add_library ( xenoncat_avx1 SHARED IMPORTED GLOBAL )
-    set_target_properties ( xenoncat_avx1 PROPERTIES IMPORTED_LOCATION "../nheqminer/cpu_xenoncat/asm_linux/equihash_avx1.o" )
+    set_target_properties ( xenoncat_avx1 PROPERTIES IMPORTED_LOCATION "../cpu_xenoncat/asm_linux/equihash_avx1.o" )
     add_library ( xenoncat_avx2 SHARED IMPORTED GLOBAL )
-    set_target_properties ( xenoncat_avx2 PROPERTIES IMPORTED_LOCATION "../nheqminer/cpu_xenoncat/asm_linux/equihash_avx2.o" )
+    set_target_properties ( xenoncat_avx2 PROPERTIES IMPORTED_LOCATION "../cpu_xenoncat/asm_linux/equihash_avx2.o" )
     target_link_libraries(${PROJECT_NAME} cpu_xenoncat xenoncat_avx1 xenoncat_avx2)
 endif()
 if (USE_CUDA_TROMP)
qrkourier commented 7 years ago

Probable duplicate of #300

kfetro commented 6 years ago

Same issue, but I've realized that there exist

/var/lib/dpkg/info/libboost-log1.62-dev.list

instead of

/var/lib/dpkg/info/libboost-log1.62-dev:amd64.list

skristiansson commented 6 years ago

I worked around this by: ../cmake find ./ -type f -exec sed -i 's/librt.a/librt.so/g' {} \; make -j $(nproc)