I am trying to configure a library with major minor and revision version numbers automagically inside autoconf/automake/autoheader....
Why do these symbol values cause following errors?
# Library Version Master Version DO NOT TOUCH
AC_DEFINE_UNQUOTED([MAJORVERSION], [0], [Library major version])
AC_DEFINE_UNQUOTED([MINORVERSION], [2], [Library minor version])
AC_DEFINE_UNQUOTED([REVISION], [0], [Library revision version])
AC_DEFINE_UNQUOTED([LIB_VER], [["$MAJORVERSION:$MINORVERSION:$REVISION"]], [Library complete version])
m4_esyscmd([echo $LIB_VER > .version])
autoreconf: running: /usr/bin/autoheader --force
configure.ac:30: warning: AC_DEFINE: not an identifier:
configure.ac:31: warning: AC_DEFINE: not an identifier:
configure.ac:32: warning: AC_DEFINE: not an identifier:
configure.ac:33: warning: AC_DEFINE: not an identifier:
autoheader: warning: missing template:
autoheader: Use AC_DEFINE([], [], [Description])
autoreconf: /usr/bin/autoheader failed with exit status: 1
Post fixing for spaces in the autoconf commands, this is the Makefile excerpt.
MAJORVERSION =
MAKEINFO = ${SHELL} /home/dave/src/libringbuffers-0.2.0/missing makeinfo
MANIFEST_TOOL = :
MINORVERSION =
MKDIR_P = /bin/mkdir -p
NM = /usr/bin/nm -B
NMEDIT =
OBJDUMP = objdump
...
PACKAGE_NAME = libringbuffers
PACKAGE_STRING = libringbuffers 0.2.0-2-gd984062
PACKAGE_TARNAME = libringbuffers
PACKAGE_URL =
PACKAGE_VERSION = 0.2.0-2-gd984062
...
REL_VER =
REVISION =
SED = /bin/sed
So that might have been problem one, but still not storing values...
I believe the problem you're having is caused by the extra space after AC_DEFINE_UNQUOTED before the parenthesis.
Try replacing:
AC_DEFINE_UNQUOTED ([MAJORVERSION], [0], [Library major version])
AC_DEFINE_UNQUOTED ([MINORVERSION], [2], [Library minor version])
AC_DEFINE_UNQUOTED ([REVISION], [0], [Library revision version])
AC_DEFINE_UNQUOTED ([LIB_VER], [["$MAJORVERSION:$MINORVERSION:$REVISION"]], [Library complete version])
with:
AC_DEFINE_UNQUOTED([MAJORVERSION], [0], [Library major version])
AC_DEFINE_UNQUOTED([MINORVERSION], [2], [Library minor version])
AC_DEFINE_UNQUOTED([REVISION], [0], [Library revision version])
AC_DEFINE_UNQUOTED([LIB_VER], [["$MAJORVERSION:$MINORVERSION:$REVISION"]], [Library complete version])
Note: there should be no space after AC_DEFINE_UNQUOTED
With the following in configure.ac:
AC_DEFUN([AX_DEFINE_SUBST], [
AC_DEFINE_UNQUOTED([$1], [$2], [$3])
AC_SUBST([$1], ['$2'])
])
AX_DEFINE_SUBST([MAJORVERSION], [0], [Library major version])
AX_DEFINE_SUBST([MINORVERSION], [2], [Library minor version])
AX_DEFINE_SUBST([REVISION], [0], [Library revision version])
AC_DEFINE_UNQUOTED([LIB_VER], [["$MAJORVERSION:$MINORVERSION:$REVISION"]], [Library complete version])
AC_CONFIG_HEADERS([config.h])
...
AC_OUTPUT
After running autoreconf && ./configure, I end up with the following declared in config.h:
/* Library complete version */
#define LIB_VER "0:2:0"
/* Library major version */
#define MAJORVERSION 0
/* Library minor version */
#define MINORVERSION 2
/* Library revision version */
#define REVISION 0
note: AX_DEFINE_SUBST hack taken from: How do I combine AC_SUBST and AC_DEFINE?
Related
I've got a C++ application in a Yocto build that requires the library file libwpa_client.so. This file is provided by wpa-supplicant. I brute forced installation of this file into my Yocto image as the wpa-supplicant recipe wasn't doing it for me. I'm now trying to figure out the proper way to pull this library file in during an autotools build.
The bb recipe for the C++ application includes:
DESCRIPTION = "My C++ Application recipe"
LICENSE = "CLOSED"
PACKAGES = "\
${PN} \
${PN}-dev \
${PN}-dbg \
"
DEPENDS = " libegt sqlite3-native libgpiod wpa-supplicant"
# Add for gpiod.h
RDEPENDS_${PN} = "libgpiod wpa-supplicant"
RDEPENDS_${PN}-dev = "libgpiod wpa-supplicant"
RDEPENDS_${PN}-dbg = "libgpiod wpa-supplicant"
....
& in the configure.ac I have:
PKG_CHECK_MODULES(LIBGPIOD, [libgpiod >= 1.0], [], [
AC_MSG_ERROR(libgpiod not found. This is required.)
])
# note libwpa_client has no version number, just libwpa_client.so
PKG_CHECK_MODULES(LIBWPA_CLIENT, [libwpa_client], [], [
AC_MSG_ERROR(libwpa_client not found. This is required.)
])
Using this produces the output:
Wno-long-long -Wno-missing-field-initializers -Wno-unused-parameter -Wno-psabi
| checking if libc contains libintl... yes
| checking libintl.h usability... yes
| checking libintl.h presence... yes
| checking for libintl.h... yes
| checking for libegt >= 1.3... yes
| checking for libgpiod >= 1.0... yes
| checking for libwpa_client... no
| configure: error: libwpa_client not found. This is required.
| NOTE: The following config.log files may provide further information.
My application builds fine if I manually specify lwpa_client in Makefile.am as follows:
CUSTOM_LDADD = $(LIBEGT_LIBS) $(top_builddir)/external/libsqlite3.la $(LIBGPIOD_LIBS) $(LIBWPA_CLIENT_LIBS) -lwpa_client
But my questions is how should I properly do this?
Many thanks,
I have a clean project to which I include anyhow 1.0.66.
Installed the latest version of rust.
I'm getting an error saying that anyhow requires a nightly version. Perhaps this is due to the use of backtrace, but it is supported in rust version 1.65. I don't understand how to solve the problem.
Cargo.toml
[package]
name = "libfs"
version = "0.1.0"
edition = "2021"
[dependencies]
tokio = {version = "1.22", features = ["full"]}
anyhow = {version = "1.0.66", features = ["default"]}
src/lib.rs
#[tokio::test]
async fn run_test() {
println!("test");
}
output
$ cargo build
Compiling anyhow v1.0.66
error[E0554]: `#![feature]` may not be used on the stable release channel
--> /home/dima/.cargo/registry/src/github.com-1ecc6299db9ec823/anyhow-1.0.66/src/lib.rs:214:32
|
214 | #![cfg_attr(backtrace, feature(error_generic_member_access, provide_any))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0554]: `#![feature]` may not be used on the stable release channel
--> /home/dima/.cargo/registry/src/github.com-1ecc6299db9ec823/anyhow-1.0.66/src/lib.rs:214:61
|
214 | #![cfg_attr(backtrace, feature(error_generic_member_access, provide_any))]
| ^^^^^^^^^^^
For more information about this error, try `rustc --explain E0554`.
error: could not compile `anyhow` due to 2 previous errors
The problem was solved by:
rm -rf target
cargo check
This seems to be related to dtolnay/anyhow/issues/250 and rust-lang/rust-analyzer/issues/12973.
I have Biber 2.17 and TexLive 2022.
I tried to update biber, latex, bibtex, trash aux-files - nothing helps.
Everything worked very well (including references and bibliography) and I suddenly got this error.
There is an error when I try to compile:
INFO - This is Biber 2.17
INFO - Logfile is '.blg'
ERROR - .bcf is malformed, last biblatex run probably failed. Deleted .bbl
INFO - ERRORS: 1
My .log file is:
This is pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022) (preloaded format=pdflatex 2022.6.22) 22 JUN 2022 11:47
entering extended mode
restricted \write18 enabled.
file:line:error style messages enabled.
%&-line parsing enabled.
**.tex
(./.tex
LaTeX2e <2021-11-15> patch level 1
L3 programming layer <2022-02-24>
(/usr/local/texlive/2022/texmf-dist/tex/latex/base/fix-cm.sty
Package: fix-cm 2020/11/24 v1.1t fixes to LaTeX
...
(/usr/local/texlive/2022/texmf-dist/tex/latex/base/exscale.sty
Package: exscale 2018/09/24 v2.1i Standard LaTeX package exscale
LaTeX Font Info: Redeclaring symbol font `largesymbols' on input line 57.
LaTeX Font Info: Overwriting symbol font `largesymbols' in version `normal'
(Font) OMX/cmex/m/n --> OMX/cmex/m/n on input line 57.
LaTeX Font Info: Overwriting symbol font `largesymbols' in version `bold'
(Font) OMX/cmex/m/n -->
...
(/usr/local/texlive/2022/texmf-dist/tex/latex/caption/caption.sty
Package: caption 2022/03/01 v3.6b Customizing captions (AR)
(/usr/local/texlive/2022/texmf-dist/tex/latex/caption/caption3.sty
Package: caption3 2022/03/17 v2.3b caption3 kernel (AR)
\caption#tempdima=\dimen164
\captionmargin=\dim
3. My .tex file begins as:
\RequirePackage{fix-cm}
\documentclass[9.5pt,openright,a4paper,twoside,BCOR=20mm,cleardoublepage=plain, headsepline, bibliography=totoc, version=first, enabledeprecatefontcommands, headings=huge]{extreport}
\usepackage[fontsize=9.3pt]{scrextend}
\usepackage[headsepline=0.2pt, automark]{scrlayer-scrpage}
\usepackage{times}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman, english]{babel}
\usepackage[final]{graphicx} %
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{nicefrac}
\usepackage{fancyvrb}
\usepackage[pdftex, table]{xcolor}
\usepackage{wrapfig}
\usepackage{subcaption}
\usepackage[locale=DE, product-units=power]{siunitx}
\usepackage{lscape}
\usepackage{mathrsfs}
\usepackage[margin=12pt,format=plain, labelformat=simple, labelsep=colon, labelfont={bf, rm}, indention=0.2cm, font=small]{caption}
\usepackage{cite}
\usepackage{caption}
\captionsetup{font=large}
%\usepackage[backend=biber, natbib=true,style=numeric,sorting=none]{biblatex}
\addbibresource{ref.bib}
\usepackage{url}
\usepackage{doi}
\usepackage{braket}
\usepackage{setspace}
\usepackage{float}
\usepackage{bibgerm}
\usepackage{sidecap}
\usepackage{transparent}
\usepackage[backend=biber, eprint = false, giveninits=true, style=numeric-comp,sorting=none,backrefstyle=two, url=false]{biblatex}
\usepackage{csquotes}
\usepackage{textcomp}
\usepackage{rotating}
\usepackage{totcount}
\usepackage{totpages}
\usepackage{xltabular}
\usepackage{longtable}
\usepackage[figure,table]{totalcount}
\usepackage{xifthen}
\usepackage[version = 3]{acro}
\usepackage{setspace}
\pagestyle{headings}
\usepackage{gensymb}
%\usepackage{filecontents}
%\usepackage{natlib}
%\usepackage[nottoc,numbib]{tocbibind}
\usepackage{cleveref}
\acsetup{ format = \mdseries}
\newboolean{Test}
\setboolean{Test}{true}
\regtotcounter{page}
\renewcommand\newblockpunct{}
\renewcommand\newunitpunct{; }
\DefineBibliographyStrings{ngerman}{
andothers = {{et\,al\adddot}}}
\AtEveryBibitem{%
\ifentrytype{Online}{\printfield{url}\clearfield{urldate}}{}%
}
\DeclareMathOperator{\Div}{div}
\DeclareMathOperator{\Rot}{rot}
\newtotcounter{citenum}
\AtEveryBibitem{\stepcounter{citenum}}
\setlength{\abovecaptionskip}{-0.025cm}
\raggedbottom
\sisetup{locale = DE, separate-uncertainty,
list-final-separator= {\ \linebreak[0]\text{und}\ } ,
list-separator = {,\ \linebreak[0]\ },
list-pair-separator= {\ \linebreak[0]\text{und}\ },
range-phrase= {\ \linebreak[0]\text{bis}\ },
range-units=repeat}
\setlength{\parindent}{0.5cm}
\renewcommand\thesubfigure{(\alph{subfigure})}
\captionsetup[figure]{name=Abb.,belowskip = 2pt, aboveskip = 2pt}
\captionsetup[subfigure]{font=large, labelformat = simple, position = top,belowskip=-3pt}
\captionsetup[table]{font=large, labelformat = simple, position = top, aboveskip=5pt, belowskip = 2pt}
\renewcommand{\floatpagefraction}{0.9} % damit Bild nicht auf einzelner Seite landet
\newcommand{\Chi}{\mbox{\large$\chi$}}
\newcommand{\myfootnote}[1]{%
\renewcommand{\thefootnote}{}%
\footnotetext{\normalsize{#1}}%
\renewcommand{\thefootnote}{\arabic{footnote}}%
}
\interfootnotelinepenalty=10000
\linespread{1.0}
\definecolor{gruen}{rgb}{0.23, 0.78, 0.23}
\newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}} % linksbündig mit Breitenangabe
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}} % zentriert mit Breitenangabe
\newcolumntype{R}[1]{>{\raggedleft\arraybackslash}p{#1}} % rechtsbündig mit Breitenangabe
\newcommand{\mytitle}{Titel}
\newcommand{\datum}{Datum}
\onehalfspacing
\begin{document}
\addtocontents{toc}{\protect\setcounter{topdepth}{-1}}
\tableofcontents
\addtocontents{toc}{\protect\setcounter{topdepth}{3}}
\pagenumbering{gobble}
\cleardoublepage
\pagenumbering{arabic}
\chapter{Introduction}
......
name_list=['William','Laura','Robert','Alicia','Sharon','Jack','Mary','Edward','Jessie','Debra']
day_list=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday']
hormones_list=[name_list,day_list]
print(hormones_list[0][0])
I wrote the one-dimensional ones. But how can I write the 2d? When I write hormone_list[0][0] it has to show william's monday data. But I don't know how. Also how can I temporarily store seperate lists? Should I use if structures without writing them one by one? It says shortest so I'm a bit cautious.
You can nest lists, so instead of [value, value, value] you'd use [list, list, list].
So the values from monday-sunday would be a list and then you'd add all these list in a row.
Like:
hormone_list = [[1,2,3,4,5,6,7],[2,3,4,5,6,7,8], ...]
This is likely not how I would solve the problem if presented as a business case but the answer seems to ask for lists and comprehensions so I might do:
## ----------------------------
## Our data
## ----------------------------
name_list=['William', 'Laura', 'Robert', 'Alicia', 'Sharon', 'Jack', 'Mary', 'Edward', 'Jessie', 'Debra']
day_list=['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
hormones_list=[
[1.0, 1.3, 1.7, 1.1, 1.8, 1.3, 1.2], # William's daily readings
[1.9, 1.9, 1.5, 1.8, 1.9, 1.7, 1.5], # Laura's daily readings
[3.0, 3.3, 3.1, 2.7, 3.5, 4.5, 4.7], # Robert's daily readings
# ....
]
## ----------------------------
print(f"Williams reading on Monday was: {hormones_list[0][0]}")
## ----------------------------
## build the list of high days using a list of lists like hormones_list.
## Note: I would probably use a days_high dictionary with something like
## days_high.setdefault(patient_index, []).append(day_index)
## ----------------------------
days_high = [
[
day_index
for day_index, day_reading
in enumerate(patient_readings)
if day_reading > 4.0
]
for patient_readings
in hormones_list
]
## ----------------------------
## ----------------------------
## Print out the warnings for a given patient (if there are any)
## ----------------------------
for patient_index, patient_readings in enumerate(days_high):
if not patient_readings:
continue
patient_name = name_list[patient_index]
days = " ".join([day_list[i] for i in patient_readings])
print(f"WARNING: High values for {patient_name}: {days}")
## ----------------------------
giving the following output:
Williams reading on Monday was: 1.0
WARNING: High values for Robert: Saturday Sunday
I have compiled a Rust program for armv7-unknown-linux-gnueabihf, and I want it to run on a system that has glibc 2.16 installed. Unfortunately when running it I get this error:
./foo: /lib/libc.so.6: version `GLIBC_2.18' not found (required by ./foo)
Running objdump -T foo reveals that the only symbol needed from glibc 2.18 is:
00000000 w DF *UND* 00000000 GLIBC_2.18 __cxa_thread_atexit_impl
Rust makes __cxa_thread_atexit_impl a weak symbol (as seen by the little w flag from objdump), however GCC is apparently stupid and even though all the symbols from GLIBC_2.18 are weak it still makes GLIBC_2.18 itself a strong requirement. You can see that with readelf:
$ readelf -V foo
...
Version needs section '.gnu.version_r' contains 5 entries:
Addr: 0x0000000000001e4c Offset: 0x001e4c Link: 6 (.dynstr)
000000: Version: 1 File: ld-linux-armhf.so.3 Cnt: 1
0x0010: Name: GLIBC_2.4 Flags: none Version: 9
0x0020: Version: 1 File: librt.so.1 Cnt: 1
0x0030: Name: GLIBC_2.4 Flags: none Version: 5
0x0040: Version: 1 File: libgcc_s.so.1 Cnt: 4
0x0050: Name: GCC_4.3.0 Flags: none Version: 10
0x0060: Name: GCC_3.0 Flags: none Version: 7
0x0070: Name: GCC_3.5 Flags: none Version: 6
0x0080: Name: GCC_3.3.1 Flags: none Version: 4
0x0090: Version: 1 File: libc.so.6 Cnt: 2
0x00a0: Name: GLIBC_2.18 Flags: none Version: 8
0x00b0: Name: GLIBC_2.4 Flags: none Version: 3
0x00c0: Version: 1 File: libpthread.so.0 Cnt: 1
0x00d0: Name: GLIBC_2.4 Flags: none Version: 2
Notice that GLIBC_2.18 says Flags: none. It should say Flags: WEAK. Fortunately I found an amazing page where someone shows how to fix this. Unfortunately it involves hex editing the binary!
Take the offset of that .gnu.version_r table (0x001e4c), add the entry offset for GLIBC_2.18 (0x00a0), then add an offset for the flags field of the struct at that address (0x04). That gives 0x001EF0. At that address there should be two zero bytes: 0x0000. Change them to 0x0200.
Verify with readelf:
Version needs section '.gnu.version_r' contains 5 entries:
Addr: 0x0000000000001e4c Offset: 0x001e4c Link: 6 (.dynstr)
000000: Version: 1 File: ld-linux-armhf.so.3 Cnt: 1
0x0010: Name: GLIBC_2.4 Flags: none Version: 9
0x0020: Version: 1 File: librt.so.1 Cnt: 1
0x0030: Name: GLIBC_2.4 Flags: none Version: 5
0x0040: Version: 1 File: libgcc_s.so.1 Cnt: 4
0x0050: Name: GCC_4.3.0 Flags: none Version: 10
0x0060: Name: GCC_3.0 Flags: none Version: 7
0x0070: Name: GCC_3.5 Flags: none Version: 6
0x0080: Name: GCC_3.3.1 Flags: none Version: 4
0x0090: Version: 1 File: libc.so.6 Cnt: 2
0x00a0: Name: GLIBC_2.18 Flags: WEAK Version: 8
0x00b0: Name: GLIBC_2.4 Flags: none Version: 3
0x00c0: Version: 1 File: libpthread.so.0 Cnt: 1
0x00d0: Name: GLIBC_2.4 Flags: none Version: 2
Success! Except it still doesn't work:
./foo: /lib/libc.so.6: weak version `GLIBC_2.18' not found (required by ./foo)
./foo: relocation error: ./foo: symbol __cxa_thread_atexit_impl, version GLIBC_2.18 not defined in file libc.so.6 with link time reference
How is the weak version still required?! I can't wait for glibc to die.
Is there any way to get Rust to build the program without using this symbol?
You need a Rust toolchain which was compiled for glibc 2.16 or earlier. glibc 2.17 likely works as well because it lacks __cxa_thread_atexit_impl, so that it will not carry a GLIBC_2.18 symbol version in the binary.
The use of the weak symbol in the Rust code is not particularly useful because GNU's particular version of ELF symbol versioning does not have weak symbol versions. We might change that eventually, but right now, the best way to deal with this is to compile with a sufficiently old toolchain.
Another option is to backport the symbol into the glibc you use. This should be a fairly isolated backport, probably consisting of these commits:
C++11 thread_local destructors support
Avoid unconditional __call_tls_dtors calls in static linking.
Also use l_tls_dtor_count to decide on object unload (BZ #18657)
Harden tls_dtor_list with pointer mangling [BZ #19018]
(I have not attempted the backport to glibc 2.16, but as far as such things go, it does not look particularly difficult.)