question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

nvcc fatal : Unknown option 'Wl,--no-as-needed,/app/install/libtorch/lib/libtorch.so'

See original GitHub issue

nvcc fatal : Unknown option ‘Wl,–no-as-needed,/app/install/libtorch/lib/libtorch.so’

To Reproduce

docker pull nvcr.io/nvidia/tensorrt:19.02-py3 docker run -ti nvcr.io/nvidia/tensorrt:19.02-py3 bash mkdir /app cd /app git clone https://github.com/pytorch/vision.git wget https://download.pytorch.org/libtorch/cu92/libtorch-cxx11-abi-shared-with-deps-1.4.0%2Bcu92.zip unzip libtorch to /app/ Steps to reproduce the behavior:

  1. cd /app/vision/
  2. mkdir build
  3. change line 3 “set(CMAKE_CXX_STANDARD 14)” to
add_definitions(-std=c++11)
set(CMAKE_CXX_STANDARD 11)
  1. cd build
  2. cmake -DWITH_CUDA=on -DCMAKE_PREFIX_PATH=/app/libtorch/ …
  3. make

Expected behavior

build successfully.

Environment

Collecting environment information… PyTorch version: 1.2.0+cu92 Is debug build: No CUDA used to build PyTorch: 9.2.148

OS: Ubuntu 16.04.5 LTS GCC version: (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609 CMake version: version 3.12.1

Python version: 3.5 Is CUDA available: Yes CUDA runtime version: 10.0.130 GPU models and configuration: GPU 0: TITAN X (Pascal) GPU 1: TITAN X (Pascal)

Nvidia driver version: 430.26 cuDNN version: /usr/lib/x86_64-linux-gnu/libcudnn.so.7.4.2

Versions of relevant libraries: [pip] Could not collect [conda] Could not collect

output

cmake output

cd build && cmake -DWITH_CUDA=on -DCMAKE_PREFIX_PATH=/app/libtorch/ … – The C compiler identification is GNU 5.4.0 – The CXX compiler identification is GNU 5.4.0 – Check for working C compiler: /usr/bin/cc – Check for working C compiler: /usr/bin/cc – works – Detecting C compiler ABI info – Detecting C compiler ABI info - done – Detecting C compile features – Detecting C compile features - done – Check for working CXX compiler: /usr/bin/c++ – Check for working CXX compiler: /usr/bin/c++ – works – Detecting CXX compiler ABI info – Detecting CXX compiler ABI info - done – Detecting CXX compile features – Detecting CXX compile features - done – The CUDA compiler identification is NVIDIA 10.0.130 – Check for working CUDA compiler: /usr/local/cuda/bin/nvcc – Check for working CUDA compiler: /usr/local/cuda/bin/nvcc – works – Detecting CUDA compiler ABI info – Detecting CUDA compiler ABI info - done – Found Python3: /usr/lib/python3.5/config-3.5m-x86_64-linux-gnu/libpython3.5m.so (found version “3.5.2”) found components: Development – Looking for pthread.h – Looking for pthread.h - found – Looking for pthread_create – Looking for pthread_create - not found – Looking for pthread_create in pthreads – Looking for pthread_create in pthreads - not found – Looking for pthread_create in pthread – Looking for pthread_create in pthread - found – Found Threads: TRUE – Found CUDA: /usr/local/cuda (found version “10.0”) – Caffe2: CUDA detected: 10.0 – Caffe2: CUDA nvcc is: /usr/local/cuda/bin/nvcc – Caffe2: CUDA toolkit directory: /usr/local/cuda – Caffe2: Header version is: 10.0 – Found CUDNN: /usr/lib/x86_64-linux-gnu/libcudnn.so – Found cuDNN: v7.4.2 (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libcudnn.so) – Autodetected CUDA architecture(s): 6.1 6.1 – Added CUDA NVCC flags for: -gencode;arch=compute_61,code=sm_61 – Found torch: /app/libtorch/lib/libtorch.so – Configuring done – Generating done – Build files have been written to: /app/vision/build

make ouptuts

make Scanning dependencies of target torchvision [ 4%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/models/alexnet.cpp.o [ 8%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/models/densenet.cpp.o [ 12%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/models/googlenet.cpp.o [ 16%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/models/inception.cpp.o [ 20%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/models/mnasnet.cpp.o [ 24%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/models/mobilenet.cpp.o [ 28%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/models/resnet.cpp.o [ 32%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/models/shufflenetv2.cpp.o [ 36%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/models/squeezenet.cpp.o [ 40%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/models/vgg.cpp.o [ 44%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/cpu/DeformConv_cpu.cpp.o [ 48%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/cpu/PSROIAlign_cpu.cpp.o [ 52%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/cpu/PSROIPool_cpu.cpp.o [ 56%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/cpu/ROIAlign_cpu.cpp.o [ 60%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/cpu/ROIPool_cpu.cpp.o [ 64%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/cpu/nms_cpu.cpp.o [ 68%] Building CUDA object CMakeFiles/torchvision.dir/torchvision/csrc/cuda/DeformConv_cuda.cu.o [ 72%] Building CUDA object CMakeFiles/torchvision.dir/torchvision/csrc/cuda/PSROIAlign_cuda.cu.o [ 76%] Building CUDA object CMakeFiles/torchvision.dir/torchvision/csrc/cuda/PSROIPool_cuda.cu.o [ 80%] Building CUDA object CMakeFiles/torchvision.dir/torchvision/csrc/cuda/ROIAlign_cuda.cu.o [ 84%] Building CUDA object CMakeFiles/torchvision.dir/torchvision/csrc/cuda/ROIPool_cuda.cu.o [ 88%] Building CUDA object CMakeFiles/torchvision.dir/torchvision/csrc/cuda/nms_cuda.cu.o [ 92%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/vision.cpp.o [ 96%] Linking CUDA device code CMakeFiles/torchvision.dir/cmake_device_link.o nvcc fatal : Unknown option ‘Wl,–no-as-needed,/app/install/libtorch/lib/libtorch.so’ CMakeFiles/torchvision.dir/build.make:428: recipe for target ‘CMakeFiles/torchvision.dir/cmake_device_link.o’ failed make[2]: *** [CMakeFiles/torchvision.dir/cmake_device_link.o] Error 1 CMakeFiles/Makefile2:72: recipe for target ‘CMakeFiles/torchvision.dir/all’ failed make[1]: *** [CMakeFiles/torchvision.dir/all] Error 2 Makefile:129: recipe for target ‘all’ failed make: *** [all] Error 2

Please help me out? Why is that?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
Edwardmarkcommented, Apr 9, 2020

@bmanga Upgrading CMake to 3.13.2 works. Closed the issure.

0reactions
Edwardmarkcommented, Apr 9, 2020

@bmanga Hi, bmanga, Did you reproduce the error? And could you tell me how to fix it? Thanks. Bests, Edward.

Read more comments on GitHub >

github_iconTop Results From Across the Web

make error: nvcc fatal : Unknown option '--threads' #57 - GitHub
I just wanted to make people aware of it & how to get something to build in case they're also trying something similar....
Read more >
nvcc fatal : Unknown option 'fmad' - cuda - Stack Overflow
From the nvcc help: --fmad=true and --fmad=false enables and disables the contraction respectively. This switch is supported only when the --gpu ...
Read more >
NVCC fatal : Unknown option 's' - NVIDIA Developer Forums
Alright, so, I'm a complete newbie to CUDA, AND Linux, so bare with ... But, now it wont compile… it says “NVCC fatal:...
Read more >
nvcc fatal: Unknown option 'fPIC' when using WITH_PCL
ftl-vision fails to build with PCL, but builds successfully without (-DWITH_PCL=FALSE). Linux, Debug build_log.txt.
Read more >
CMake build error: nvcc fatal : Unknown option 'Wl
OS: centors 7 cmake: 3.12 commit: 5fc4fc53df74f276aafa5120814 cuda: 10.0 Any one have met this error ?
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found