Skip to content

Unable to create .pylib file with Mac Sonoma. #41

@ChurikiTenna

Description

@ChurikiTenna

I want to compile the library into .dylib file in Mac.
However, cmake --build . fails with 'png.h' file not found error.

git clone https://github.com/aetilius/pHash.git
brew install libpng jpeg ffmpeg
mkdir build    
cd build
cmake ../pHash    
cmake --build .

[ 50%] Building CXX object CMakeFiles/pHash.dir/src/pHash.cpp.o
In file included from /Users/tenna/pHash/src/pHash.cpp:25:
In file included from /Users/tenna/pHash/src/pHash.h:60:
/Users/tenna/pHash/third-party/CImg/CImg.h:470:10: fatal error: 'png.h' file not found
#include "png.h"
         ^~~~~~~
1 error generated.
make[2]: *** [CMakeFiles/pHash.dir/src/pHash.cpp.o] Error 1
make[1]: *** [CMakeFiles/pHash.dir/all] Error 2
make: *** [all] Error 2

libpng is already installed.

% brew install libpng            
Warning: libpng 1.6.43 is already installed and up-to-date.

but the png.h location was not in the default /usr/local/include, so I added this to CMakeLists.txt

include_directories("/Library/Frameworks/Mono.framework/Versions/6.12.0/include")

Then, I tried
% cmake ../pHash
% cmake --build .
which produced this error:


[ 50%] Building CXX object CMakeFiles/pHash.dir/src/pHash.cpp.o
In file included from /Users/tenna/pHash/src/pHash.cpp:25:
In file included from /Users/tenna/pHash/src/pHash.h:60:
/Users/tenna/pHash/third-party/CImg/CImg.h:2894:29: warning: 'vsprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use vsnprintf(3) instead. [-Wdeprecated-declarations]
    const int result = std::vsprintf(s, format, args);
                            ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/usr/include/stdio.h:199:1: note: 'vsprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use vsnprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/usr/include/sys/cdefs.h:218:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
1 warning generated.
make[2]: *** No rule to make target `/opt/homebrew/lib/libmpg123.dylib', needed by `Release/libpHash.1.0.0.dylib'.  Stop.
make[1]: *** [CMakeFiles/pHash.dir/all] Error 2
make: *** [all] Error 2

then I tried to create phash.dylib from pHash.cpp like this.
% g++ -dynamiclib -o phash.dylib pHash.cpp
It fails with this error:

In file included from pHash.cpp:25:
./pHash.h:60:10: fatal error: 'CImg.h' file not found
#include "CImg.h"
         ^~~~~~~~
1 error generated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions