Install libjpeg-turbo (>= 2.0.0) and use with meson - libjpeg

I am looking for a correct way to install libjpeg-turbo (>= 2.0.0) and use it with meson. I got installed libjpeg-turbo-official_2.1.1 deb.
jpg_dep = dependency('libjpeg', fallback: ['libjpeg-turbo', 'jpeg_dep'], version: '>= 2.0.0', required: false)
Gives me an error:
Package libturbojpeg was not found in the pkg-config search path.
Perhaps you should add the directory containing `libturbojpeg.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libturbojpeg', required by 'project', not found
I also tried using wrapper: meson wrap install libjpeg-turbo
libjpeg = subproject('libjpeg-turbo')
jpg_dep = libjpeg.get_variable('dependency_names')
But it also gives an error ERROR: Requested variable "dependency_names" not found. (dependency_names is a correct name from libjpeg-turbo.wrap)
Previously I successfully used libjpeg-turbo installed with apt-get, but as I need newer version and apt-get for ubuntu is 1.5.2 only, I have to upgrade it in my project somehow.

Related

How to install Boost.Python using homebrew (on OSX)?

I'm trying to install Robot Operating System (ROS) Melodic on my mac (macOS 11.5.1). While compiling cv_bridge package, the compiler spit out an error related to the Boost.Python:
$ ./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release -DCMAKE_MACOSX_RPATH=ON -DCMAKE_INSTALL_RPATH=$HOME/ros_catkin_ws/install_isolated/lib -DCMAKE_PREFIX_PATH="/usr/local/Cellar/qt#5/5.15.2;${HOME}/ros_catkin_ws/install_isolated" -DCMAKE_CXX_STANDARD=17 --pkg cv_bridge
.......... (some log messages are skipped)
-- The C compiler identification is AppleClang 12.0.5.12050022
-- The CXX compiler identification is AppleClang 12.0.5.12050022
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - 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: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Using CATKIN_DEVEL_PREFIX: /Users/yj/ros_catkin_ws/devel_isolated/cv_bridge
-- Using CMAKE_PREFIX_PATH: /usr/local/Cellar/qt#5/5.15.2;/Users/yj/ros_catkin_ws/install_isolated
-- This workspace overlays: /Users/yj/ros_catkin_ws/install_isolated
-- Found PythonInterp: /Library/Frameworks/Python.framework/Versions/2.7/bin/python2 (found suitable version "2.7.16", minimum required is "2")
-- Using PYTHON_EXECUTABLE: /Library/Frameworks/Python.framework/Versions/2.7/bin/python2
-- Using default Python package layout
-- Found PY_em: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/em.pyc
-- Using empy: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/em.pyc
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /Users/yj/ros_catkin_ws/build_isolated/cv_bridge/test_results
-- Found gtest: gtests will be built
-- Using Python nosetests: /Library/Frameworks/Python.framework/Versions/2.7/bin/nosetests-2.7
-- catkin 0.7.29
-- BUILD_SHARED_LIBS is on
-- Found PythonLibs: /Library/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib (found version "2.7.16")
CMake Error at /usr/local/lib/cmake/Boost-1.76.0/BoostConfig.cmake:141 (find_package):
Could not find a package configuration file provided by "boost_python"
(requested version 1.76.0) with any of the following names:
boost_pythonConfig.cmake
boost_python-config.cmake
Add the installation prefix of "boost_python" to CMAKE_PREFIX_PATH or set
"boost_python_DIR" to a directory containing one of the above files. If
"boost_python" provides a separate development package or SDK, be sure it
has been installed.
Call Stack (most recent call first):
/usr/local/lib/cmake/Boost-1.76.0/BoostConfig.cmake:258 (boost_find_component)
/usr/local/Cellar/cmake/3.21.1/share/cmake/Modules/FindBoost.cmake:594 (find_package)
CMakeLists.txt:9 (find_package)
-- Configuring incomplete, errors occurred!
See also "/Users/yj/ros_catkin_ws/build_isolated/cv_bridge/CMakeFiles/CMakeOutput.log".
See also "/Users/yj/ros_catkin_ws/build_isolated/cv_bridge/CMakeFiles/CMakeError.log".
Traceback (most recent call last):
File "./src/catkin/bin/catkin_make_isolated", line 169, in <module>
main()
File "./src/catkin/bin/catkin_make_isolated", line 164, in main
override_build_tool_check=opts.override_build_tool_check,
File "./src/catkin/bin/../python/catkin/builder.py", line 1071, in build_workspace_isolated
_print_build_error(package, e)
File "./src/catkin/bin/../python/catkin/builder.py", line 810, in _print_build_error
cprint("#{rf}#!<==#| Failed to process package '#!#{bf}" + package.name + "#|': \n " + e_msg)
File "./src/catkin/bin/../python/catkin/builder.py", line 128, in cprint
print(fmt(msg), end=end)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/catkin_pkg/terminal_color.py", line 126, in fmt
return t.substitute(_ansi) + ansi('reset')
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/string.py", line 176, in substitute
return self.pattern.sub(convert, self.template)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/string.py", line 173, in convert
self._invalid(mo)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/string.py", line 146, in _invalid
(lineno, colno))
ValueError: Invalid placeholder in string: line 2, col 437
It looks that the CMake was attempting to find the Boost.Python module, but it couldn't. I never installed it. So, I typed the following command to install the Boost.Python:
$ brew install boost-python
The homebrew responded:
$ brew install boost-python
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 2 taps (osrf/simulation and homebrew/core).
==> New Formulae
cruft pari-galdata pari-seadata-big
eigenpy pari-galpol singularity
newrelic-infra-agent pari-seadata spot
==> Updated Formulae
Updated 43 formulae.
Error: boost-python has been disabled because it does not build!
It looks not possible to install the boost-python formula through homebrew. Then, how can I install it?
This is a short brief of my system configuration:
OS: macOS Big Sur (11.5.1)
Boost library is installed by homebrew (brew install boost)
boost version: 1.76.0
python version: 2.7.16
cmake version: 3.21.1
Edit 1
As #BTables said, I tried this command: brew install boost --with-python
It looks removed. My homebrew version is 3.2.8.
$ brew install boost --with-python
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 2 taps (osrf/simulation and homebrew/core).
==> Updated Formulae
Updated 121 formulae.
Usage: brew install [options] formula|cask [...]
Install a formula or cask. Additional options specific to a formula may be
appended to the command.
Unless HOMEBREW_NO_INSTALL_CLEANUP is set, brew cleanup will then be run for
the installed formulae or, every 30 days, for all formulae.
-d, --debug If brewing fails, open an interactive
debugging session with access to IRB or a
shell inside the temporary build directory.
-f, --force Install formulae without checking for
previously installed keg-only or
non-migrated versions. When installing
casks, overwrite existing files (binaries
and symlinks are excluded, unless
originally from the same cask).
-v, --verbose Print the verification and postinstall
steps.
--formula, --formulae Treat all named arguments as formulae.
--env Disabled other than for internal Homebrew
use.
--ignore-dependencies An unsupported Homebrew development flag to
skip installing any dependencies of any
kind. If the dependencies are not already
present, the formula will have issues. If
you're not developing Homebrew, consider
adjusting your PATH rather than using this
flag.
--only-dependencies Install the dependencies with specified
options but do not install the formula
itself.
--cc Attempt to compile using the specified
compiler, which should be the name of the
compiler's executable, e.g. gcc-7 for GCC
7. In order to use LLVM's clang, specify
llvm_clang. To use the Apple-provided
clang, specify clang. This option will
only accept compilers that are provided by
Homebrew or bundled with macOS. Please do
not file issues if you encounter errors
while using this option.
-s, --build-from-source Compile formula from source even if a
bottle is provided. Dependencies will still
be installed from bottles if they are
available.
--force-bottle Install from a bottle if it exists for the
current or newest version of macOS, even if
it would not normally be used for
installation.
--include-test Install testing dependencies required to
run brew test formula.
--HEAD If formula defines it, install the HEAD
version, aka. main, trunk, unstable,
master.
--fetch-HEAD Fetch the upstream repository to detect if
the HEAD installation of the formula is
outdated. Otherwise, the repository's HEAD
will only be checked for updates when a new
stable or development version has been
released.
--keep-tmp Retain the temporary files created during
installation.
--build-bottle Prepare the formula for eventual bottling
during installation, skipping any
post-install steps.
--bottle-arch Optimise bottles for the specified
architecture rather than the oldest
architecture supported by the version of
macOS the bottles are built on.
--display-times Print install times for each formula at the
end of the run.
-i, --interactive Download and patch formula, then open a
shell. This allows the user to run
./configure --help and otherwise
determine how to turn the software package
into a Homebrew package.
-g, --git Create a Git repository, useful for
creating patches to the software.
--cask, --casks Treat all named arguments as casks.
--[no-]binaries Disable/enable linking of helper
executables (default: enabled).
--require-sha Require all casks to have a checksum.
--[no-]quarantine Disable/enable quarantining of downloads
(default: enabled).
--skip-cask-deps Skip installing cask dependencies.
--appdir Target location for Applications (default:
/Applications).
--colorpickerdir Target location for Color Pickers (default:
~/Library/ColorPickers).
--prefpanedir Target location for Preference Panes
(default: ~/Library/PreferencePanes).
--qlplugindir Target location for QuickLook Plugins
(default: ~/Library/QuickLook).
--mdimporterdir Target location for Spotlight Plugins
(default: ~/Library/Spotlight).
--dictionarydir Target location for Dictionaries (default:
~/Library/Dictionaries).
--fontdir Target location for Fonts (default:
~/Library/Fonts).
--servicedir Target location for Services (default:
~/Library/Services).
--input-methoddir Target location for Input Methods (default:
~/Library/Input Methods).
--internet-plugindir Target location for Internet Plugins
(default: ~/Library/Internet Plug-Ins).
--audio-unit-plugindir Target location for Audio Unit Plugins
(default:
~/Library/Audio/Plug-Ins/Components).
--vst-plugindir Target location for VST Plugins (default:
~/Library/Audio/Plug-Ins/VST).
--vst3-plugindir Target location for VST3 Plugins (default:
~/Library/Audio/Plug-Ins/VST3).
--screen-saverdir Target location for Screen Savers (default:
~/Library/Screen Savers).
--language Comma-separated list of language codes to
prefer for cask installation. The first
matching language is used, otherwise it
reverts to the cask's default language. The
default value is the language of your
system.
-q, --quiet Make some output more quiet.
-h, --help Show this message.
Error: invalid option: --with-python
$ brew --version
Homebrew 3.2.8
Homebrew/homebrew-core (git revision 6614f2a9b0; last commit 2021-08-18)
I was facing the same issue, I tried the following command and I worked:
$ brew install boost-python3
Don't know if ROS's cmake is set up to detect/use it since your other detections are for python2, but there is a another cask for python3: brew install boost-python3
Run brew install boost --with-python then do brew install boost-python.
I would also like to warn you that running Melodic(or really any OSX release of ROS) isn't something I would recommend. Specifically with OSX, the build is pretty experimental and not exactly stable or complete.
Update 2022
As #minari kotori mentioned, brew install boost --with-python does not build.
However, you can try building both boost and boost-python from source:
brew install --build-from-source -vd boost boost-python
If this doesn't work, you can try if boost_python3 solves your problem:
brew install boost
and then
brew install boost_python3.
Worked for me on macOS Monterey.

Linux platform tag for python module built with pybind11

I am using pybind11 and build the python module with setuptools and cmake as described in pybind/cmake_example:
setup(
name='libraryname',
...
ext_modules=[CMakeExtension('libraryname')],
cmdclass=dict(build_ext=CMakeBuild),
)
Locally, using python setup.py sdist build everything is fine and I can use and/or install the package from the generated files.
I now want to upload the package to PyPI.
From a different python package I know how to generate a general linux library (see also here) by manipulating the platform tag of a wheel:
class bdist_wheel(bdist_wheel_):
def finalize_options(self):
from sys import platform as _platform
platform_name = get_platform()
if _platform == "linux" or _platform == "linux2":
# Linux
platform_name = 'manylinux1_x86_64'
bdist_wheel_.finalize_options(self)
self.universal = True
self.plat_name_supplied = True
self.plat_name = platform_name
setup(
...
cmdclass = {'bdist_wheel': bdist_wheel},
)
The Question:
How to generate the appropriate platform tag when no bdist_wheel is built?
Should this be somehow built as wheel instead of as an extension (possibly related to this issue on GH)?
Also, how does pybind11 decide the suffix of the generated libraries (on my linux it is not just .so but .cpython-35m-x86_64-linux-gnu.so)?
Follow-up:
The main problem is that I cannot update the current Ubuntu-built package to PyPI: ValueError: Unknown distribution format: 'libraryname-0.8.0.cpython-35m-x86_64-linux-gnu.so'
If the platform tag cannot or should not be changed: what is best practice for uploading a pybind11 module to PyPI across platforms?
My bad!
It turns out the confusion was due to a build error I had when I initially tried running python setup.py sdist bdist_wheel.
Manually building with python setup.py build was not the right approach for publishing the package.
Note: the name of the .so file needed to be set without the -0.8.0 version identifier in order for python do be able to do the import from the wheel.
To Summarize:
Building and publishing binary wheels works exactly the same with pybind11 as with e.g. cpython and it should work just fine to follow the pybind/cmake_example.

pygtk-2.24.0 installing with pygobject-3.0

I am trying to install pygtk-2.24.0 from source in centos6.8, for that pygobject-3.0 is installed from source and pkg-config --list-all | grep pygobject returns pygobject-3.0 PyGObject - Python bindings for GObject. Exported `PKG_CONFIG_PATH=/usr/local/lib/pkgconfig', but still the configure script of pygtk returns
checking for GLIB - version >= 2.8.0... yes (version 2.48.1)
checking for PYGOBJECT... no
configure: error: Package requirements (pygobject-2.0 >= 2.21.3) were not met:
No package 'pygobject-2.0' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.'
It could find glib, but not pygobject

