DEPRECATION: c_args in the [properties] section of the machine file is deprecated, use the [built-in options] section - meson-build

Here is cross-file example I use for cross compiling with meson build system. It is passed to meson with --cross-file option.
[host_machine]
system = 'linux'
cpu_family = 'arm'
cpu = ''
endian = 'little'
[binaries]
c = 'arm-linux-gnueabihf-cc'
cpp = 'arm-linux-gnueabihf-g++'
ld = 'arm-linux-gnueabihf-ld'
ar = 'arm-linux-gnueabihf-ar'
strip = 'arm-linux-gnueabihf-strip'
pkgconfig = 'pkg-config'
[properties]
c_args = ['-march=armv7-a', '-mtune=cortex-a9', '-mlittle-endian', '-I/sysroot/usr/include']
cpp_args = ['-march=armv7-a', '-mtune=cortex-a9', '-mlittle-endian', '-I/sysroot/usr/include']
c_link_args = ['-march=armv7-a', '-mtune=cortex-a9', '-mlittle-endian', '-L/sysroot/lib', '-Wl,-rpath-link=/sysroot/staging/lib', '-L/sysroot/usr/lib', '-Wl,-rpath-link=/sysroot/usr/lib']
cpp_link_args = ['-march=armv7-a', '-mtune=cortex-a9', '-mlittle-endian', '-L/sysroot/lib', '-Wl,-rpath-link=/sysroot/staging/lib', '-L/sysroot/usr/lib', '-Wl,-rpath-link=/sysroot/usr/lib']
It worked fine. But after upgrading meson to the newest version, I get the following warnings:
DEPRECATION: c_args in the [properties] section of the machine file is deprecated, use the [built-in options] section.
DEPRECATION: cpp_args in the [properties] section of the machine file is deprecated, use the [built-in options] section.
DEPRECATION: c_link_args in the [properties] section of the machine file is deprecated, use the [built-in options] section.
DEPRECATION: cpp_link_args in the [properties] section of the machine file is deprecated, use the [built-in options] section.
How can I fix this?

Just rename [properties] section to [built-in options]:
[built-in options]
c_args = ['-march=armv7-a', '-mtune=cortex-a9', '-mlittle-endian', '-I/sysroot/usr/include']
cpp_args = ['-march=armv7-a', '-mtune=cortex-a9', '-mlittle-endian', '-I/sysroot/usr/include']
c_link_args = ['-march=armv7-a', '-mtune=cortex-a9', '-mlittle-endian', '-L/sysroot/lib', '-Wl,-rpath-link=/sysroot/staging/lib', '-L/sysroot/usr/lib', '-Wl,-rpath-link=/sysroot/usr/lib']
cpp_link_args = ['-march=armv7-a', '-mtune=cortex-a9', '-mlittle-endian', '-L/sysroot/lib', '-Wl,-rpath-link=/sysroot/staging/lib', '-L/sysroot/usr/lib', '-Wl,-rpath-link=/sysroot/usr/lib']
https://mesonbuild.com/Machine-files.html
Changed in 0.56.0 putting <lang>_args and <lang>_link_args in the properties section has been deprecated, and should be put in the built-in options section.
Before 0.56.0, <lang>_args and <lang>_link_args must be put in the properties section instead, else they will be ignored.
Meson built-in options can be set the same way:
[built-in options]
c_std = 'c99'

Related

dependency and option in meson project

