CMAKE error with Opencv in a workflow (github actions) - macos

I have a workflow on Github actions that is building on my macbook x64. It was working well until I formatted it and reinstalled it.
My last task which use maierj/fastlane-action#v1.4.0 is failing with this error :
FAILURE: Build failed with an exception.
* What went wrong: Execution failed for task ':app:generateJsonModelRelease'.
> /actions-runner/_work/app/CMakeLists.txt : C/C++ release|armeabi-v7a : CMake Error at /actions-runner/_work/app/CMakeLists.txt:16 (find_package):
By not providing "FindOpenCV.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "OpenCV", but
CMake did not find one.
Could not find a package configuration file provided by "OpenCV" with any
of the following names:
OpenCVConfig.cmake
opencv-config.cmake
Add the installation prefix of "OpenCV" to CMAKE_PREFIX_PATH or set
"OpenCV_DIR" to a directory containing one of the above files. If "OpenCV"
provides a separate development package or SDK, be sure it has been
installed.
I know the issue is on my machine as it was ok before (and not the code). I tried to install cmake and opencv on my machine but nothing changed. Do you have any idea of what I can do ?

Related

How to debug "Not including path /opt/homebrew/opt/opencv/lib in runtime library search path because it is outside target root..."

I am unable to debug a runtime error that exhibits when running a project that includes OpenCV Rust bindings https://crates.io/crates/opencv/0.65.0
The project builds successfully:
[17:24:47] myuser:metadata-portal git:(main*) $ cargo build --release
Finished release [optimized] target(s) in 0.46s
Running a cargo command fails:
cargo run --release collect
[2022-10-24T21:05:56Z DEBUG cargo::core::compiler] Not including path /opt/homebrew/opt/opencv/lib in runtime library search path because it is outside target root /Users/<myuser>/code/metadata-portal/target/release
Running `target/release/metadata-cli collect`
[2022-10-24T21:05:57Z ERROR] No such file or directory (os error 2)
I have installed opencv from brew: brew install opencv and can confirm that /opt/homebrew/opt/opencv/lib exists and is populated.
How might one go about debugging this?
The debug output above was a red herring. The issue was actually defined by the ERROR message. A directory was missing in the structure of the project that was implementing the OpenCV bindings.

Boost build instructions for windows/codeblocks, help sought

I got windows 7 x64, was dl'ing the windows 7 .net 4 sdk when I figured out how to build the bjam.exe file after failing to fulfill these instructions
http://wiki.codeblocks.org/index.php?title=BoostWindowsQuickRef#Set_up_a_Code::Blocks_global_variable_for_Boost
but when I run bjam, I still get a failure.
these are the steps I did
had to add
f:\codeblocks\mingw\bin
to path
THEN open command prompt as administrator (not before path)
then run from boost_1_51_0\tools\build\v2\engine\build.bat
then I could do
bjam --toolset=gcc "--prefix=<installpath>" install
but I get this message when I do
F:\libraries\boost_1_51_0>bjam --toolset=gcc "--prefix=f:\codeblocks" install --
build-type=complete
warning: mismatched versions of Boost.Build engine and core
warning: Boost.Build engine (bjam) is 03.1.18
warning: Boost.Build core (at F:/libraries/boost_1_51_0/tools/build/v2) is 2011.
12-svn
F:/libraries/boost_1_51_0/tools/build/v2/util\path.jam:476: in path.makedirs
rule MAKEDIR unknown in module path.
F:/libraries/boost_1_51_0/tools/build/v2/build\configure.jam:190: in configure.s
et-log-file
F:/libraries/boost_1_51_0/tools/build/v2\build-system.jam:725: in load
F:\libraries\boost_1_51_0\tools\build\v2/kernel\modules.jam:283: in import
F:\libraries\boost_1_51_0\tools\build\v2\kernel\bootstrap.jam:142: in boost-buil
d
F:\libraries\boost_1_51_0\boost-build.jam:17: in module scope
almost looks like linux path's are getting scrambled into the mix
I figured it out.
I redownloaded the bjam that was in the instructions, dumped it to the f:\libraries\bjam folder I had initially setup.
set path=f:\libraries\bjam yadad;%PATH$ whatever command
cd to boost_1_51_0 dir
reran build command
to actually get something to build
I had to add this to other linker options
or , you have to add "$(#boost.lib)\libboost_system-mgw44.lib" into "Other linker options".
source
http://forums.codeblocks.org/index.php?topic=11908.5;wap2