No matching distribution found for 'package' in python wheel

I have written a python package called lyrico and uploaded the source dist and wheel to testpypi site.
lyrico
But when I try to install it from there using following command it gives errors:
pip install -i https://testpypi.python.org/pypi lyrico
Error logged in cmd-prompt:
Collecting lyrico
Using cached https://testpypi.python.org/packages/py2/l/lyrico/lyrico-0.2.5-py2-none-any.whl
Collecting mutagen (from lyrico)
Could not find a version that satisfies the requirement mutagen (from lyrico) (from versions: )
No matching distribution found for mutagen (from lyrico)
It is unable to find the dependency mutagen in wheel I uploaded. I have included dependencies in my setup.py:
install_requires = [
'mutagen',
'glob2',
'beautifulsoup4',
'win-unicode-console >= 0.4'
],
Weird thing is that if go to testPyPi page and manually download and install the wheel using (after cd to the containing dir):
pip install lyrico-0.2.5-py2-none-any.whl
it works and installs all the dependencies as well.
I am using Python 2.7.11 on a Windows7 system. Can someone please tell what is wrong or if the error is reproduce-able?

How to install Modular Boost?

Because I need to test some experimental features of Boost, I would like to install Boost from the Modular Boost repository.
I followed the instructions on https://svn.boost.org/trac/boost/wiki/TryModBoost and the b2 command failed:
./b2 headers
/home/wichtounet/src/modular-boost/tools/build/src/build/feature.jam:493: in feature.validate-value-string from module feature
error: "none" is not a known value of feature <optimization>
error: legal values: "off" "speed" "space"
/home/wichtounet/src/modular-boost/tools/build/src/build/property.jam:273: in validate1 from module property
/home/wichtounet/src/modular-boost/tools/build/src/build/property.jam:299: in property.validate from module property
/home/wichtounet/src/modular-boost/tools/build/src/tools/builtin.jam:377: in variant from module builtin
/usr/share/boost-build/site-config.jam:9: in modules.load from module site-config
/home/wichtounet/src/modular-boost/tools/build/src/build-system.jam:249: in load-config from module build-system
/home/wichtounet/src/modular-boost/tools/build/src/build-system.jam:351: in load-configuration-files from module build-system
/home/wichtounet/src/modular-boost/tools/build/src/build-system.jam:524: in load from module build-system
/home/wichtounet/src/modular-boost/tools/build/src/kernel/modules.jam:289: in import from module modules
/home/wichtounet/src/modular-boost/tools/build/src/kernel/bootstrap.jam:139: in boost-build from module
/home/wichtounet/src/modular-boost/boost-build.jam:17: in module scope from module
I tried adding optimization=speed on the command line, but it didn't changed a thing. I tried the master and develop branches. I tried with clang and gcc toolset.
Does someone has an idea how to install Modular Boost ?
Is there some configuration that is necessary (and where) ? Or is there another procedure to follow ?
EDIT: It seems that it comes from the /usr/share/boost-build/site-config.jam file that is probably installed by Gentoo. I need to be able to tell b2 to ignore this file.
I turned out that this was caused by a Gentoo configuration file. I just had to ignore the file with:
./b2 --ignore-site-config
I use modular boost to get all revisions of boost at my fingertips. Together with ccache I can just switch the boost library version at a whim and I use this procedure for this:
export BOOST_VER=boost-1.55.0
git checkout --force "$BOOST_VER"
git submodule foreach 'git checkout --force "$BOOST_VER" || true'
./bootstrap.sh && ./b2 headers
That's after initial cloning as per the documentation:
git clone --recursive git#github.com:boostorg/boost.git modular-boost
My system is
Linux desktop 3.11.0-18-generic #32-Ubuntu SMP Tue Feb 18 21:11:14 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 13.10
Release: 13.10
Codename: saucy
git version 1.8.3.2