Undefined Symbols For Architecture X86 64 Macos

Nov 09, 2020 Expected resolution: The issue is fixed in 2020.2.0b14 and 2021.1.0a9. Known issue: macOS Apple silicon standalone player builds don't launch on Apple silicon devkits running macOS Big Sur beta 6. Another way can be to run gcc -ljpeg, if you get 'ld: library not found for -ljpeg' it means that gcc has not found the library (but it don't mean that it's not installed), if you get something like 'Undefined symbols: 'main', referenced from.' It means that libjpeg has been found.

  1. Undefined Symbols For Architecture X86 64 Macos Iso
  2. Undefined Symbols For Architecture X86 64 Macos Operating System
  3. Undefined Symbols For Architecture X86_64 Macos
  4. Undefined Symbols For Architecture X86 64 Macos Installer

Requirements¶

  • 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):

CUDA torch 1.7torch 1.6torch 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:

  1. 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.

  2. 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:

Undefined symbols that contains TH,aten,torch,caffe2; Missing torch dynamic libraries; Segmentation fault immediately when using detectron2.

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_envin your issue.

Undefined C++ symbols (e.g. `GLIBCXX`) or C++ symbols not found.
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.

'nvcc not found' or 'Not compiled with GPU support' or 'Detectron2 CUDA Compiler: not available'.
ForCUDA is not found when building detectron2.You should make sure

print (True,adirectorywithcuda) at the time you build detectron2.

Most models can run inference (but not training) without GPU support. To use CPUs, set MODEL.DEVICE='cpu' in the config.

'invalid device function' or 'no kernel image is available for execution'.
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” inpython-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 the TORCH_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.

Undefined CUDA symbols; Cannot open libcudart.so
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.

C++ compilation errors from NVCC / NVRTC; 'Unsupported gpu architecture'
  1. 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.

  2. 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 variableTORCH_CUDA_ARCH_LIST to a lower, supported capability.

  3. 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()).

'ImportError: cannot import name '_C'.
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.

Any issue on windows.

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.

ONNX conversion segfault after some 'TraceWarning'.
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()).

Installation inside specific environments:¶

  • Colab: see our Colab Tutorialwhich has step-by-step instructions.

  • Docker: The official Dockerfile installs detectron2 with a few simple commands.

Go Up to Delphi Compiler Directives (List) Index

Conditional compilation is based on the existence and evaluation of constants, the status of compiler switches, and the definition of conditional symbols.

  • 2Using Conditional Defines for the Compiler Version

Conditional symbols work like Boolean variables: they are either defined (True) or undefined (False). Any valid conditional symbol is treated as false until it has been defined.

You can define a conditional in the following ways:

  • Use the {$DEFINE} directive to set a specified symbol to True, and the {$UNDEF} directive to set the symbol to False.
  • Use the -D switch with the command-line compiler (this option is supported by all the Delphi compilers).
  • Add the symbol to the Conditional Defines field on the Project > Options > Delphi Compiler page.

The conditional directives {$IFDEF}, {$IFNDEF}, {$IF}, {$ELSEIF}, {$ELSE}, {$ENDIF}, and {$IFEND} allow you to compile or suppress code based on the status of a conditional symbol. {$IF} and {$ELSEIF} allow you to base conditional compilation on declared Delphi identifiers. {$IFOPT} compiles or suppresses code depending on whether a specified compiler switch is enabled.

For example, the following Delphi code snippet processes differently depending on whether the DEBUG conditional define is set ({$DEFINE DEBUG}):

Note: Conditional symbols are not Delphi identifiers and cannot be referenced in actual program code. Similarly, Delphi identifiers cannot be referenced in any conditional directives other than {$IF} and {$ELSEIF}.
Note: Conditional definitions are evaluated only when source code is recompiled. If you change a conditional symbol status and then rebuild a project, source code in unchanged units may not be recompiled. Use Project > Build All Projects to ensure that everything in your project reflects the current status of conditional symbols.
Note: If you modify the name of a conditional define in the Project > Options > Delphi Compiler, you need to Build your project (Project > Build <ProjectName> or Shift + F9) for the changes to take effect.

