- Architecture X64
- Macos G++ Undefined Symbols For Architecture X86_64
- Undefined Symbols For Architecture X86 64 Macos Operating System
Requirements¶
Jul 24, 2020 DCC64 is the 64-bit Windows Delphi compiler. DCCOSX is the 32-bit macOS Delphi compiler. DCCOSX64 is the 64-bit macOS Delphi compiler. DCCIOSARM is the Delphi compiler for 32-bit iOS Devices. DCCIOS32 is the Delphi compiler for iOS Simulators. DCCAARM.EXE is the Delphi compiler for Android devices. DCCIOSARM64 is the Delphi compiler for 64-bit. If you get linker errors about undefined references to symbols that involve types in the std::cxx11 namespace or the tag abi:cxx11 then it probably indicates that you are trying to link together object files that were compiled with different values for the GLIBCXXUSECXX11ABI macro. Dec 11, 2017 I have GCC 4.8.1 with x86, x8664 and PPC on Lion with ObjC, C/C11, Fortan, Ada Go support. And now I can compile PHP, WxWidgets, QT and many other source without problems like on Apple Clang vesion. Gcc builded with llvm-gcc-4.2.
These code models are x86-64-specific; something similar exists for most other architectures, but the exact set of 'models' and the associated limits will vary. (On a 32-bit architecture, for instance, you might have a 'small' model in which the total amount of code and data was limited to something like 2 24 bytes.).
- Linux or macOS with Python ≥ 3.6
- PyTorch ≥ 1.6 and torchvision that matches the PyTorch installation.Install them together at pytorch.org to make sure of this
- OpenCV is optional but needed by demo and visualization
Build Detectron2 from Source¶
gcc & g++ ≥ 5.4 are required. ninja is recommended for faster build.After having them, run:
To rebuild detectron2 that’s built from a local clone, use
rm-rfbuild/**/*.so
to clean theold build first. You often need to rebuild detectron2 after reinstalling PyTorch.Install Pre-Built Detectron2 (Linux only)¶
Choose from this table to install v0.3 (Nov 2020):
Architecture X64
CUDA | torch 1.7 | torch 1.6 | torch 1.5 |
---|---|---|---|
11.0 | install | ||
10.2 | install | install | install |
10.1 | install | install | install |
9.2 | install | install | install |
cpu | install | install | install |
Note that:
- The pre-built package has to be used with corresponding version of CUDA and the official package of PyTorch.Otherwise, please build detectron2 from source.
- New packages are released every few months. Therefore, packages may not contain latest features in the masterbranch and may not be compatible with the master branch of a research project that uses detectron2(e.g. those in projects).
Common Installation Issues¶
Click each issue for its solutions:
This usually happens when detectron2 or torchvision is notcompiled with the version of PyTorch you’re running.
If the error comes from a pre-built torchvision, uninstall torchvision and pytorch and reinstall themfollowing pytorch.org. So the versions will match.
If the error comes from a pre-built detectron2, check release notesto see the corresponding pytorch version required for each pre-built detectron2.Or uninstall and reinstall the correct pre-built detectron2.
If the error comes from detectron2 or torchvision that you built manually from source,remove files you built (
build/
, **/*.so
) and rebuild it so it can pick up the version of pytorch currently in your environment.If you cannot resolve this problem, please include the output of
gdb-ex'r'-ex'bt'-ex'quit'--argspython-mdetectron2.utils.collect_env
in your issue.Usually it's because the library is compiled with a newer C++ compiler but run with an old C++ runtime.
This often happens with old anaconda.Try
condaupdatelibgcc
. Then rebuild detectron2.The fundamental solution is to run the code with proper C++ runtime.One way is to use
LD_PRELOAD=/path/to/libstdc++.so
.CUDA is not found when building detectron2.You should make sure
print
(True,adirectorywithcuda)
at the time you build detectron2.![Undefined Symbols For Architecture X86 64 Macos Undefined Symbols For Architecture X86 64 Macos](https://i.imgur.com/KN4YeDn.png)
Most models can run inference (but not training) without GPU support. To use CPUs, set
MODEL.DEVICE='cpu'
in the config.Two possibilities:
- You build detectron2 with one version of CUDA but run it with a different version.To check whether it is the case,use
python-mdetectron2.utils.collect_env
to find out inconsistent CUDA versions.In the output of this command, you should expect “Detectron2 CUDA Compiler”, “CUDA_HOME”, “PyTorch built with - CUDA”to contain cuda libraries of the same version.When they are inconsistent,you need to either install a different build of PyTorch (or build by yourself)to match your local CUDA installation, or install a different version of CUDA to match PyTorch. - PyTorch/torchvision/Detectron2 is not built for the correct GPU SM architecture (aka. compute capability).The architecture included by PyTorch/detectron2/torchvision is available in the “architecture flags” in
python-mdetectron2.utils.collect_env
. It must includethe architecture of your GPU, which can be found at developer.nvidia.com/cuda-gpus.If you’re using pre-built PyTorch/detectron2/torchvision, they have included support for most popular GPUs already.If not supported, you need to build them from source.When building detectron2/torchvision from source, they detect the GPU device and build for only the device.This means the compiled code may not work on a different GPU device.To recompile them for the correct architecture, remove all installed/compiled files,and rebuild them with theTORCH_CUDA_ARCH_LIST
environment variable set properly.For example,exportTORCH_CUDA_ARCH_LIST='6.0;7.0'
makes it compile for both P100s and V100s.
The version of NVCC you use to build detectron2 or torchvision doesnot match the version of CUDA you are running with.This often happens when using anaconda's CUDA runtime.
Use
python-mdetectron2.utils.collect_env
to find out inconsistent CUDA versions.In the output of this command, you should expect “Detectron2 CUDA Compiler”, “CUDA_HOME”, “PyTorch built with - CUDA”to contain cuda libraries of the same version.When they are inconsistent,you need to either install a different build of PyTorch (or build by yourself)to match your local CUDA installation, or install a different version of CUDA to match PyTorch.
- Local CUDA/NVCC version has to match the CUDA version of your PyTorch. Both can be found in
pythoncollect_env.py
.When they are inconsistent, you need to either install a different build of PyTorch (or build by yourself)to match your local CUDA installation, or install a different version of CUDA to match PyTorch. - Local CUDA/NVCC version shall support the SM architecture (a.k.a. compute capability) of your GPU.The capability of your GPU can be found at developer.nvidia.com/cuda-gpus.The capability supported by NVCC is listed at here.If your NVCC version is too old, this can be workaround a lower capability.environment variable
TORCH_CUDA_ARCH_LIST
to a lower, supported capability. - The combination of NVCC and GCC you use is incompatible. You need to change one of their versions.See here for some valid combinations.Notably, CUDA<=10.1.105 doesn’t support GCC>7.3.The CUDA/GCC version used by PyTorch can be found by
print(torch.__config__.show())
.
Please build and install detectron2 following the instructions above.
Or, if you are running code from detectron2’s root directory,
cd
to a different one.Otherwise you may not import the code that you installed.Detectron2 is continuously built on windows with CircleCI.However we do not provide official support for it.PRs that improves code compatibility on windows are welcome.
The ONNX package is compiled with a too old compiler.
Please build and install ONNX from its source code using a compilerwhose version is closer to what’s used by PyTorch (available in
torch.__config__.show()
).Macos G++ Undefined Symbols For Architecture X86_64
Installation inside specific environments:¶
Undefined Symbols For Architecture X86 64 Macos Operating System
- Colab: see our Colab Tutorialwhich has step-by-step instructions.
- Docker: The official Dockerfile installs detectron2 with a few simple commands.