Firebreath Cmake not found when cmake 2.8.8 is installed on MacOsX

When trying to build an xcode project with the following command line:
./firebreath/prepmac.sh projects/ build/
I get:
Using projects in: /Users/uwecerron/Desktop/Node/projects
Generating build files in: /Users/uwecerron/Desktop/Node/build
NOTE: The build files in /Users/uwecerron/Desktop/Node/build should NEVER be modified directly. Make changes in cmake and re-run this script.
~/Desktop/Node/build ~/Desktop/Node
./firebreath/prepmac.sh: line 10: cmake: command not found
CMake failed. Please check error messages
There are no error messages, and i have cmake 2.8-8 installed. Any suggestions on what to do? this is for a kinect project using depthjs.
When you installed cmake it would have ask you if you wanted to install the command line links; you probably accidentally told it not to. Install cmake again and tell it to install the command-line links and it should work fine.

qmake gives code 3 when attempting to configure qt for static building

I have the latest Qt SDK. I'm trying to configure it for static building with VS2010 (dynamic linking works fine) I have it at this location: C:\QtSDK\Desktop\Qt\4.8.0\msvc2010
When I go there with the VS2010 command prompt and try to run configure -static, or configure -static I get some output but in the end it fails with
Generating Makefiles...
WARNING: c:\QtSDK\Desktop\Qt\4.8.0\msvc2010\projects.pro:44: Unable to find file
for inclusion src\src.pro
WARNING: c:\QtSDK\Desktop\Qt\4.8.0\msvc2010\projects.pro:46: Unable to find file
for inclusion doc\doc.pri
Reading C:/QtSDK/Desktop/Qt/4.8.0/msvc2010/tools
Reading C:/QtSDK/Desktop/Qt/4.8.0/msvc2010/translations/translations.pro
Reading C:/QtSDK/Desktop/Qt/4.8.0/msvc2010/examples
Reading C:/QtSDK/Desktop/Qt/4.8.0/msvc2010/demos
Qmake failed, return code 3
Please help
I downloaded the source zip file instead of trying to work with what came in the SDK and it's working now. Just download the source from here, unzip it, and run the configure.exe in the unzipped folder. My guess (although I have inspected this) is that there's missing source files or other resources in the SDK version.

Building libcurl with SSL support on Windows

