Closed andydevs closed 2 years ago
There seems to be headers that the compilation process finds and compiles with that are mismatched with the actual library
I've checked the cmake files in opencv and libpng was compiled as a static library. I've tried running otoll -L
for libopencv_imgcodecs and libopencv_imgproc and I don't see the library link in the list. So it should be statically linked.
The png header in 3rdparty libraries is up to date
I've tried looking into the makefiles... the only thing I can think of is checking if there's an include path
Also, will try and uninstall libpng from mac
Libpng has dependencies... It's cool that brew can check that automatically
Actual warning:
libpng warning: Application built with libpng-1.4.12 but running with 1.6.37
Hail mary mother of God I am uninstalling libpng
And it doesn't work
Tell ya what I'll try fixing the install issue so I can get it to work on the CI server.
In the mean time I'll try running this build on windows and see what that does
So it works on the server, so it's specifically a macos issue
It becomes a problem because the 3rd party libs are built as static libs, so it's hard to track how the library is used...
Checking the opencv build logs, I found this config
PNG: libpng (ver 1.6.37)
So it finds the latest libpng.
I also checked the headers in the 3rd party libraries, and the version is 1.6.37. So we're pulling in headers from some other place idk...
The png headers in the mac's /usr/local/include/png.h
is 1.6.37
So I don't get it...
I'm gonna try finding every location of png.h
on my computer using find
command
I think I found it...
/Library/Frameworks/Mono.framework/Versions/6.12.0/include/png.h
/Library/Frameworks/Mono.framework/Versions/6.12.0/include/libpng14/png.h
So this bull right here is the culprit...
Confirmed
So the apple clang compiler's search path will include this directory. Let me check
Ran clang in verbose mode. These are the include search paths:
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1
/Library/Developer/CommandLineTools/usr/lib/clang/12.0.5/include
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
/Library/Developer/CommandLineTools/usr/include
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks (framework directory)
I don't see mono framework here...
I checked the CMakeCache.txt file. Apparently I'm using a random compiler that's not clang or gcc... It's some other compiler that I have...
Let me try and change it
Changed it to clang.
Still don' work :-(
There's apparently a flag I can set which is set(CMAKE_FIND_FRAMEWORK LAST)
. This might be able to defer searching frameworks to after opencv is downloaded and the 3rd party libs are exposed
The offending framework is Mono, which has an outdated libpng and is searched first.
I also have to deal with the issue of boost not being found after compilation...
So there was an issue with the program not finding the locations of the .dylib's.
Apparently I fixed it by updating the "rpath" using CMAKE_SET_RPATH
I did it... I am the winner
Turns out the secret sauce was to add -DCMAKE_FIND_FRAMEWORKS=LAST
to the list of cmake arguments in the ExternalProject_Add for OpenCV.
That fixed it. I did it... after weeks of searching. And I've documented my struggles so there's that
Did the following:
IMPORTED_SONAME
to make sure that the library config tool being used can properly configure libraryIt is done
I get a warning that says compiled with libpng-1.4.something but running 1.6.something and then no image saves