Conditional-directive constructions can be nested up to 32 levels deep. For every {$IFxxx}, the corresponding {$ENDIF} or {$IFEND} must be found within the same source file. Conditional symbols must start with a letter, followed by any combination of letters, digits, and underscores; they can be of any length, but only the first 255 characters are significant.

Predefined Conditionals

The following standard conditional symbols are defined:

CategorySymbolDCC32DCC64
Since XE2
DCCOSX
Since XE2
DCCOSX64
Since 10.3 Rio Release 2
DCCIOSARM
Since XE3
DCCIOS32
Since XE3
DCCAARM
In XE5
DCCIOSARM64
Since XE8
DCCLINUX64
Since 10.2 Tokyo
DCCAARM64
Since 10.3 Rio Release 3
Comments
CompilerDCCDEFINEDDEFINEDDEFINEDDEFINEDDEFINEDDEFINEDDEFINEDDEFINEDDEFINEDDEFINED
VER340
For a list of compiler versions, see Compiler Versions.
DEFINEDDEFINEDDEFINEDDEFINEDDEFINEDDEFINEDDEFINEDDEFINEDDEFINEDDEFINEDFor Delphi Sydney, compiler version 34.0 has VER340 defined.
PlatformCONSOLEDEFINEDDEFINEDDEFINEDDEFINEDDEFINEDDEFINEDDEFINEDDEFINEDDEFINEDDEFINEDDefined if an application is being compiled as a console application.
IOSnot definednot definednot definednot definedDEFINEDDEFINEDN/ADEFINEDnot definednot definedDefined if the target platform is iOS.
*New* in XE4/iOS.
IOS32not definednot definednot definednot definedDEFINEDDEFINEDnot definednot definednot definednot definedDefined if the target platform is iOS32.
Since XE8/iOSarm64.
IOS64not definednot definednot definednot definednot definednot definednot definedDEFINEDnot definednot definedDefined if the target platform is iOS64.
Since XE8/iOSarm64.
NATIVECODEDEFINEDDEFINEDDEFINEDDEFINEDDEFINEDDEFINEDDEFINEDDEFINEDDEFINEDDEFINEDSince Delphi.Net
MSWINDOWSDEFINEDDEFINEDnot definednot definednot definednot definednot definednot definednot definednot definedIndicates that the operating environment is Windows. Use MSWINDOWS to test for any flavor of the Windows platform instead of WIN32.
WIN32DEFINEDnot definednot definednot definednot definednot definednot definednot definednot definednot definedTarget platform is the native 32-bit Windows platform.
WIN64not definedDEFINEDnot definednot definednot definednot definednot definednot definednot definednot definedTarget platform is 64-bit Windows.
*New* in XE2/x64.
MACOSnot definednot definedDEFINEDDEFINEDDEFINEDDEFINEDnot definedDEFINEDnot definednot definedTarget platform is macOS.
*New* in XE2/macOS.
MACOS32not definednot definedDEFINEDnot definedDEFINEDDEFINEDnot definednot definednot definednot definedTarget platform is 32-bit macOS.
*New* in XE2/macOS.
MACOS64not definednot definednot definedDEFINEDnot definednot definednot definedDEFINEDnot definednot definedTarget platform is 64-bit macOS.
*New* in XE8/macOS.
LINUXnot definednot definednot definednot definednot definednot definednot definednot definedDEFINEDnot definedSince Kylix.
LINUX32not definednot definednot definednot definednot definednot definednot definednot definednot definednot definedSince Kylix.
LINUX64not definednot definednot definednot definednot definednot definednot definednot definedDEFINEDnot definedNew in 10.2
POSIXnot definednot definedDEFINEDDEFINEDDEFINEDDEFINEDDEFINEDDEFINEDDEFINEDDEFINEDSince Kylix.
POSIX32not definednot definedDEFINEDnot definedDEFINEDDEFINEDDEFINEDDEFINEDnot definednot definedSince Kylix.
POSIX64not definednot definednot definedDEFINEDnot definednot definednot definedDEFINEDDEFINEDDEFINEDSince Kylix.
ANDROIDnot definednot definednot definednot definednot definednot definedDEFINEDnot definednot definedDEFINEDDefined if the target platform is Android.
*New* in XE5.
ANDROID32not definednot definednot definednot definednot definednot definedDEFINEDnot definednot definednot definedSince XE8/iOSarm64.
ANDROID64not definednot definednot definednot definednot definednot definednot definednot definednot definedDEFINEDDelphi compiler for Android 64-bit platform.
*New* in 10.3.3.
CPUCPU386DEFINEDnot definedDEFINEDDEFINEDnot definedDEFINEDnot definednot definednote definednot definedIndicates that the CPU is an Intel 386 or later.
CPUX86DEFINEDnot definedDEFINEDnot definednot definedDEFINEDnot definednot definednot definednot definedCPU is an Intel 386 or later on any platform.
*New* in XE2/x64.
CPUX64not definedDEFINEDnot definedDEFINEDnot definednot definednot definednot definedDEFINEDnot definedThe CPU supports the x86-64 instruction set, and is in a 64-bit environment.
*New* in XE2/x64.
CPU32BITSDEFINEDnot definedDEFINEDnot definedDEFINEDDEFINEDDEFINEDnot definednot definednot definedThe CPU is in a 32-bit environment, such as DCC32.EXE.
*New* in XE8.
CPU64BITSnot definedDEFINEDnot definedDEFINEDnot definednot definednot definedDEFINEDDEFINEDDEFINEDThe CPU is in a 64-bit environment, such as DCC64.EXE.
*New* in XE8.
CPUARMnot definednot definednot definednot definedDEFINEDnot definedDEFINEDDEFINEDnot definedDEFINEDDefined if the CPU is based on the ARM architecture, such as the Delphi mobile compiler for the iOS device (DCCIOSARM.EXE).
*New* in XE4/iOS.
CPUARM32not definednot definednot definednot definedDEFINEDnot definedDEFINEDnot definednot definednot definedThe CPU is in a 32-bit ARM environment, such as DCCIOSARM.EXE.
*New* in XE8.
CPUARM64not definednot definednot definednot definednot definednot definednot definedDEFINEDnot definedDEFINEDThe CPU is in a 64-bit ARM environment, such as DCCIOSARM64.EXE.
*New* in XE8.
Availability
ALIGN_STACKnot definednot definedDEFINEDnot definednot definedDEFINEDnot definednot definednot definednot definedDefined in code that may be shared with the macOS compiler and another compiler on another platform such as Linux that does not have a rigid stack alignment requirement. For more information, see Eli Boling's blog at http://blogs.embarcadero.com/eboling/2009/05/20/5607 .
*New* in XE2/macOS.
ASSEMBLERDEFINEDDEFINEDDEFINEDnot definednot definedDEFINEDnot definednot definednot definednot definedAssembler syntax is accepted.
AUTOREFCOUNT (*)not definednot definednot definedDEFINEDDEFINEDDEFINEDDEFINEDDEFINEDDEFINED if 10.2.
Not defined since 10.3.
not definedDefined for compilers that use automatic reference counting, such as the Delphi mobile compilers.
*New* in XE4/iOS. Removed in 10.4 Sydney.
EXTERNALLINKERnot definednot definednot definedDEFINEDDEFINEDnot definedDEFINEDDEFINEDDEFINEDDEFINEDDefined for compilers that have an external linker and the LLVM code generator; the Delphi mobile compilers have the external ld linker and use LLVM as code generator.
*New* in XE4/iOS.
UNICODEDEFINEDDEFINEDDEFINEDDEFINEDDEFINEDDEFINEDDEFINEDDEFINEDDEFINEDDEFINEDUNICODE is defined as the default string type.
CONDITIONALEXPRESSIONSDEFINEDDEFINEDDEFINEDDEFINEDDEFINEDDEFINEDDEFINEDDEFINEDDEFINEDDEFINEDTests for the use of the $IF directive.
ELFnot definednot definednot definednot definednot definednot definednot definednot definedDEFINEDnot definedDefined when targeting Executable and Linkable Format (ELF) files.
NEXTGEN (*)not definednot definednot definedDEFINEDDEFINEDDEFINEDDEFINEDDEFINEDDEFINED if 10.2.
Not defined since 10.3.
not definedDefined for compilers (such as the Delphi mobile compilers) that use 'next-generation' language features, such as 0-based strings.
*New* in XE4/iOS. Removed in 10.4 Sydney.
PC_MAPPED_EXCEPTIONSnot definednot definedDEFINEDnot definednot definedDEFINEDnot definednot definednot definednot definedDefined when compiling on a platform or for a target platform that uses address maps instead of stack frames to unwind exceptions (such as macOS).
*New* in XE2.
PICneverneveralways DEFINEDalways DEFINEDalways DEFINEDalways DEFINEDalways DEFINEDalways DEFINEDalways DEFINEDalways DEFINEDDefined for platforms that require Position-Independent Code (PIC), such as macOS.
UNDERSCOREIMPORTNAMEDEFINEDnot definedDEFINEDnot definednot definedDEFINEDnot definednot definednot definednot definedDefined for compilers that add a leading underscore (for example, in names of dynamic libraries imported from Mac OS).
*New* in XE4/iOS.
WEAKREFnot definednot definednot definedDEFINEDDEFINEDDEFINEDDEFINEDDEFINEDDEFINEDDEFINEDDefined for compilers that can use weak references (the [weak] attribute).
*New* in XE4/iOS.
WEAKINSTREF (*)not definednot definednot definedDEFINEDDEFINEDDEFINEDDEFINEDDEFINEDDEFINED if 10.2.
Not defined since 10.3.
not definedDefined when weak references are defined for instances.
*New* in XE4/iOS. Removed in 10.4 Sydney.
WEAKINTFREFnot definednot definednot definedDEFINEDDEFINEDDEFINEDDEFINEDDEFINEDDEFINEDDEFINEDDefined when weak references are defined for interfaces.
*New* in XE4/iOS.
Attention: The symbols followed by an asterisk (*) were defined for Delphi mobile compilers in the past, but they have been removed in RAD Studio 10.4 Sydney as part of the removal of the ARC memory model.

In the table column heads:

  • DCC32 is the 32-bit Windows Delphi compiler.
  • 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 iOS devices.
  • DCCLINUX64 is the 64-bit Linux Delphi compiler.
  • DCCAARM64.EXE is the Delphi compiler for 64-bit Android devices.

Using Conditional Defines for the Compiler Version

For example, to determine the version of the compiler and run-time library that were used to compile your code, you can use {$IF} with the CompilerVersion, RTLVersion and other constants:

Undefined Symbols For Architecture X86 64 Macos Iso

See the table of Compiler Versions for a list of version numbers associated with various released Delphi compilers.

Predefined Constants

Constants can be more powerful than conditionals because you can use constants programmatically in Delphi code. Conditionals, on the other hand, are accepted only inside conditional compiler directives such as {$IF} and {$IFDEF}.

Undefined Symbols For Architecture X86 64 Macos Operating System

There are three important constants available:

Undefined Symbols For Architecture X86_64 Macos

  • System.RTLVersion is a constant defined as the version of the run-time library. For Sydney, RTLVersion is 34.
  • System.CompilerVersion is a constant defined as the version of the current Delphi compiler. For Sydney, CompilerVersion is 34.
  • FMX.Types.FireMonkeyVersion is a constant defined as the version of the current FireMonkey library. For Sydney, FireMonkeyVersion is 270.

See Also

Undefined Symbols For Architecture X86 64 Macos Installer

  • CompilerVersion_(Delphi) Code Example
  • IF directive (Delphi) and IFEND directive (Delphi)
  • IFDEF directive (Delphi) and ENDIF directive (Delphi)
  • Delphi Compiler page in Project Options
Retrieved from 'http://docwiki.embarcadero.com/RADStudio/Sydney/e/index.php?title=Conditional_compilation_(Delphi)&oldid=271838'