Skip to content

Commit

Permalink
Add instruction on how to handle the potential linker error on Linux (#…
Browse files Browse the repository at this point in the history
…47593)

Summary:
The original issue is #16683, which contains a #16683 (comment) that suggests manually un-shadowing the `ld`.

A better approach can be found at ContinuumIO/anaconda-issues#11152 (comment), which suggests that using a newer version can effectively fix this.

It took me quite some time to realize that this is in fact an issue caused by Anaconda. I think we should add it in README.

Pull Request resolved: #47593

Reviewed By: ailzhang

Differential Revision: D24866092

Pulled By: heitorschueroff

fbshipit-source-id: c1f51864d23fd6f4f63a117496d8619053e35196
  • Loading branch information
skyline75489 authored and facebook-github-bot committed Nov 11, 2020
1 parent 7864ae9 commit fcd44ce
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ They require JetPack 4.2 and above, and [@dusty-nv](https://github.com/dusty-nv)

### From Source

If you are installing from source, you will need Python 3.6 or later and a C++14 compiler. Also, we highly recommend installing an [Anaconda](https://www.anaconda.com/distribution/#download-section) environment.
If you are installing from source, you will need Python 3.6.2 or later and a C++14 compiler. Also, we highly recommend installing an [Anaconda](https://www.anaconda.com/distribution/#download-section) environment.
You will get a high-quality BLAS library (MKL) and you get controlled dependency versions regardless of your Linux distro.

Once you have [Anaconda](https://www.anaconda.com/distribution/#download-section) installed, here are the instructions.
Expand Down Expand Up @@ -207,6 +207,16 @@ export CMAKE_PREFIX_PATH=${CONDA_PREFIX:-"$(dirname $(which conda))/../"}
python setup.py install
```

Note that if you are using [Anaconda](https://www.anaconda.com/distribution/#download-section), you may experience an error caused by the linker:

```plaintext
build/temp.linux-x86_64-3.7/torch/csrc/stub.o: file not recognized: file format not recognized
collect2: error: ld returned 1 exit status
error: command 'g++' failed with exit status 1
```

This is caused by `ld` from Conda environment shadowing the system `ld`. You should use a newer version of Python that fixes this issue. The recommended Python version is 3.6.10+, 3.7.6+ and 3.8.1+.

On macOS
```bash
export CMAKE_PREFIX_PATH=${CONDA_PREFIX:-"$(dirname $(which conda))/../"}
Expand Down

0 comments on commit fcd44ce

Please sign in to comment.