赞
踩
在网上找的教程出现错误:
curl: (7) Failed to connect to raw.githubusercontent.com port 443: Operation timed out
参考了该帖子:
1.终端输入:
/bin/bash -c "$(curl -fsSL https://gitee.com/ineo6/homebrew-install/raw/master/install.sh)"
回车安装
2.终端继续输入:brew update
再测试一下有没有安装成功:brew -v
软件都会安装到 /usr/local/Cellar
安装完成后,执行brew
,就有提示
由于AppStore下载不到Xcode的历史版本,需要我升级系统,这不科学!
用下面这个网址去搜索Xcode,然后下载系统可以下载的版本,我下载的11.5的
1.Cmake官网下载地址:Download | CMake
2.安装
3.cmake配置
从菜单栏选择:Tools--How to Install For Command Line Use
如果你在命令行中输入 cmake --version,你会发现系统并不认识cmake这个命令。然后使用上面图中给出的第一种方法,即在命令行中输入:
PATH="/Applications/CMake.app/Contents/bin":"$PATH"
然后再执行cmake --version,系统就可以正确识别它了。
但是,这个方法只能管一时,在新开的命令行窗口中输入:
sudo "/Applications/CMake.app/Contents/bin/cmake-gui" --install
成功!
参考链接:在Mac OS中配置CMake的详细图文教程_libaineu2004的博客-CSDN博客
1.终端输入: brew install pcl
2.下载到一半断网了,不知道如何继续下载,然后就报错:curl: (56) LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 60
Error: pcl: Failed to download resource "boost"
终端重新输入:brew install pcl
这时,下载过的不会重新下载,他就会继续下载了~
3.出现报错:xcrun: error: active developer path ("/Users/zhanghong/Downloads/Xcode.app/Contents/Developer") does not exist Use `sudo xcode-select --switch path/to/Xcode.app` to specify the Xcode that you wish to use for command line developer tools, or use `xcode-select --install` to install the standalone command line developer tools.See `man xcode-select` for more details.
打开新的终端窗口:
输入命令查看安装路径:xcode-select -print-path
/Users/zhanghong/Downloads/Xcode.app/Contents/Developer
但我已经将 Xcode.app从下载文件夹移动到应用程序中了
真正的路径应该是:/Applications/Xcode.app/Contents/Developer
所以设置xcode-select到指定位置:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer/
输入密码,再验证是否设置成功:xcode-select --print-path
得到:/Applications/Xcode.app/Contents/Developer ;说明安装路径修改成功
然后再次重新下载: brew install pcl
4.报错:
- Error: The `brew link` step did not complete successfully
- The formula built, but is not symlinked into /usr/local
- Could not symlink bin/2to3
- Target /usr/local/bin/2to3
- already exists. You may want to remove it:
- rm '/usr/local/bin/2to3'
-
- To force the link and overwrite all conflicting files:
- brew link --overwrite python@3.9
-
- To list all files that would be deleted:
- brew link --overwrite --dry-run python@3.9
-
- Possible conflicting files are:
- /usr/local/bin/2to3 -> /Library/Frameworks/Python.framework/Versions/3.8/bin/2to3
- /usr/local/bin/idle3 -> /Library/Frameworks/Python.framework/Versions/3.8/bin/idle3
- /usr/local/bin/pydoc3 -> /Library/Frameworks/Python.framework/Versions/3.8/bin/pydoc3
- /usr/local/bin/python3 -> /Library/Frameworks/Python.framework/Versions/3.8/bin/python3
- /usr/local/bin/python3-config -> /Library/Frameworks/Python.framework/Versions/3.8/bin/python3-config
查一下冲突的文件:brew link --dry-run python@3.9
- Would link:
- /usr/local/bin/2to3
- /usr/local/bin/2to3-3.9
- /usr/local/bin/idle3
- /usr/local/bin/idle3.9
- /usr/local/bin/pydoc3
- /usr/local/bin/pydoc3.9
- /usr/local/bin/python3
- /usr/local/bin/python3-config
- /usr/local/bin/python3.9
- /usr/local/bin/python3.9-config
- /usr/local/share/man/man1/python3.1
- /usr/local/share/man/man1/python3.9.1
- /usr/local/lib/pkgconfig/python-3.9-embed.pc
- /usr/local/lib/pkgconfig/python-3.9.pc
- /usr/local/lib/pkgconfig/python3-embed.pc
- /usr/local/lib/pkgconfig/python3.pc
- /usr/local/Frameworks/Python.framework/Headers
- /usr/local/Frameworks/Python.framework/Python
- /usr/local/Frameworks/Python.framework/Resources
- /usr/local/Frameworks/Python.framework/Versions/3.9
- /usr/local/Frameworks/Python.framework/Versions/Current
强制链接并覆盖所有冲突文件,终端输入:brew link --overwrite python@3.9
5.查询安装信息:brew info pcl
1.Xcode —— 新建project-->Application-->Command Line Tool,名字就叫PCL_Test, language选择C++。
2.在PCL_Test文件夹下建立:CMakeLists.txt , 内容为:
- #cmake最低版本需求,不加入此行会受到警告信息
- CMAKE_MINIMUM_REQUIRED(VERSION 3.0)
- PROJECT(PCL_Test) #项目名称
- find_package(PCL 1.3 REQUIRED)
- include_directories(${PCL_INCLUDE_DIRS})
- link_directories(${PCL_LIBRARY_DIRS})
- add_definitions(${PCL_DEFINITIONS})
- add_executable(PCL_Test main.cpp)
- target_link_libraries(PCL_Test ${PCL_LIBRARIES})
3.在工程目录下的文件main.cpp写入:
- #include <iostream>
- #include <pcl/io/pcd_io.h>
- #include <pcl/point_types.h>
-
- int
- main (int argc, char** argv)
- {
- pcl::PointCloud<pcl::PointXYZ> cloud;
-
- // Fill in the cloud data
- cloud.width = 5;
- cloud.height = 1;
- cloud.is_dense = false;
- cloud.points.resize (cloud.width * cloud.height);
-
- for (size_t i = 0; i < cloud.points.size (); ++i)
- {
- cloud.points[i].x = 1024 * rand () / (RAND_MAX + 1.0f);
- cloud.points[i].y = 1024 * rand () / (RAND_MAX + 1.0f);
- cloud.points[i].z = 1024 * rand () / (RAND_MAX + 1.0f);
- }
-
- pcl::io::savePCDFileASCII ("test_pcd.pcd", cloud);
- std::cerr << "Saved " << cloud.points.size () << " data points to test_pcd.pcd." << std::endl;
-
- for (size_t i = 0; i < cloud.points.size (); ++i)
- std::cerr << " " << cloud.points[i].x << " " << cloud.points[i].y << " " << cloud.points[i].z << std::endl;
-
- return (0);
- }
4.在PCL_Test文件夹下新建build文件夹:mkdir build
用Cmake.app来构建
CMake Error at CMakeLists.txt:4:Parse error. Expected a newline, got identifier with text"include_directories".这种错误表示CMakeLists.txt文件第四行的换行符有问题
解决办法:后来我重新找到一个CMakeLists.txt文件,在人家文件的基础上去改的
然后又报错第四行有问题:(忘了记录下来了)
解决办法:把第四行的括号()改成英文的括号()就可以了
接着又报错:
- CMake Warning at /usr/local/lib/cmake/vtk-9.1/VTK-vtk-module-find-packages.cmake:1243 (find_package):
- By not providing "FindQt5.cmake" in CMAKE_MODULE_PATH this project has
- asked CMake to find a package configuration file provided by "Qt5", but
- CMake did not find one.
-
- Could not find a package configuration file provided by "Qt5" (requested
- version 5.15) with any of the following names:
-
- Qt5Config.cmake
- qt5-config.cmake
-
- Add the installation prefix of "Qt5" to CMAKE_PREFIX_PATH or set "Qt5_DIR"
- to a directory containing one of the above files. If "Qt5" provides a
- separate development package or SDK, be sure it has been installed.
- Call Stack (most recent call first):
- /usr/local/lib/cmake/vtk-9.1/vtk-config.cmake:150 (include)
- /usr/local/share/pcl-1.12/PCLConfig.cmake:270 (find_package)
- /usr/local/share/pcl-1.12/PCLConfig.cmake:319 (find_VTK)
- /usr/local/share/pcl-1.12/PCLConfig.cmake:543 (find_external_library)
- CMakeLists.txt:4 (find_package)
-
-
- Could not find the VTK package due to a missing dependency: Qt5
解决办法:要在CMakeLists.txt文件里的find_package前添加一行:(注意,这里/usr/local/Cellar/qt@5/5.15.5_1/lib/cmake/Qt5 写你自己QT5文件夹所处的位置)
set(CMAKE_PREFIX_PATH "/usr/local/Cellar/qt@5/5.15.5_1/lib/cmake/Qt5")
继续点击Configure构建
发现只有第三行一个警告** WARNING ** io features related to pcap will be disabled
最后写着Configuring done
- Eigen found (include: /usr/local/include/eigen3, version: 3.4.0)
- FLANN found (include: /usr/local/include, lib: /usr/local/lib/libflann_cpp.dylib)
- ** WARNING ** io features related to pcap will be disabled
- Eigen found (include: /usr/local/include/eigen3, version: 3.4.0)
- Found Qhull version 8.0.2
- Found OpenGL: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/OpenGL.framework
- Found GLEW: /usr/local/include
- looking for PCL_COMMON
- Found PCL_COMMON: /usr/local/lib/libpcl_common.dylib
- looking for PCL_KDTREE
- Found PCL_KDTREE: /usr/local/lib/libpcl_kdtree.dylib
- looking for PCL_OCTREE
- Found PCL_OCTREE: /usr/local/lib/libpcl_octree.dylib
- looking for PCL_SEARCH
- Found PCL_SEARCH: /usr/local/lib/libpcl_search.dylib
- looking for PCL_SAMPLE_CONSENSUS
- Found PCL_SAMPLE_CONSENSUS: /usr/local/lib/libpcl_sample_consensus.dylib
- looking for PCL_FILTERS
- Found PCL_FILTERS: /usr/local/lib/libpcl_filters.dylib
- looking for PCL_2D
- Found PCL_2D: /usr/local/include/pcl-1.12
- looking for PCL_GEOMETRY
- Found PCL_GEOMETRY: /usr/local/include/pcl-1.12
- looking for PCL_IO
- Found PCL_IO: /usr/local/lib/libpcl_io.dylib
- looking for PCL_FEATURES
- Found PCL_FEATURES: /usr/local/lib/libpcl_features.dylib
- looking for PCL_ML
- Found PCL_ML: /usr/local/lib/libpcl_ml.dylib
- looking for PCL_SEGMENTATION
- Found PCL_SEGMENTATION: /usr/local/lib/libpcl_segmentation.dylib
- looking for PCL_VISUALIZATION
- Found PCL_VISUALIZATION: /usr/local/lib/libpcl_visualization.dylib
- looking for PCL_SURFACE
- Found PCL_SURFACE: /usr/local/lib/libpcl_surface.dylib
- looking for PCL_REGISTRATION
- Found PCL_REGISTRATION: /usr/local/lib/libpcl_registration.dylib
- looking for PCL_KEYPOINTS
- Found PCL_KEYPOINTS: /usr/local/lib/libpcl_keypoints.dylib
- looking for PCL_TRACKING
- Found PCL_TRACKING: /usr/local/lib/libpcl_tracking.dylib
- looking for PCL_RECOGNITION
- Found PCL_RECOGNITION: /usr/local/lib/libpcl_recognition.dylib
- looking for PCL_STEREO
- Found PCL_STEREO: /usr/local/lib/libpcl_stereo.dylib
- looking for PCL_APPS
- Found PCL_APPS: /usr/local/lib/libpcl_apps.dylib
- looking for PCL_CLOUD_COMPOSER
- Found PCL_CLOUD_COMPOSER: /usr/local/include/pcl-1.12
- looking for PCL_POINT_CLOUD_EDITOR
- Found PCL_POINT_CLOUD_EDITOR: /usr/local/include/pcl-1.12
- looking for PCL_OUTOFCORE
- Found PCL_OUTOFCORE: /usr/local/lib/libpcl_outofcore.dylib
- looking for PCL_PEOPLE
- Found PCL_PEOPLE: /usr/local/lib/libpcl_people.dylib
- looking for PCL_SIMULATION
- Found PCL_SIMULATION: /usr/local/lib/libpcl_simulation.dylib
- Found PCL: pcl_common;pcl_kdtree;pcl_octree;pcl_search;pcl_sample_consensus;pcl_filters;pcl_io;pcl_features;pcl_ml;pcl_segmentation;pcl_visualization;pcl_surface;pcl_registration;pcl_keypoints;pcl_tracking;pcl_recognition;pcl_stereo;pcl_apps;pcl_outofcore;pcl_people;pcl_simulation;Boost::system;Boost::filesystem;Boost::date_time;Boost::iostreams;Boost::serialization;VTK::ChartsCore;VTK::CommonColor;VTK::CommonComputationalGeometry;VTK::CommonCore;VTK::CommonDataModel;VTK::CommonExecutionModel;VTK::CommonMath;VTK::CommonMisc;VTK::CommonTransforms;VTK::FiltersCore;VTK::FiltersExtraction;VTK::FiltersGeneral;VTK::FiltersGeometry;VTK::FiltersModeling;VTK::FiltersSources;VTK::ImagingCore;VTK::ImagingSources;VTK::InteractionImage;VTK::InteractionStyle;VTK::InteractionWidgets;VTK::IOCore;VTK::IOGeometry;VTK::IOImage;VTK::IOLegacy;VTK::IOPLY;VTK::RenderingAnnotation;VTK::RenderingCore;VTK::RenderingContext2D;VTK::RenderingLOD;VTK::RenderingFreeType;VTK::ViewsCore;VTK::ViewsContext2D;VTK::RenderingOpenGL2;VTK::GUISupportQt;FLANN::FLANN;QHULL::QHULL (Required is at least version "1.3")
- Configuring done
一个警告先不管了!
接下来Generate
老天爷啊,终于成功了!!!
接下来有个.xcodeproj文件,打开,进入Xcode的界面,Command+b,编译
出现错误:
error: Build input file cannot be found: '/Users/zhanghong/Desktop/PCL_Test/PCL_Test/main.cpp' (in target 'PCL_Test' from project 'PCL_Test')
warning: Could not read serialized diagnostics file: Cannot Load File: Failed to open diagnostics file (in target 'PCL_Test' from project 'PCL_Test')
是因为之前我更改了main.cpp的位置......
实在找不到解决办法,只好把main.cpp移回去了,妥协...
然后重新:Command+b 编译
又报错:'pcl/io/pcd_io.h' file not found
当我把这几行挨个注释后发现,这四个库其实都找不到!
解决办法:
继续编译:main.cpp --> Command+b
又有十个报错!
三天了,依旧没弄好,放弃了,不弄了!
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。