Gee, I’ve missed a few posts, here.
I’ve read this thread: Compiling ART on OSX
and I forgot to come back here for news.
So.
Here’s where I am now:
modified: CMakeLists.txt
modified: ProcessorTargets.cmake
modified: tools/osx/macosx_bundle.sh
diff --git a/CMakeLists.txt b/CMakeLists.txt
index cc5c2b09b..9f631e3a8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -507,7 +507,8 @@ endif()
if(WITH_LTO)
# Using LTO with older versions of binutils requires setting extra flags
set(BINUTILS_VERSION_MININUM "2.29")
- execute_process(COMMAND ar --version
+ #execute_process(COMMAND ar --version
+ execute_process(COMMAND bash "-c" "$(brew --prefix llvm)/bin/llvm-ar --version | gawk 'match($0, /version ([0-9.]+)/, VERSION){print VERSION[1]}'"
OUTPUT_VARIABLE BINUTILS_VERSION_DETECTED)
string(REGEX REPLACE ".* ([0-9.]+)\n.*" "\\1" BINUTILS_VERSION_DETECTED
"${BINUTILS_VERSION_DETECTED}")
diff --git a/ProcessorTargets.cmake b/ProcessorTargets.cmake
index aa06b29ee..b2c35dc53 100644
--- a/ProcessorTargets.cmake
+++ b/ProcessorTargets.cmake
@@ -6,7 +6,8 @@ set(PROC_TARGET_1_FLAGS "-mtune=generic" CACHE STRING "Processor-1 flags")
# This second choice should be used for your own build only
set(PROC_TARGET_2_LABEL native CACHE STRING "Processor-2 label - use it for your own build")
-set(PROC_TARGET_2_FLAGS "-march=native" CACHE STRING "Processor-2 flags")
+#set(PROC_TARGET_2_FLAGS "-march=native" CACHE STRING "Processor-2 flags")
+set(PROC_TARGET_2_FLAGS "-mcpu=native" CACHE STRING "Processor-2 flags")
# The later choices is intended to be used if you want to provide specific builds, but it should match your own processor
# You can cross compile but you have to know what you're doing, this mechanism has not been designed for that
diff --git a/tools/osx/macosx_bundle.sh b/tools/osx/macosx_bundle.sh
index e3dc61857..787d4cd8f 100644
--- a/tools/osx/macosx_bundle.sh
+++ b/tools/osx/macosx_bundle.sh
@@ -138,7 +138,7 @@ MACOS="${CONTENTS}/MacOS"
LIB="${CONTENTS}/Frameworks"
ETC="${RESOURCES}/etc"
EXECUTABLE="${MACOS}/rawtherapee"
-GDK_PREFIX="${LOCAL_PREFIX}/local/"
+GDK_PREFIX="${LOCAL_PREFIX}/"
msg "Removing old files:"
rm -rf "${APP}" *.dmg *.zip
@@ -165,13 +165,13 @@ echo "Bundle UUID: $(uuidgen|tr 'A-Z' 'a-z')" >> "${RESOURCES}/AboutThisBuild.
# Copy the Lensfun database into the app bundle
mkdir -p "${RESOURCES}/share/lensfun"
-ditto ${LOCAL_PREFIX}/local/share/lensfun/version_2/* "${RESOURCES}/share/lensfun"
+ditto ${LOCAL_PREFIX}/share/lensfun/version_2/* "${RESOURCES}/share/lensfun"
# Copy liblensfun to Frameworks
-ditto ${LOCAL_PREFIX}/local/lib/liblensfun.2.dylib "${CONTENTS}/Frameworks/liblensfun.2.dylib"
+ditto ${LOCAL_PREFIX}/lib/liblensfun.2.dylib "${CONTENTS}/Frameworks/liblensfun.2.dylib"
# Copy libomp to Frameworks
-ditto ${LOCAL_PREFIX}/local/lib/libomp.dylib "${CONTENTS}/Frameworks"
+ditto ${LOCAL_PREFIX}/lib/libomp.dylib "${CONTENTS}/Frameworks"
msg "Copying dependencies from ${GTK_PREFIX}."
CheckLink "${EXECUTABLE}"
@@ -180,29 +180,29 @@ CheckLink "${EXECUTABLE}"
ModifyInstallNames
# Copy libjpeg-turbo ("62") into the app bundle
-ditto ${LOCAL_PREFIX}/local/lib/libjpeg.62.dylib "${CONTENTS}/Frameworks/libjpeg.62.dylib"
+ditto ${LOCAL_PREFIX}/lib/libjpeg.62.dylib "${CONTENTS}/Frameworks/libjpeg.62.dylib"
# Copy libexpat into the app bundle (which is keg-only)
if [[ -d /usr/local/Cellar/expat ]]; then ditto /usr/local/Cellar/expat/*/lib/libexpat.1.dylib "${CONTENTS}/Frameworks"; else ditto "${EXPATLIB}" "${CONTENTS}/Frameworks/libexpat.1.dylib"; fi
# Copy libz into the app bundle
-ditto ${LOCAL_PREFIX}/local/lib/libz.1.dylib "${CONTENTS}/Frameworks"
+ditto ${LOCAL_PREFIX}/lib/libz.1.dylib "${CONTENTS}/Frameworks"
# Copy libpng16 to the app bundle
-ditto ${LOCAL_PREFIX}/local/lib/libpng16.16.dylib "${CONTENTS}/Frameworks/libpng16.16.dylib"
+ditto ${LOCAL_PREFIX}/lib/libpng16.16.dylib "${CONTENTS}/Frameworks/libpng16.16.dylib"
# Copy libtiff 5 into the app bundle
-ditto ${LOCAL_PREFIX}/local/lib/libtiff.5.dylib "${CONTENTS}/Frameworks/libtiff.5.dylib"
+ditto ${LOCAL_PREFIX}/lib/libtiff.5.dylib "${CONTENTS}/Frameworks/libtiff.5.dylib"
# Copy the Lensfun database into the app bundle
mkdir -p "${RESOURCES}/share/lensfun"
-ditto ${LOCAL_PREFIX}/local/share/lensfun/version_2/* "${RESOURCES}/share/lensfun"
+ditto ${LOCAL_PREFIX}/share/lensfun/version_2/* "${RESOURCES}/share/lensfun"
# Copy liblensfun to Frameworks
-ditto ${LOCAL_PREFIX}/local/lib/liblensfun.2.dylib "${CONTENTS}/Frameworks/liblensfun.2.dylib"
+ditto ${LOCAL_PREFIX}/lib/liblensfun.2.dylib "${CONTENTS}/Frameworks/liblensfun.2.dylib"
# Copy libomp to Frameworks
-ditto ${LOCAL_PREFIX}/local/lib/libomp.dylib "${CONTENTS}/Frameworks"
+ditto ${LOCAL_PREFIX}/lib/libomp.dylib "${CONTENTS}/Frameworks"
# Prepare GTK+3 installation
msg "Copying configuration files from ${GTK_PREFIX}:"
@@ -222,19 +222,19 @@ rm -r "${LIB}"/gdk-pixbuf-2.0
# GTK+3 themes
msg "Copy GTK+3 theme and icon resources:"
-ditto {"${LOCAL_PREFIX}/local","${RESOURCES}"}/share/themes/Mac/gtk-3.0/gtk-keys.css
-ditto {"${LOCAL_PREFIX}/local","${RESOURCES}"}/share/themes/Default/gtk-3.0/gtk-keys.css
+ditto {"${LOCAL_PREFIX}","${RESOURCES}"}/share/themes/Mac/gtk-3.0/gtk-keys.css
+ditto {"${LOCAL_PREFIX}","${RESOURCES}"}/share/themes/Default/gtk-3.0/gtk-keys.css
# Adwaita icons
msg "Copy Adwaita icons"
iconfolders=("16x16/actions" "16x16/devices" "16x16/mimetypes" "16x16/places" "16x16/status" "48x48/devices")
for f in "${iconfolders[@]}"; do
mkdir -p ${RESOURCES}/share/icons/Adwaita/${f}
- ditto ${LOCAL_PREFIX}/local/share/icons/Adwaita/${f}/* "${RESOURCES}"/share/icons/Adwaita/${f}
+ ditto ${LOCAL_PREFIX}/share/icons/Adwaita/${f}/* "${RESOURCES}"/share/icons/Adwaita/${f}
done
-ditto {"${LOCAL_PREFIX}/local","${RESOURCES}"}/share/icons/Adwaita/index.theme
-"${LOCAL_PREFIX}/local/bin/gtk-update-icon-cache" "${RESOURCES}/share/icons/Adwaita"
-ditto "${LOCAL_PREFIX}/local/share/icons/hicolor" "${RESOURCES}/share/icons/hicolor"
+ditto {"${LOCAL_PREFIX}","${RESOURCES}"}/share/icons/Adwaita/index.theme
+"${LOCAL_PREFIX}/bin/gtk-update-icon-cache" "${RESOURCES}/share/icons/Adwaita"
+ditto "${LOCAL_PREFIX}/share/icons/hicolor" "${RESOURCES}/share/icons/hicolor"
# fix libfreetype install name
for lib in "${LIB}"/*; do
@@ -243,8 +243,8 @@ done
# pixbuf loaders & immodules
msg "Build GTK3 databases:"
-"${LOCAL_PREFIX}"/local/bin/gdk-pixbuf-query-loaders "${LIB}"/libpix*.so > "${ETC}"/gtk-3.0/gdk-pixbuf.loaders
-"${LOCAL_PREFIX}"/local/bin/gtk-query-immodules-3.0 "${LIB}"/im-* > "${ETC}"/gtk-3.0/gtk.immodules
+"${LOCAL_PREFIX}/bin/gdk-pixbuf-query-loaders" "${LIB}"/libpix*.so > "${ETC}"/gtk-3.0/gdk-pixbuf.loaders
+"${LOCAL_PREFIX}/bin/gtk-query-immodules-3.0" "${LIB}"/im-* > "${ETC}"/gtk-3.0/gtk.immodules
sed -i "" -e "s|${PWD}/RawTherapee.app/Contents/|/Applications/RawTherapee.app/Contents/|" "${ETC}/gtk-3.0/gdk-pixbuf.loaders" "${ETC}/gtk-3.0/gtk.immodules"
sed -i "" -e "s|/opt/local/|/Applications/RawTherapee.app/Contents/Frameworks/|" "${ETC}/gtk-3.0/gtk.immodules"
@@ -253,7 +253,7 @@ ModifyInstallNames
# Mime directory
msg "Copying shared files from ${GTK_PREFIX}:"
-ditto {"${LOCAL_PREFIX}/local","${RESOURCES}"}/share/mime
+ditto {"${LOCAL_PREFIX}","${RESOURCES}"}/share/mime
msg "Installing required application bundle files:"
PROJECT_SOURCE_DATA_DIR="${PROJECT_SOURCE_DIR}/tools/osx"
@@ -273,8 +273,8 @@ update-mime-database -V "${RESOURCES}/share/mime"
msg "Build glib database:"
mkdir -p ${RESOURCES}/share/glib-2.0
-ditto {"${LOCAL_PREFIX}/local","${RESOURCES}"}/share/glib-2.0/schemas
-"${LOCAL_PREFIX}/local/bin/glib-compile-schemas" "${RESOURCES}/share/glib-2.0/schemas"
+ditto {"${LOCAL_PREFIX}","${RESOURCES}"}/share/glib-2.0/schemas
+"${LOCAL_PREFIX}/bin/glib-compile-schemas" "${RESOURCES}/share/glib-2.0/schemas"
# Append an LC_RPATH
msg "Registering @rpath into the main executable."
@@ -285,7 +285,7 @@ ModifyInstallNames
# fix @rpath in Frameworks
msg "Registering @rpath in Frameworks folder."
for frameworklibs in "${LIB}"/*{dylib,so,cli}; do
- install_name_tool -delete_rpath ${LOCAL_PREFIX}/local/lib "${frameworklibs}"
+ install_name_tool -delete_rpath ${LOCAL_PREFIX}/lib "${frameworklibs}"
install_name_tool -add_rpath /Applications/"${LIB}" "${frameworklibs}"
done
install_name_tool -delete_rpath RawTherapee.app/Contents/Frameworks "${EXECUTABLE}"-cli
-
cmake build: bear with me, I’m reaaally not familiar with this. I’ve tried to simplify the command in Rawpedia when it made sense. But I’m not sure I’m doing things right.
#!/bin/bash
mkdir -p build
cd build
pwd
sudo rm -r *
which brew || exit 2
export PATH="$(brew --prefix llvm)/bin:$PATH" && echo "PATH: $PATH"
export CC="$(brew --prefix llvm)/bin/clang" && echo "CC: $CC"
export CXX="${CC}++" && echo "CXX: $CXX"
export CMAKE_AR="$(brew --prefix llvm)/bin/llvm-ar" && echo "CMAKE_AR: $CMAKE_AR"
export CMAKE_RANLIB="$(brew --prefix llvm)/bin/llvm-ranlib" && echo "CMAKE_RANLIB: $CMAKE_RANLIB"
export PKG_CONFIG_PATH="/opt/homebrew/opt/libffi/lib/pkgconfig:/opt/homebrew/opt/expat/lib/pkgconfig"
export LDFLAGS="-L$(brew --prefix llvm)/lib -Wl,-rpath,$(brew --prefix llvm)/lib -L/opt/homebrew/opt/libffi/lib -L/opt/homebrew/opt/expat/lib -L/opt/homebrew/lib" && \
export CPPFLAGS="-I$(brew --prefix llvm)/include -I$(brew --prefix llvm)/include/c++/v1/ -I/opt/homebrew/opt/libffi/include -I/opt/homebrew/opt/expat/include" && \
export XDG_DATA_DIRS="/Applications/RawTherapee.app/Contents/Resources/share /Applications/RawTherapee.app/Contents/MacOS/rawtherapee" && \
cmake .. -DCMAKE_BUILD_TYPE="release" \
-DLOCAL_PREFIX="$(brew --prefix)" \
-DCMAKE_OSX_DEPLOYMENT_TARGET="11.2" \
-DPROC_TARGET_NUMBER="2" \
-DCACHE_NAME_SUFFIX="5.8-dev" \
-DCMAKE_C_COMPILER="$CC" \
-DCMAKE_CXX_COMPILER="$CXX" \
-DWITH_LTO="ON" \
-DOpenMP_C_LIB_NAMES="libomp" \
-DOpenMP_CXX_LIB_NAMES="libomp" \
-DOpenMP_libomp_LIBRARY="/opt/homebrew/lib/libomp.dylib" \
-DOpenMP_C_FLAGS="-fopenmp=libomp -Wno-pass-failed -Wno-deprecated-register -Xpreprocessor -fopenmp /opt/homebrew/lib/libomp.dylib -I/opt/homebrew/include/" \
-DOpenMP_CXX_FLAGS="-fopenmp=libomp -Wno-pass-failed -Wno-deprecated-register -Xpreprocessor -fopenmp /opt/homebrew/lib/libomp.dylib -I/opt/homebrew/include/" \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DCMAKE_EXE_LINKER_FLAGS="$LDFLAGS" \
-DCMAKE_CXX_FLAGS="$CPPFLAGS" \
-DCMAKE_AR="${CMAKE_AR}" \
-DCMAKE_RANLIB="${CMAKE_RANLIB}" \
-DCMAKE_LINKER="$(brew --prefix llvm)/bin/lld"
-
cmake console output: fftw3f multithread test failed.
/Users/cynamon/programs/code-rawtherapee/build
Password:
/opt/homebrew/bin/brew
PATH: /opt/homebrew/opt/llvm/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin
CC: /opt/homebrew/opt/llvm/bin/clang
CXX: /opt/homebrew/opt/llvm/bin/clang++
CMAKE_AR: /opt/homebrew/opt/llvm/bin/llvm-ar
CMAKE_RANLIB: /opt/homebrew/opt/llvm/bin/llvm-ranlib
-- The C compiler identification is Clang 11.0.1
-- The CXX compiler identification is Clang 11.0.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/homebrew/opt/llvm/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /opt/homebrew/opt/llvm/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- CMAKE_BUILD_TYPE: release
-- Found PkgConfig: /opt/homebrew/bin/pkg-config (found version "0.29.2")
-- Checking for module 'gtk+-3.0>=3.16'
-- Found gtk+-3.0, version 3.24.24
-- Checking for module 'gtkmm-3.0>=3.16'
-- Found gtkmm-3.0, version 3.24.3
-- Checking for module 'glib-2.0>=2.48'
-- Found glib-2.0, version 2.66.6
-- Checking for module 'glibmm-2.4>=2.48'
-- Found glibmm-2.4, version 2.66.0
-- Checking for module 'cairomm-1.0'
-- Found cairomm-1.0, version 1.14.2
-- Checking for module 'gio-2.0>=2.48'
-- Found gio-2.0, version 2.66.6
-- Checking for module 'giomm-2.4>=2.48'
-- Found giomm-2.4, version 2.66.0
-- Checking for module 'gthread-2.0>=2.48'
-- Found gthread-2.0, version 2.66.6
-- Checking for module 'gobject-2.0>=2.48'
-- Found gobject-2.0, version 2.66.6
-- Checking for module 'sigc++-2.0>=2.3.1'
-- Found sigc++-2.0, version 2.10.6
-- Checking for module 'lensfun>=0.2'
-- Found lensfun, version 0.3.95.0
-- Checking for module 'librsvg-2.0>=2.40'
-- Found librsvg-2.0, version 2.50.3
-- Checking for module 'lcms2>=2.6'
-- Found lcms2, version 2.12
-- Checking for module 'expat>=2.1'
-- Found expat, version 2.2.10
-- Checking for module 'fftw3f'
-- Found fftw3f, version 3.3.9
-- Checking for module 'libiptcdata'
-- Found libiptcdata, version 1.0.4
-- Checking for module 'libtiff-4>=4.0.4'
-- Found libtiff-4, version 4.2.0
-- Found JPEG: /opt/homebrew/lib/libjpeg.dylib (found version "90")
-- Found ZLIB: /Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk/usr/lib/libz.tbd (found version "1.2.11")
-- Found PNG: /opt/homebrew/lib/libpng.dylib (found version "1.6.37")
-- Found OpenMP_C: -fopenmp=libomp -Wno-pass-failed -Wno-deprecated-register -Xpreprocessor -fopenmp /opt/homebrew/lib/libomp.dylib -I/opt/homebrew/include/ (found version "5.0")
-- Found OpenMP_CXX: -fopenmp=libomp -Wno-pass-failed -Wno-deprecated-register -Xpreprocessor -fopenmp /opt/homebrew/lib/libomp.dylib -I/opt/homebrew/include/ (found version "5.0")
-- Found OpenMP: TRUE (found version "5.0")
-- Performing Test _fftw3f_multithread
-- Performing Test _fftw3f_multithread - Failed
-- Performing Test LENSFUN_HAS_LOAD_DIRECTORY
-- Performing Test LENSFUN_HAS_LOAD_DIRECTORY - Success
-- Found MacIntegration: /opt/homebrew/lib/libgtkmacintegration-gtk3.dylib
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/cynamon/programs/code-rawtherapee/build
-
if it helps, here are two CMake log files:
CMakeError.log.txt (4.5 KB) CMakeOutput.log.txt (36.2 KB) -
I’m “able” to make install and make bundle, but I still have many warnings and ultimately, launching the app fails.
@HIRAM, should I patch a few more files? do a comparison with what you’ve shared?
Thanks!
EDIT: I’ve read the patch you suggested we should apply. It seems to lack an important change in order to make use of llvm-ar
, instead of Apple ar
+ execute_process(COMMAND bash "-c" "$(brew --prefix llvm)/bin/llvm-ar --version | gawk 'match($0, /version ([0-9.]+)/, VERSION){print VERSION[1]}'"