andydevs / fractool

Generic fractal image generator
https://andydevs.github.io/fractool
MIT License
1 stars 0 forks source link

Not able to save PNG Images #35

Closed andydevs closed 2 years ago

andydevs commented 2 years ago

I get a warning that says compiled with libpng-1.4.something but running 1.6.something and then no image saves

andydevs commented 2 years ago

There seems to be headers that the compilation process finds and compiles with that are mismatched with the actual library

andydevs commented 2 years ago

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.

andydevs commented 2 years ago

The png header in 3rdparty libraries is up to date

andydevs commented 2 years ago

I've tried looking into the makefiles... the only thing I can think of is checking if there's an include path

andydevs commented 2 years ago

Also, will try and uninstall libpng from mac

andydevs commented 2 years ago

Libpng has dependencies... It's cool that brew can check that automatically

andydevs commented 2 years ago

Actual warning:

libpng warning: Application built with libpng-1.4.12 but running with 1.6.37
andydevs commented 2 years ago

Hail mary mother of God I am uninstalling libpng

andydevs commented 2 years ago

And it doesn't work

andydevs commented 2 years ago

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

andydevs commented 2 years ago

So it works on the server, so it's specifically a macos issue

andydevs commented 2 years ago

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

andydevs commented 2 years ago

Checking the opencv build logs, I found this config

PNG:                         libpng (ver 1.6.37)
andydevs commented 2 years ago

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

andydevs commented 2 years ago

The png headers in the mac's /usr/local/include/png.h is 1.6.37

andydevs commented 2 years ago

So I don't get it...

andydevs commented 2 years ago

I'm gonna try finding every location of png.h on my computer using find command

andydevs commented 2 years ago

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

andydevs commented 2 years ago

Confirmed

andydevs commented 2 years ago

So the apple clang compiler's search path will include this directory. Let me check

andydevs commented 2 years ago

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)
andydevs commented 2 years ago

I don't see mono framework here...

andydevs commented 2 years ago

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

andydevs commented 2 years ago

Changed it to clang.

Still don' work :-(

andydevs commented 2 years ago

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

andydevs commented 2 years ago

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

andydevs commented 2 years ago

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

andydevs commented 2 years ago

Did the following:

andydevs commented 2 years ago

It is done