I have a project with a similar folder trees:
├── meson.build (1)
├── meson_options.txt
├── README.md
└── src
└── mysub
├── meson.build (2)
└── mesonTest.c
the meson.options.txt contains
option('avx_opt', type : 'combo', choices : ['avx2', 'avx512'], value : 'avx512')
the mysub project is a dependency of the main proj
so the meson.build (1) :
project(
'my_proj',
'c',
version : '1.1.0',
default_options : ['buildtype=plain','warning_level=3'],
subproject_dir : 'src'
)
project_source_files = [
''
]
message('## source root : ' + meson.project_source_root() + ' ##')
project_dependencies = [
dependency('mysub', fallback : ['mysub', 'mysub_dep']),
]
build_args = [
]
# ===================================================================
# ======
# Target
# ======
build_args += [
'-DPROJECT_NAME=' + meson.project_name(),
'-DPROJECT_VERSION=' + meson.project_version(),
]
the meson.build (2) of the mysub proj is:
project(
'mysub',
'c',
version : '1.1.0',
default_options : ['warning_level=3']
)
project_description = 'mysub binary'
project_source_files = [
'mesonTest.c'
]
project_headers = [
]
avx_type = get_option('avx_opt')
if (avx_type == 'avx512')
build_args_avx512 = [
'-mavx512f',
'-mavx512cd',
'-mavx512vl',
'-mavx512bw',
'-mavx512dq',
'-DNEWLDPC=1'
]
else
build_args_avx512 = [
'-DNEWLDPC=0'
]
endif
project_target = executable(
meson.project_name(),
project_source_files,
install : true,
c_args : build_args,
link_args : '-Wl,--allow-shlib-undefined',
)
# =======
# Project
# =======
# Make this library usable as a Meson subproject.
project_dep = declare_dependency(
include_directories: public_headers,
link_with : project_target
)
set_variable(meson.project_name() + '_dep', project_dep)
# Make this library usable from the system's
# package manager.
install_headers(project_headers, subdir : meson.project_name())
pkg_mod = import('pkgconfig')
pkg_mod.generate(
name : meson.project_name(),
filebase : meson.project_name(),
description : project_description,
subdirs : meson.project_name(),
# libraries : project_target,
)
I have tried to configure in the following way:
meson builddir -Davx_opt=avx512
or
meson builddir -Davx_opt:mysub=avx512
but in both case I got:
The Meson build system
Version: 0.59.1
Source dir: /home/roccasal/wsEclipse/Intel/mesonTest/proj
Build dir: /home/roccasal/wsEclipse/Intel/mesonTest/proj/builddir
Build type: native build
Project name: my_proj
Project version: 1.1.0
C compiler for the host machine: cc (gcc 8.5.0 "cc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-4)")
C linker for the host machine: cc ld.bfd 2.30-108
Host machine cpu family: x86_64
Host machine cpu: x86_64
Message: ## source root : /home/roccasal/wsEclipse/Intel/mesonTest/proj ##
Found pkg-config: /usr/bin/pkg-config (1.4.2)
Found CMake: /usr/bin/cmake (3.20.2)
Run-time dependency mysub found: NO (tried pkgconfig and cmake)
Looking for a fallback subproject for the dependency mysub
Executing subproject mysub
mysub| Project name: mysub
mysub| Project version: 1.1.0
mysub| C compiler for the host machine: cc (gcc 8.5.0 "cc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-4)")
mysub| C linker for the host machine: cc ld.bfd 2.30-108
src/mysub/meson.build:32:0: ERROR: Tried to access unknown option "avx_opt".
what is wrong in the meson build configuration?
the meson ver used is 0.59.1
//thanks
Check Build-options page in reference manual:
To change values in subprojects prepend the name of the subproject and
a colon:
$ meson configure -Dsubproject:option=newvalue
Thus, try create new build dir with:
meson builddir -Dmysub:avx_opt=avx512
or configure existing with:
meson configure builddir -Dmysub:avx_opt=avx512
To make it working you also need this option defined in meson_options.txt in every subproject that uses it, but to simplify configuration you can as #dcbaker suggested use yielding, i.e. update option definition for the main project:
option('avx_opt', ...., yield : true)
This will give you possibility to configure it the same way for main and subprojects with just:
meson configure builddir -Davx_opt=avx512
Also, (I guess it's just typo in question) file with options should have name meson_options.txt (with underscore).

Yocto include cmake project with custom steps

I am trying to include this simple cmake-based project to my image: https://github.com/MatrixOrbital/HTT-Utility
The steps to build in Linux are:
mkdir build
cd build
cmake ..
make
I am trying to reproduce these steps within my Yocto recipe. The generated binary (./build/htt_util) should be installed in /usr/bin.
So far with the help of devtool and some manual tuning I ended up with this recipe:
LICENSE = "MIT & Unknown"
LIC_FILES_CHKSUM = "file://LICENSE;md5=ff75ee274f4c77abeee3db089083fec7 \
file://hidapi/LICENSE.txt;md5=7c3949a631240cb6c31c50f3eb696077"
SRC_URI = "git://github.com/MatrixOrbital/HTT-Utility.git;protocol=https"
SRC_URI += "file://0001-Adding-ctype.patch;"
PATCHTOOL = "git"
# Modify these as desired
PV = "1.0+git${SRCPV}"
SRCREV = "2045d5eacc67b89a02dafe41edfd032179333aee"
S = "${WORKDIR}/git"
inherit cmake
# Specify any options you want to pass to cmake using EXTRA_OECMAKE:
EXTRA_OECMAKE = ""
DEPENDS += "udev"
What should I add to my recipe to achieve the goal of generating a binary and installing into /usr/bin?
I have been trying to play with:
do_configure() {
...
}
do_compile() {
...
}
do_install() {
...
}
But so far I did not manage to do anything useful.
Any help would be appreciated.
do_install() {
install -m 0644 mybinary ${D}${bindir}
}
FILES_${PN} = " \
${bindir} \
"

Conan Errror : install loop detected in context host .. requires .. which is an ancestor to

I know that this might seem obvious for some of you but I've been digging everywhere for answers with no success. I'm trying to Conan install my own package from my repo but I can't get over this error. It tells me that I have a loop in my requires but my package has no requirement.
I use this recipe for upload with Conan export-pkg :
# Standard library imports
import configparser
import os
import sys
# Related third party imports
import conans
class TlConanFile(conans.ConanFile):
settings = "os", "arch"
def __init__(self, output, runner, display_name="", user=None, channel=None): # pylint: disable=too-many-arguments
super().__init__(output, runner, display_name, user, channel)
if "--build-folder" in sys.argv:
# Conan checks the arguments and fails if the value is missing, the next argument is always the value
build_folder = sys.argv[sys.argv.index("--build-folder") + 1]
self.__class__.exports = os.path.relpath(os.path.join(build_folder, "..", "conanfile.txt"),
os.path.dirname(__file__))
elif "-bf" in sys.argv:
# Conan checks the arguments and fails if the value is missing, the next argument is always the value
build_folder = sys.argv[sys.argv.index("-bf") + 1]
self.__class__.exports = os.path.relpath(os.path.join(build_folder, "..", "conanfile.txt"),
os.path.dirname(__file__))
elif "-pf" in sys.argv:
# Conan checks the arguments and fails if the value is missing, the next argument is always the value
build_folder = sys.argv[sys.argv.index("-pf") + 1]
self.__class__.exports = os.path.relpath(os.path.join(build_folder, "..", "conanfile.txt"),
os.path.dirname(__file__))
elif "--package-folder" in sys.argv:
# Conan checks the arguments and fails if the value is missing, the next argument is always the value
build_folder = sys.argv[sys.argv.index("--package-folder") + 1]
self.__class__.exports = os.path.relpath(os.path.join(build_folder, "..", "conanfile.txt"),
os.path.dirname(__file__))
else:
# Simply assume that we are running the command in the build directory
build_folder = os.getcwd()
self.__class__.exports = os.path.relpath(os.path.join(build_folder, "..", "conanfile.txt"),
os.path.dirname(__file__))
def package(self):
self.copy("*.h", dst="include/aveer", src="output/include/aveer")
self.copy("*.i", dst="include/aveer/swig", src="output/include/aveer/swig")
self.copy("*.so*", dst="lib", src="output/lib", symlinks=True)
self.copy("*.cmake", dst="lib/cmake/aveer", src="output/lib/cmake/aveer")
self.copy("*.so", dst="lib/python3/dist-packages/aveer", src="output/lib/python3/dist-packages/aveer")
self.copy("*", dst="lib/python3/dist-packages/aveer", src="output/lib/python3/dist-packages/aveer")
self.copy("*.yml", dst="share/gnuradio/grc/blocks", src="output/share/gnuradio/grc/blocks")
#self.copy("*", dst="share/gnuradio/grc/blocks", src="share/gnuradio/grc/blocks") doc?
def package_info(self):
self.cpp_info.libs = conans.tools.collect_libs(self)
def requirements(self):
with open("../conanfile.txt") as conanfile_txt:
config = configparser.ConfigParser(allow_no_value=True, delimiters=["\0"])
config.optionxform = str
config.read_file(conanfile_txt)
for requirement in config['requires']:
self.requires(requirement)
to go with this conanfile.py, I also have this conanfile.txt:
[requires]
[generators]
cmake
[options]
that's it for the upload
and I use this conanfile.txt for the install:
[requires]
lib-grplugin/1.0.45#aveer_repo/Release
[generators]
cmake
[options]
[imports]
include/aveer, *.h -> ./output/include/aveer
include/aveer/swig, *.i ->./ output/include/aveer/swig
lib, *.so* -> ./output/lib
lib/cmake/aveer, *.cmake -> ./output/lib/cmake/aveer
lib/python3/dist-packages/aveer, *.so -> ./output/lib/python3/dist-packages/aveer
lib/python3/dist-packages/aveer, *.py -> ./output/lib/python3/dist-packages/aveer
share/gnuradio/grc/blocks, *.yml -> ./output/share/gnuradio/grc/blocks
when I try to run my conan install .. It gives me the following in the prompt:
Picture from the command prompt with the error
I also tried to install another package to test my profile/config and it has worked as intended.
As you can see I'm new here and even newer to conan, so if you need more info that I've not mention here plz let me know.

getting error while installing build in conanfiles

I've got some problem with conan package manager When I run this command on my command line
conan install .. --build=missing
but i got some error in my conanfile.py
Hello/0.1#mohammad/stable: ERROR: Package '90ee443cae5dd5c1b4861766ac14dc6fae231a92' build failed
Hello/0.1#mohammad/stable: WARN: Build folder /home/mohammad/.conan/data/Hello/0.1/mohammad/stable/build/90ee443cae5dd5c1b4861766ac14dc6fae231a92
ERROR: Hello/0.1#mohammad/stable: Error in build() method, line 14 cmake = CMake(self.settings)
ConanException: First argument of CMake() has to be ConanFile. Use CMake(self)
This is my conanfile.py
import os, platform
class HelloConan(ConanFile):
name = "Hello"
version = "0.1"
settings = "os", "compiler", "build_type", "arch"
def source(self):
self.run("git clone https://github.com/memsharded/hello.git")
def build(self):
cmake = CMake(self.settings)
self.run('cmake hello %s' % (cmake.command_line))
self.run('cmake --build . %s' % cmake.build_config)
def package(self):
self.copy("*.h", dst="include", src="hello")
self.copy("*.lib", dst="lib", keep_path=False)
self.copy("*.a", dst="lib", keep_path=False)
def package_info(self):
self.cpp_info.libs = ["hello"]
The error message clearly says what's wrong:
First argument of CMake() has to be ConanFile. Use CMake(self)
You are passing self.settings instead:
cmake = CMake(self.settings)

Cannot `pod spec lint` pod because of `undeclared type: xxx`

I'm in the process of 'converting' an Xcode framework into a Cocoapod. I've gotten pretty far into the process, but I cannot get the pod to lint. Its a bit of a hybrid project, using both ObjC and Swift, but it builds fine in Xcode, but not through lint, which makes me think something involving Cocoapods is screwy.
Error:
- ERROR | [OSX] xcodebuild: EonilFileSystemEvents/EonilFileSystemEvents/FileSystemEventMonitor.swift:17:43: error: use of undeclared type 'EonilFileSystemEventFlag'
- ERROR | [OSX] xcodebuild: EonilFileSystemEvents/EonilFileSystemEvents/FileSystemEventMonitor.swift:89:28: error: use of undeclared type 'EonilJustFSEventStreamWrapper'
- ERROR | [OSX] xcodebuild: EonilFileSystemEvents/EonilFileSystemEvents/FileSystemEventMonitor.swift:63:15: error: use of unresolved identifier 'EonilJustFSEventStreamWrapper'
- ERROR | [OSX] xcodebuild: EonilFileSystemEvents/EonilFileSystemEvents/FileSystemEventMonitor.swift:138:14: error: use of unresolved identifier 'NSStringFromFSEventStreamEventFlags'
EonilFileSystemEvents.podspec:
#
# Be sure to run `pod spec lint rebekka.podspec' to ensure this is a
# valid spec and to remove all comments including this before submitting the spec.
#
# To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html
# To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/
#
Pod::Spec.new do |s|
s.name = "EonilFileSystemEvents"
s.version = "0.0.4"
s.summary = "Dead-simple access to FSEvents framework for Swift."
s.description = "Provides dead-simple access to FSEvents framework for Swift by Hoon H."
s.homepage = "https://github.com/128keaton/FileSystemEvents"
s.license = "MIT License"
s.author = "Hoon H"
s.frameworks = 'CoreServices', 'EonilFileSystemEvents'
s.requires_arc = true
s.osx.deployment_target = "10.10"
s.source = { :git => "https://github.com/128keaton/FileSystemEvents", :tag => "0.0.4" }
s.source_files = "EonilFileSystemEvents/*.{h,m}"
s.source_files = 'EonilFileSystemEvents/*.swift'
end
Project:
https://github.com/128keaton/FileSystemEvents
Use:
s.source_files = "EonilFileSystemEvents/*.{h,m}", 'EonilFileSystemEvents/*.swift'`
instead of:
s.source_files = "EonilFileSystemEvents/*.{h,m}"
s.source_files = 'EonilFileSystemEvents/*.swift'