I'm using libcurl in a Win32 C++ application.
I have the curllib.vcproj project added to my solution and set my other projects to depend on it.
How do I build it with SSL support enabled?
Well, since this post failed badly, I had to dig into the matter myself.
Also check out the other answers and comments for additional info regarding other versions etc.
EDIT: Since I posted this Q there seems to be ready-built binaries made available from the curl homepage. Check out James' answer.
So here goes:
-
Preprocessor
The following two symbols need to be fed to the preprocessor to enable SSL for libcurl:
USE_SSLEAY
USE_OPENSSL
(libcurl uses OpenSSL for SSL support)
Alternatively the symbols can be added directly to a file called setup.h in libcurl, but I'm not too happy about modifying code in 3rd party distributions unless I really have to.
Rebuilding the libcurl library, I now got some errors about OpenSSL include files not being found. Naturally, since I haven't set up the OpenSSL distribution properly yet.
Compiling OpenSSL binaries
I downloaded the OpenSSL 0.9.8 source distribution and unpacked it.
In the root of the source distribution there's a file called INSTALL.W32 which describes how to compile the OpenSSL binaries. The build chain requires perl, so I installed the latest version of ActivePerl.
I had some trouble with the build, which might not be applicable to all systems, but I'll go through it here in case somebody experiences the same.
According to INSTALL.W32:
Run the following commandline tasks with current directory set to the source distribution root:
1> perl Configure VC-WIN32 --prefix=c:/some/openssl/dir
(Where "c:/some/openssl/dir" should be replaced by the dir where OpenSSL should be installed. Don't use spaces in this path. The compilation further ahead will fail in that case)
2> ms\do_ms
For me this step was unsuccessful at first, since I lacked the environment variables OSVERSION and TARGETCPU. I set these to 5.1.2600 and x86 respectively. You may get complaint about OSVERSION being "insane", but look closer, this error is for WinCE and doesn't affect the Win32 setup. To get hold of your OS version, run the 'ver' command from a command prompt or run winver.exe.
3> nmake -f ms\nt.mak (for static library)
or
3> nmake -f ms\ntdll.mak (for DLL)
The source now compiles. Took approx 5 minutes on my laptop.
When compilation is completed, the libs or binaries have been placed in:
distroot/out32 - for static library build
or
distroot/out32dll - for DLL build
Building and linking
Now, back to visual studio and point out the libs and include path for headers. The include files are located in distroot/inc32/openssl.
Remember to add libeay32.lib and ssleay32.lib as linker input.
Rebuild the libcurl project.
Error!
Well at least for me with this version of OpenSSL.
it complained about a struct typedef in one of the OpenSSL headers. I couldn't find any info on this. After an hour of googling I broke my own principle and commented out the typedef from the OpenSSL header, and luckily libcurl wasn't using that symbol so it built fine.
Update: As pointed out by Jason, this issue seems to have dissapeared as of version 1.0.0a.
Now, for confirming that SSL support is enabled for libcurl, run the following code:
curl_version_info_data * vinfo = curl_version_info( CURLVERSION_NOW );
if( vinfo->features & CURL_VERSION_SSL )
// SSL support enabled
else
// No SSL
Simple as that.
Maybe this isn't the answer anyone is looking for, but I simply just downloaded the precompiled DLLs from this link found at http://curl.haxx.se/download.html
I ran the test that sharkin provided, and if( vinfo->features & CURL_VERSION_SSL ) proved to be true.
Following Robert Oschler's advice, here is my comment on the question as answer :
You can build recent libcurl (2012) with native SSL support for windows using the preprocessor symbols: USE_WINDOWS_SSPI and USE_SCHANNEL instead of the OpenSSL ones.
When compiling OpenSSL 1.0.0 on Windows with Visual Studio 2010, it eventually threw a 0x2 error:
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0
\VC\BIN\cl.EXE"' : return code '0x2'
Stop.
It seems that this error will be thrown because of a flag in the perl Configure file, namely -WX.
As the MSDN documentation states:
Treats all compiler warnings as errors. For a new project, it may be best to use /WX in all compilations; resolving all warnings will ensure the fewest possible hard-to-find code defects.
After removing the -WX occurrences in the Configure file and re-entering the commands stated here it built fine and passed all tests.
In my case follow the curl README file was enough.
My configuration is the following:
Visual Studio 2015 (VC14)
Static library
Win64
curl version 7.57.0
OpenSSL 1.0.2
Compilation of libCurl
Download libcurl source there: https://curl.haxx.se/download.html
Uncompress the file and go to the folder curl-7.57.0\projects
Open the README file and follow the instructions, this lead me to do the following:
Downloaded OpenSSL
Extract it and rename it to openssl, put it aside the curl folder, this is important as you'll open the VS project that expect to find openssl there.
Install Perl
Execute the utility build-openssl.bat to perform the compilation of openSSL. With my settings this became the following:
.\build-openssl.bat vc14 x64 release ..\..\openssl\
just runs .\build-openssl.bat -help to know more about the parameters.
After that you can see OpenSSL has been compiled as you got a new folder here: openssl\build\Win64
Open the Visual Studio project curl-7.57.0\projects\Windows\VC14\curl-all.sln
Be sure to set the visual studio project to the build configuration you need (LIB Release - LIB OpenSSL in my case)
Build all
The library is located at curl-7.57.0\build\Win64\VC14\LIB Release - LIB OpenSSL\libcurl.lib
Remarks
Don't forget to define the CURL_STATICLIB preprocessor in your own project
With static library, you will have to links with the dependencies of libcurl, see this answer
You might not want to depend on LDAP, in that case you can disable it by setting the preprocessor CURL_DISABLE_LDAP before you compile libcurl.
If you build with Visual Studio IDE and get 58 odd warnings as the likes of
"inconsistent dll linkage curl_global_init / curl_msnprintf /..."
you should add CURL_STATICLIB to the preproccessor definitions.
so the entire definition line should look like:
USE_SSLEAY;USE_OPENSSL;CURL_STATICLIB.
With this all the warning will disappear.
Some would ignore the warnings and go on using the libs, but then will get corresponding *error*s as the likes of curl_global_init / curl_msnprintf. It can be very annoying.
Hope it can help somebody.
\ fatal error C1083: Cannot open include
file: 'stdlib.h': No such file or directory
NMAKE: fatal error U1077::return code
That error can be solved by executing vcvarsall.bat in Visual Studio.
How to build libcurl C/C++ with OpenSSL (SSL support) on Windows
Install libcurl
Install OpenSSl
Build libcurl with OpenSSL
Installing libcurl
Go to the download page of libcurl and donwnload the ZIP file under Source Archives. In my case it is called curl-7.58.0.zip
Extract the archive and open projects/Windows/VC15/curl_all.sln with Visual Studio.
Installing OpenSSL
Download the windows binary of OpenSSL. In my case, I downloaded the windows installer file Win32 OpenSSL v1.1.0g from the Shining Light Productions distribution.
The installation folder for me is C:\OpenSSL-Win32.
Building libcurl with OpenSSL
In the curl_all.sln Visual Studio solution file, change the build configuration to DLL Debug - DLL OpenSSL.
In the Solution Explorer, right click the project curl and go to Properties.
Under Linker -> General modify Additional Library Directories and add the path to your OpenSSL directory + \lib. In my case, this is C:\OpenSSL-Win32\lib.
Apply and close the properties window.
Right click the project libcurl and do the same as the previous step, add OpenSSL directory + \lib to Additional Library Directories under Linker -> General.
Under C/C++ -> General, add C:\OpenSSL-Win32\include to the Additional Include Directories.
Finally go to Linker -> Input and modify Additional Dependencies. Replace all the lib files to the following:
ws2_32.lib
wldap32.lib
openssl.lib
libssl.lib
libcrypto.lib
Apply and close the properties window.
With the DLL Debug - DLL OpenSSL build configuration still selected, go to Build -> Build Solution.
Copy the two dll files libcrypto-1_1.dll and libssl-1_1.dll from the OpenSSL bin directory (C:\OpenSSL-Win32\bin) to the just created build directory curl-7.58.0\build\Win32\VC15\DLL Debug - DLL OpenSSL.
Validating Build
Inside the build directory, run curld.exe. If it runs with no errors (missing dll, etc.) then your build was successful.
i did "do_nt.bat" for windows 7 rc7100
don't forget "nmake -f ms\nt.mak install" to copy the headers correctly
thanks this did help a lot
Couple of notes in response to and/or in addition to the above..
First, if you don't want to mess with ActivePerl, Strawberry Perl is terrific and worked perfectly for this.
Second, in lieu of using do_ms.bat, I would recommend preferring do_masm if possible since, according to INSTALL.W32,
This is worth doing because it will
result in faster code: for example it
will typically result in a 2 times
speedup in the RSA routines.
Also, build 0.9.8l (L) of OpenSSL was a nightmare so I eventually gave up and reverted to 0.9.8k which built and linked (statically) with libcurl 1.9 without issue.

Resources