Content-Length: 293425 | pFad | http://github.com/opencv/opencv/issues/27505

1E Cannot build with CMake on Mac -- zlib · Issue #27505 · opencv/opencv · GitHub
Skip to content

Cannot build with CMake on Mac -- zlib #27505

Closed
@bashtavenko

Description

@bashtavenko

System Information

Build failure on Mac related to Zlib.

   31%] Built target ittnotify
make[1]: *** [3rdparty/zlib/CMakeFiles/zlib.dir/all] Error 2
[ 31%] Built target quirc
[ 31%] Built target jsimd
[ 32%] Linking C static library ../lib/liblibwebp.a
[ 32%] Built target libwebp
[ 32%] Linking C static library ../../lib/liblibopenjp2.a
[ 32%] Built target libopenjp2
[ 32%] Built target carotene_objs

Detailed description

The script that I used

#!/bin/bash

set -e

# Parse command line argument
BUILD_TYPE="Release"
if [ "$1" = "debug" ]; then
    BUILD_TYPE="Debug"
    echo "Building in Debug mode..."
elif [ "$1" != "" ] && [ "$1" != "release" ]; then
    echo "Usage: $0 [debug|release]"
    echo "  debug   - Build debug version with symbols"
    echo "  release - Build optimized release version (default)"
    exit 1
fi

# Configuration
OPENCV_VERSION="4.8.0"
BUILD_DIR="$HOME/opencv_build"
if [ "$BUILD_TYPE" = "Debug" ]; then
    INSTALL_DIR="$BUILD_DIR/install_debug"
    BUILD_SUBDIR="build_debug"
else
    INSTALL_DIR="$BUILD_DIR/install"
    BUILD_SUBDIR="build"
fi

echo "Building OpenCV ${OPENCV_VERSION} in $BUILD_TYPE mode..."

# Create and enter build directory
mkdir -p "$BUILD_DIR"
cd "$BUILD_DIR"

# Download sources if they don't exist
if [ ! -d "opencv-${OPENCV_VERSION}" ]; then
    echo "Downloading OpenCV ${OPENCV_VERSION}..."
    curl -L "https://github.com/opencv/opencv/archive/refs/tags/${OPENCV_VERSION}.tar.gz" -o "opencv-${OPENCV_VERSION}.tar.gz"
    tar -xzf "opencv-${OPENCV_VERSION}.tar.gz"
fi

# Create build directory
mkdir -p "$BUILD_SUBDIR"
cd "$BUILD_SUBDIR"

echo "Configuring CMake for $BUILD_TYPE build..."
cmake \
    -DCMAKE_BUILD_TYPE="$BUILD_TYPE" \
    -DBUILD_LIST=calib3d,core,features2d,highgui,imgcodecs,imgproc,video,videoio,objdetect \
    -DWITH_FFMPEG=ON \
    -DWITH_GTK=OFF \
    -DWITH_QT=ON \
    -DBUILD_SHARED_LIBS=ON \
    -DCMAKE_INSTALL_PREFIX="$INSTALL_DIR" \
    -DOPENCV_GENERATE_PKGCONFIG=ON \
    -DBUILD_TESTS=OFF \
    -DBUILD_PERF_TESTS=OFF \
    -DBUILD_EXAMPLES=OFF \
    "../opencv-${OPENCV_VERSION}"

echo "Building OpenCV..."
make -j$(nproc)

echo "Installing OpenCV..."
make install

echo "Creating .408 version symlinks..."
cd "$INSTALL_DIR/lib"
for lib in libopencv_*.so.4.8.0; do
    if [ -f "$lib" ]; then
        base=$(basename "$lib" .so.4.8.0)
        ln -sf "$lib" "${base}.so.408"
        echo "Created symlink: ${base}.so.408 -> $lib"
    fi
done

echo ""
echo "Build completed successfully!"
echo "Build type: $BUILD_TYPE"
echo "Libraries installed in: $INSTALL_DIR/lib"
echo "Headers installed in: $INSTALL_DIR/include"
echo ""
echo "Required libraries:"
ls -la "$INSTALL_DIR/lib"/libopencv_*.so.408 2>/dev/null || echo "No .408 symlinks found"

if [ "$BUILD_TYPE" = "Debug" ]; then
    echo ""
    echo "Debug build complete. Use this path for debugging:"
    echo "  Libraries: $INSTALL_DIR/lib"
    echo "  Headers: $INSTALL_DIR/include"
fi



### Steps to reproduce

You can run my script on Mac

### Issue submission checklist

- [x] I report the issue, it's not a question
- [x] I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
- [ ] I updated to the latest OpenCV version and the issue is still there
- [x] There is reproducer code and related data files (videos, images, onnx, etc)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions









      ApplySandwichStrip

      pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


      --- a PPN by Garber Painting Akron. With Image Size Reduction included!

      Fetched URL: http://github.com/opencv/opencv/issues/27505

      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy