I installed vtk on my Mac using
brew install vtk
then for testing purpose, I download a random example https://examples.vtk.org/site/Cxx/GeometricObjects/Cube/
then using the instruction as mentioned in the page to run example, it ran successfully.
Then when I opened the project using Clion, I encountered build error.
[1/1] Linking CXX executable Cube.app/Contents/MacOS/Cube
FAILED: Cube.app/Contents/MacOS/Cube
: && /Library/Developer/CommandLineTools/usr/bin/c++ -O3 -DNDEBUG -arch x86_64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names @CMakeFiles/Cube.rsp -o Cube.app/Contents/MacOS/Cube && :
ld: warning: ignoring file /opt/homebrew/lib/libvtkRenderingFreeType-9.2.9.2.6.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /opt/homebrew/lib/libvtkRenderingOpenGL2-9.2.9.2.6.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /opt/homebrew/lib/libvtkRenderingContext2D-9.2.9.2.6.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /opt/homebrew/lib/libvtkRenderingHyperTreeGrid-9.2.9.2.6.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /opt/homebrew/lib/libvtkRenderingUI-9.2.9.2.6.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /opt/homebrew/lib/libvtkRenderingContextOpenGL2-9.2.9.2.6.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /opt/homebrew/lib/libvtkInteractionStyle-9.2.9.2.6.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /opt/homebrew/lib/libvtkRenderingCore-9.2.9.2.6.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /opt/homebrew/lib/libvtkCommonColor-9.2.9.2.6.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /opt/homebrew/lib/libvtkCommonExecutionModel-9.2.9.2.6.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /opt/homebrew/lib/libvtkCommonTransforms-9.2.9.2.6.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /opt/homebrew/lib/libvtkRenderingGL2PSOpenGL2-9.2.9.2.6.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /opt/homebrew/lib/libvtkFiltersGeneral-9.2.9.2.6.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /opt/homebrew/lib/libvtkFiltersCore-9.2.9.2.6.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /opt/homebrew/lib/libvtkCommonDataModel-9.2.9.2.6.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /opt/homebrew/lib/libvtkCommonMisc-9.2.9.2.6.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /opt/homebrew/lib/libvtksys-9.2.9.2.6.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /opt/homebrew/lib/libvtkfreetype-9.2.9.2.6.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /opt/homebrew/lib/libvtkkissfft-9.2.9.2.6.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /opt/homebrew/lib/libvtkCommonMath-9.2.9.2.6.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /opt/homebrew/lib/libGLEW.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /opt/homebrew/lib/libvtkCommonCore-9.2.9.2.6.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
Undefined symbols for architecture x86_64:
"vtkInteractionStyle_AutoInit_Construct()", referenced from:
__GLOBAL__sub_I_Cube.cxx in Cube.cxx.o
"vtkRenderingOpenGL2_AutoInit_Construct()", referenced from:
__GLOBAL__sub_I_Cube.cxx in Cube.cxx.o
"vtkRenderingFreeType_AutoInit_Construct()", referenced from:
__GLOBAL__sub_I_Cube.cxx in Cube.cxx.o
"vtkDataSet::GetScalarRange()", referenced from:
_main in Cube.cxx.o
"vtkPolyData::New()", referenced from:
_main in Cube.cxx.o
"vtkPolyData::SetPolys(vtkCellArray*)", referenced from:
_main in Cube.cxx.o
"vtkRenderer::SetActiveCamera(vtkCamera*)", referenced from:
_main in Cube.cxx.o
"vtkRenderer::New()", referenced from:
_main in Cube.cxx.o
"vtkRenderer::AddActor(vtkProp*)", referenced from:
_main in Cube.cxx.o
"vtkCellArray::New()", referenced from:
_main in Cube.cxx.o
"vtkDataArray::InsertTuple1(long long, double)", referenced from:
_main in Cube.cxx.o
"vtkFloatArray::New()", referenced from:
_main in Cube.cxx.o
"vtkNamedColors::GetColor3d(vtkStdString const&)", referenced from:
_main in Cube.cxx.o
"vtkNamedColors::New()", referenced from:
_main in Cube.cxx.o
"vtkRenderWindow::New()", referenced from:
_main in Cube.cxx.o
"vtkPolyDataMapper::SetInputData(vtkPolyData*)", referenced from:
_main in Cube.cxx.o
"vtkPolyDataMapper::New()", referenced from:
_main in Cube.cxx.o
"vtkDataSetAttributes::SetScalars(vtkDataArray*)", referenced from:
_main in Cube.cxx.o
"vtkDebugLeaksManager::vtkDebugLeaksManager()", referenced from:
__GLOBAL__sub_I_Cube.cxx in Cube.cxx.o
"vtkDebugLeaksManager::~vtkDebugLeaksManager()", referenced from:
__GLOBAL__sub_I_Cube.cxx in Cube.cxx.o
"vtkRenderWindowInteractor::SetRenderWindow(vtkRenderWindow*)", referenced from:
_main in Cube.cxx.o
"vtkRenderWindowInteractor::New()", referenced from:
_main in Cube.cxx.o
"vtkObjectFactoryRegistryCleanup::vtkObjectFactoryRegistryCleanup()", referenced from:
__GLOBAL__sub_I_Cube.cxx in Cube.cxx.o
"vtkObjectFactoryRegistryCleanup::~vtkObjectFactoryRegistryCleanup()", referenced from:
__GLOBAL__sub_I_Cube.cxx in Cube.cxx.o
"vtksys::SystemToolsManager::SystemToolsManager()", referenced from:
__GLOBAL__sub_I_Cube.cxx in Cube.cxx.o
"vtksys::SystemToolsManager::~SystemToolsManager()", referenced from:
__GLOBAL__sub_I_Cube.cxx in Cube.cxx.o
"vtkActor::New()", referenced from:
_main in Cube.cxx.o
"vtkCamera::SetPosition(double, double, double)", referenced from:
_main in Cube.cxx.o
"vtkCamera::SetFocalPoint(double, double, double)", referenced from:
_main in Cube.cxx.o
"vtkCamera::New()", referenced from:
_main in Cube.cxx.o
"vtkPoints::New()", referenced from:
_main in Cube.cxx.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
I don’t understand what went wrong.
ld: symbol(s) not found for architecture x86_64
this is a very general error and could be caused by a lot of reasons.
I’ve searched through and didn’t find anyone who has the same problem.
My configuration:
macOS 13.4.1 (22F82)
vtk info:
Any help is appreciated!