@ginnokami By using makepkg.conf
, naturally (https://wiki.archlinux.org/title/Makepkg#Building_optimized_binaries) and by having Clang installed.
I build almost all packages with Clang.
Git Clone URL: | https://aur.archlinux.org/waifu2x-caffe.git (read-only, click to copy) |
---|---|
Package Base: | waifu2x-caffe |
Description: | Image rescaling and noise reduction using the power of convolutional neural networks. Rewritten from the original Waifu2x using Caffe. Compiled with CUDA & cuDNN enabled flags. |
Upstream URL: | https://github.com/Gin-no-kami/waifu2x-caffe |
Licenses: | MIT |
Conflicts: | waifu2x-caffe |
Provides: | waifu2x-caffe |
Submitter: | ginnokami |
Maintainer: | ginnokami |
Last Packager: | ginnokami |
Votes: | 3 |
Popularity: | 0.002687 |
First Submitted: | 2021-04-18 23:44 (UTC) |
Last Updated: | 2023-07-30 20:38 (UTC) |
@ginnokami By using makepkg.conf
, naturally (https://wiki.archlinux.org/title/Makepkg#Building_optimized_binaries) and by having Clang installed.
I build almost all packages with Clang.
@Neko-san No idea how you are getting clang into the chroot. This uses gcc to compile.
I can't get this to build for some reason, even in a chroot :/
-- The C compiler identification is Clang 15.0.7
-- The CXX compiler identification is Clang 15.0.7
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/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: /usr/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Deprecation Warning at caffe/CMakeLists.txt:1 (cmake_minimum_required):
Compatibility with CMake < 3.5 will be removed from a future version of
CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
-- The CUDA compiler identification is NVIDIA 12.2.91
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - done
-- Check for working CUDA compiler: /opt/cuda/bin/nvcc - skipped
-- Detecting CUDA compile features
-- Detecting CUDA compile features - done
CMake Warning (dev) at caffe/cmake/Misc.cmake:32 (set):
implicitly converting 'BOOLEAN' to 'STRING' type.
Call Stack (most recent call first):
caffe/CMakeLists.txt:33 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - no
CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find Threads (missing: Threads_FOUND)
Call Stack (most recent call first):
/usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake/Modules/FindThreads.cmake:226 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
/usr/share/cmake/Modules/CMakeFindDependencyMacro.cmake:76 (find_package)
/usr/lib/cmake/boost_thread-1.81.0/boost_thread-config.cmake:118 (find_dependency)
/usr/lib/cmake/Boost-1.81.0/BoostConfig.cmake:141 (find_package)
/usr/lib/cmake/Boost-1.81.0/BoostConfig.cmake:262 (boost_find_component)
/usr/share/cmake/Modules/FindBoost.cmake:594 (find_package)
caffe/cmake/Dependencies.cmake:8 (find_package)
caffe/CMakeLists.txt:83 (include)
-- Configuring incomplete, errors occurred!
==> ERROR: A failure occurred in prepare().
Aborting...
@nx-que Thank you for the patch. I confirmed that it builds in a chroot and have updated it here.
It seems there were quite a few breaking changes, here is a working PKGBUILD patch
diff --git a/PKGBUILD b/PKGBUILD
index 462777b..8a0c383 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -24,7 +24,7 @@ depends=(
makedepends=(
'git'
'cmake'
- 'qt5-base'
+ 'qt6-base'
)
optdepends=()
provides=('waifu2x-caffe')
@@ -55,15 +55,20 @@ prepare() {
cd "${srcdir}/waifu2x-caffe"
git submodule update --init --recursive
- # Change Source.cpp to update the model file location
- sed -i 's+models/cunet+/usr/share/waifu2x-caffe/models/cunet+g' waifu2x-caffe/Source.cpp
-
# create symlink to caffe
ln -sf ../caffe ./caffe
ln -sf ../caffe ./libcaffe
+ # compile targets under C++17
+ sed -i 's~-std=c++14~-std=c++17~g' CMakeLists.txt
+ sed -i 's~-std=c++14~-std=c++17~g' caffe/Makefile.config
+ sed -i 's~-std=c++14~-std=c++17~g' caffe/Makefile.config.example
+
+ # Change Source.cpp to update the model file location
+ sed -i 's+models/cunet+/usr/share/waifu2x-caffe/models/cunet+g' waifu2x-caffe/Source.cpp
+
cd ${srcdir}/build
- cmake "${srcdir}/waifu2x-caffe" -DCUDA_NVCC_FLAGS="-D_FORCE_INLINES -gencode arch=compute_86,code=sm_86 "
+ cmake "${srcdir}/waifu2x-caffe" -DCMAKE_EXE_LINKER_FLAGS="-Wl,--copy-dt-needed-entries" -DCMAKE_SHARED_LINKER_FLAGS="-Wl,--copy-dt-needed-entries" -DCUDA_NVCC_FLAGS="-D_FORCE_INLINES -gencode arch=compute_86,code=sm_86 "
# Fix issue with the compile failing. These flags need to be removed from the CUDA_FLAGS, but I can't find which CMakeFile is generating this line. So just remove it with sed.
sed -i 's/-Xcudafe --diag_suppress=set_but_not_used -DBOOST_ALL_NO_LIB;-DUSE_LMDB;-DUSE_LEVELDB;-DUSE_CUDNN;-DUSE_OPENCV;-DWITH_PYTHON_LAYER//g' libcaffe/src/caffe/CMakeFiles/caffe.dir/flags.make
}
Bumped everything to C++17 (forced by other dependencies), libopencv_highgui requires qt6-base libraries now and applied (temporary) workaround for linker failure around this protobuf issue until it's fixed upstream.
Note that missing headers for cblas is still an issue, when blas-openblas
is installed.
Unable to build this with clean chroot for a while now, seems to spit a lot of generic C++ errors. This is a wild guess, but to me it seems one of build dependencies requires c++17 now, taking this opencv issue as point of reference.
In file included from /usr/include/google/protobuf/stubs/common.h:44,
from /usr/include/google/protobuf/io/coded_stream.h:130,
from .build_release/src/caffe/proto/caffe.pb.h:24,
from tools/compute_image_mean.cpp:11:
/usr/include/absl/strings/string_view.h:52:26: error: ‘string_view’ in namespace ‘std’ does not name a type
52 | using string_view = std::string_view;
| ^~~~~~~~~~~
/usr/include/absl/strings/string_view.h:52:21: note: ‘std::string_view’ is only available from C++17 onwards
52 | using string_view = std::string_view;
|
Also seems to have issues with cblas headers if blas-openblas (which should provide cblas) is used instead openblas as make dependency - it's fine right now in chroot, but gives include errors when built on host using blas-openblas.
Please check the changes around Arch openblas and blas-openblas. You might need to switch depends from openblas
to blas-openblas
. Arch openblas package is incomplete, only blas-openblas carries the full OpenBlas Lapack suite.
Background:
Arch announced on June 14, 2023 a new blas-openblas repo package, which finally offers the full suite of OpenBLAS Lapack, with their blas implementation and corresponding cblas/lapacke interfaces.
@lurkingaround This happens because that library (which is linked against when compiling waifu2x) got updated. When this happens you will need to rebuild waifu2x. I will try to update the package rel when I notice it happening, but if you notice before I do just make a comment like you did and just rebuild for the meantime.
Getting this error.
waifu2x-caffe: error while loading shared libraries: libboost_filesystem.so.1.80.0: cannot open shared object file: No such file or directory
@lurkingaround I am able to build this in a chroot. So I believe you have somehow configured your path so that CMake can't find CUDA.
Pinned Comments
ginnokami commented on 2021-04-18 23:47 (UTC)
This package provides the cli version of waifu2x-caffe. A readme for all of the flags is located in /usr/share/docs/waifu2x-caffe/README. The models are located at /usr/share/waifu2x-caffe/models.