golang gocv error when go run ./cmd/version/main.go - opencv

I'm pretty new in Golang and i have some problems to install gocv.
I don't know weather it is impotent to know, but
I use Manjaro Linux on version 5.19.3, the current go- version is 1.14.2 and last but not least gccgo on version 10.1.0 (amd64).
I installed gocv as described on https://gocv.io/getting-started/linux/
go get -u -d gocv.io/x/gocv
cd $GOPATH/pkg/mod/gocv.io/
make install
If it works correctly, following message should be desplayed:
gocv version: 0.24.0
opencv lib version: 4.4.0
# gocv.io/x/gocv
In file included from features2d.cpp:1:
features2d.h:22:21: error: 'SIFT' is not a member of 'cv'
22 | typedef cv::Ptr<cv::SIFT>* SIFT;
| ^~~~
features2d.h:22:21: error: 'SIFT' is not a member of 'cv'
features2d.h:22:25: error: template argument 1 is invalid
22 | typedef cv::Ptr<cv::SIFT>* SIFT;
| ^
features2d.cpp: In function 'int* SIFT_Create()':
features2d.cpp:434:28: error: 'SIFT' is not a member of 'cv'; did you mean 'SIFT'?
434 | return new cv::Ptr<cv::SIFT>(cv::SIFT::create());
| ^~~~
In file included from features2d.cpp:1:
features2d.h:22:28: note: 'SIFT' declared here
22 | typedef cv::Ptr<cv::SIFT>* SIFT;
| ^~~~
features2d.cpp:434:28: error: 'SIFT' is not a member of 'cv'; did you mean 'SIFT'?
434 | return new cv::Ptr<cv::SIFT>(cv::SIFT::create());
| ^~~~
In file included from features2d.cpp:1:
features2d.h:22:28: note: 'SIFT' declared here
22 | typedef cv::Ptr<cv::SIFT>* SIFT;
| ^~~~
features2d.cpp:434:32: error: template argument 1 is invalid
434 | return new cv::Ptr<cv::SIFT>(cv::SIFT::create());
| ^
features2d.cpp:434:38: error: 'cv::SIFT' has not been declared
434 | return new cv::Ptr<cv::SIFT>(cv::SIFT::create());
| ^~~~
features2d.cpp: In function 'KeyPoints SIFT_Detect(SIFT, Mat)':
features2d.cpp:443:9: error: base operand of '->' is not a pointer
443 | (*d)->detect(*src, detected);
| ^~
features2d.cpp: In function 'KeyPoints SIFT_DetectAndCompute(SIFT, Mat, Mat, Mat)':
features2d.cpp:460:9: error: base operand of '->' is not a pointer
460 | (*d)->detectAndCompute(*src, *mask, detected, *desc);
| ^~
Fehler: Prozess beendet mit Rückgabewert 2.
I tried to find a solution on in the internet, but I don't even understand the problem.
I hope someone can help me.
best regards
Felix

SIFT (Scale-Invariant Feature Transform) algorithm is a patented algorithm that requires user to import a non-free header file if you need to use it as below :
#include <opencv2/nonfree/nonfree.hpp>
However, the patent is already expired as of now. (OpenCV 4.4.0) So this package is moved to main repository of opencv (check release highlightes https://opencv.org/opencv-4-4-0/)
As a result,the gocv repository which using SIFT has been updated to get this algorithm from the opencv main repository as below, (in gocv v0.24.0 change log: https://github.com/hybridgroup/gocv/commit/04b71cbb6d82e8c396ccbbf0d65b446a80a0e8fa)
typedef cv::Ptr<cv::SIFT>* SIFT;
This is the line of code updated which causes you failed to build.(You will only get this error if you are not using opencv 4.4.0, you may check the MakeFile that you are using)
To solve this problem, you may try get/update the gocv repository again now as they have updated all MakeFile to use opencv 4.4.0 already. Or you may just manually update your MakeFile to change the opencv version to 4.4.0

Related

Make hdf5-1.14.0 on Debian: conflicting types for ‘ssize_t’

I have tried building HDF5 from source, on a virtual machine Linux #1 SMP Debian 5.10.140-1 (2022-09-02). I followed the basic instructions:
gunzip < hdf5-1.14.0.tar.gz | tar xf -
cd hdf5-1.14.0
./configure --prefix=/usr/local/hdf5
make
make check # run test suite.
make install
make check-install # verify installation
The configure step runs successfully (after removing the unwanted newline characters \r in the files which caused errors, as explained in 1) but the make command returns the following errors:
Making all in src
make[1]: entrata nella directory «/home/myname/hdf5-1.14.0/src»
make all-am
make[2]: entrata nella directory «/home/myname/hdf5-1.14.0/src»
CC H5.lo
In file included from H5private.h:36,
from H5.c:21:
/usr/include/stdio.h:77:19: error: conflicting types for ‘ssize_t’
77 | typedef __ssize_t ssize_t;
| ^~~~~~~
In file included from H5private.h:26,
from H5.c:21:
H5public.h:273:13: note: previous declaration of ‘ssize_t’ was here
273 | typedef int ssize_t;
| ^~~~~~~
In file included from H5.c:21:
H5private.h:438: warning: "LOCK_SH" redefined
438 | #define LOCK_SH 0x01
|
In file included from /usr/include/x86_64-linux-gnu/bits/fcntl.h:61,
from /usr/include/fcntl.h:35,
from H5private.h:31,
from H5.c:21:
/usr/include/x86_64-linux-gnu/bits/fcntl-linux.h:237: note: this is the location of the previous definition
237 | # define LOCK_SH 1 /* Shared lock. */
|
In file included from H5.c:21:
H5private.h:439: warning: "LOCK_EX" redefined
439 | #define LOCK_EX 0x02
|
In file included from /usr/include/x86_64-linux-gnu/bits/fcntl.h:61,
from /usr/include/fcntl.h:35,
from H5private.h:31,
from H5.c:21:
/usr/include/x86_64-linux-gnu/bits/fcntl-linux.h:238: note: this is the location of the previous definition
238 | # define LOCK_EX 2 /* Exclusive lock. */
|
In file included from H5.c:21:
H5private.h:440: warning: "LOCK_NB" redefined
440 | #define LOCK_NB 0x04
|
In file included from /usr/include/x86_64-linux-gnu/bits/fcntl.h:61,
from /usr/include/fcntl.h:35,
from H5private.h:31,
from H5.c:21:
/usr/include/x86_64-linux-gnu/bits/fcntl-linux.h:239: note: this is the location of the previous definition
239 | # define LOCK_NB 4 /* Or'd with one of the above to prevent
|
In file included from H5.c:21:
H5private.h:441: warning: "LOCK_UN" redefined
441 | #define LOCK_UN 0x08
|
In file included from /usr/include/x86_64-linux-gnu/bits/fcntl.h:61,
from /usr/include/fcntl.h:35,
from H5private.h:31,
from H5.c:21:
/usr/include/x86_64-linux-gnu/bits/fcntl-linux.h:241: note: this is the location of the previous definition
241 | # define LOCK_UN 8 /* Remove lock. */
|
make[2]: *** [Makefile:1737: H5.lo] Errore 1
make[2]: uscita dalla directory «/home/myname/hdf5-1.14.0/src»
make[1]: *** [Makefile:1201: all] Errore 2
make[1]: uscita dalla directory «/home/myname/hdf5-1.14.0/src»
make: *** [Makefile:729: all-recursive] Errore 1
HDF5 defines several POSIX things for platforms like Windows, including ssize_t. If it is getting re-defined on Linux, it's probably because the header is being mis-parsed.
Why are you getting Windows line endings on Linux? Where are you getting the source tarball?

Error '__rvm_make -j4' when trying to install Ruby through RVM

I am in a full stack developer bootcamp and we need to install Ruby on Rails. So far I have enabled the "Windows Subsystem for Linux" feature, installed WSL 2, installed Ubuntu, and installed curl, pnupg and git.
I am trying to install RVM using this command:
curl -sSL https://get.rvm.io | bash -s stable --ruby
but I keep getting Error running '__rvm_make -j4'
I am using Windows 10 Home.
Here is an abbreviated form of the log file. There were many more warnings about functions being deprecated since Open SSL 3.0.
In file included from /usr/include/openssl/x509.h:36,
from /usr/include/openssl/x509v3.h:25,
from ossl.h:23,
from ossl_pkey_rsa.c:10:
/usr/include/openssl/rsa.h:225:28: note: declared here
225 | OSSL_DEPRECATEDIN_3_0 void RSA_get0_crt_params(const RSA *r,
| ^~~~~~~~~~~~~~~~~~~
ossl_pkey_rsa.c: In function ‘ossl_rsa_get_iqmp’:
ossl_pkey_rsa.c:880:1: warning: ‘EVP_PKEY_get0_RSA’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
880 | OSSL_PKEY_BN_DEF3(rsa, RSA, crt_params, dmp1, dmq1, iqmp)
| ^~~~~~~~~~~~~~~~~
In file included from /usr/include/openssl/x509.h:29,
from /usr/include/openssl/x509v3.h:25,
from ossl.h:23,
from ossl_pkey_rsa.c:10:
/usr/include/openssl/evp.h:1346:22: note: declared here
1346 | const struct rsa_st *EVP_PKEY_get0_RSA(const EVP_PKEY *pkey);
| ^~~~~~~~~~~~~~~~~
ossl_pkey_rsa.c:23:11: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
23 | (rsa) = EVP_PKEY_get0_RSA(_pkey); \
| ^
ossl_pkey.h:102:9: note: in expansion of macro ‘GetRSA’
102 | Get##_type(self, obj); \
| ^~~
ossl_pkey.h:114:9: note: in expansion of macro ‘OSSL_PKEY_BN_DEF_GETTER0’
114 | OSSL_PKEY_BN_DEF_GETTER0(_keytype, _type, a3, \
| ^~~~~~~~~~~~~~~~~~~~~~~~
ossl_pkey.h:211:9: note: in expansion of macro ‘OSSL_PKEY_BN_DEF_GETTER3’
211 | OSSL_PKEY_BN_DEF_GETTER3(_keytype, _type, _group, a1, a2, a3) \
| ^~~~~~~~~~~~~~~~~~~~~~~~
ossl_pkey_rsa.c:880:1: note: in expansion of macro ‘OSSL_PKEY_BN_DEF3’
880 | OSSL_PKEY_BN_DEF3(rsa, RSA, crt_params, dmp1, dmq1, iqmp)
| ^~~~~~~~~~~~~~~~~
ossl_pkey_rsa.c:880:1: warning: ‘RSA_get0_crt_params’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
In file included from /usr/include/openssl/x509.h:36,
from /usr/include/openssl/x509v3.h:25,
from ossl.h:23,
from ossl_pkey_rsa.c:10:
/usr/include/openssl/rsa.h:225:28: note: declared here
225 | OSSL_DEPRECATEDIN_3_0 void RSA_get0_crt_params(const RSA *r,
| ^~~~~~~~~~~~~~~~~~~
ossl_pkey_rsa.c: In function ‘ossl_rsa_set_crt_params’:
ossl_pkey_rsa.c:880:1: warning: ‘EVP_PKEY_get0_RSA’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
880 | OSSL_PKEY_BN_DEF3(rsa, RSA, crt_params, dmp1, dmq1, iqmp)
| ^~~~~~~~~~~~~~~~~
In file included from /usr/include/openssl/x509.h:29,
from /usr/include/openssl/x509v3.h:25,
from ossl.h:23,
from ossl_pkey_rsa.c:10:
/usr/include/openssl/evp.h:1346:22: note: declared here
1346 | const struct rsa_st *EVP_PKEY_get0_RSA(const EVP_PKEY *pkey);
| ^~~~~~~~~~~~~~~~~
ossl_pkey_rsa.c:23:11: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
23 | (rsa) = EVP_PKEY_get0_RSA(_pkey); \
| ^
ossl_pkey.h:135:9: note: in expansion of macro ‘GetRSA’
135 | Get##_type(self, obj); \
| ^~~
ossl_pkey.h:212:9: note: in expansion of macro ‘OSSL_PKEY_BN_DEF_SETTER3’
212 | OSSL_PKEY_BN_DEF_SETTER3(_keytype, _type, _group, a1, a2, a3)
| ^~~~~~~~~~~~~~~~~~~~~~~~
ossl_pkey_rsa.c:880:1: note: in expansion of macro ‘OSSL_PKEY_BN_DEF3’
880 | OSSL_PKEY_BN_DEF3(rsa, RSA, crt_params, dmp1, dmq1, iqmp)
| ^~~~~~~~~~~~~~~~~
ossl_pkey_rsa.c:880:1: warning: ‘RSA_set0_crt_params’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
In file included from /usr/include/openssl/x509.h:36,
from /usr/include/openssl/x509v3.h:25,
from ossl.h:23,
from ossl_pkey_rsa.c:10:
/usr/include/openssl/rsa.h:209:27: note: declared here
209 | OSSL_DEPRECATEDIN_3_0 int RSA_set0_crt_params(RSA *r,
| ^~~~~~~~~~~~~~~~~~~
ossl_pkey_rsa.c: In function ‘Init_ossl_rsa’:
ossl_pkey_rsa.c:885:58: error: ‘RSA_SSLV23_PADDING’ undeclared (first use in this function); did you mean ‘RSA_NO_PADDING’?
885 | #define DefRSAConst(x) rb_define_const(cRSA, #x, INT2NUM(RSA_##x))
| ^~~~
ossl_pkey_rsa.c:950:5: note: in expansion of macro ‘DefRSAConst’
950 | DefRSAConst(SSLV23_PADDING);
| ^~~~~~~~~~~
ossl_pkey_rsa.c:885:58: note: each undeclared identifier is reported only once for each function it appears in
885 | #define DefRSAConst(x) rb_define_const(cRSA, #x, INT2NUM(RSA_##x))
| ^~~~
ossl_pkey_rsa.c:950:5: note: in expansion of macro ‘DefRSAConst’
950 | DefRSAConst(SSLV23_PADDING);
| ^~~~~~~~~~~
cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics
compiling sha2.c
ossl_pkey_rsa.c: At top level:
cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics
make[2]: *** [Makefile:328: ossl_pkey_rsa.o] Error 1
make[2]: Leaving directory '/home/mmullen/.rvm/src/ruby-3.0.0/ext/openssl'
make[1]: *** [exts.mk:260: ext/openssl/all] Error 2
make[1]: *** Waiting for unfinished jobs....
installing default sha2 libraries
linking shared-object socket.so
checking ../.././parse.y and ../.././ext/ripper/eventids2.c
In file included from sha2.c:40:
sha2.c:578:28: warning: argument 2 of type ‘sha2_byte[]’ {aka ‘unsigned char[]’} with mismatched bound [-Warray-parameter=]
578 | int SHA256_Final(sha2_byte digest[], SHA256_CTX* context) {
| ~~~~~~~~~~^~~~~~~~
sha2.h:145:50: note: in definition of macro ‘SHA256_Final’
145 | #define SHA256_Final(d, c) SHA256_Finish(c, d)
| ^
sha2.h:170:18: note: previously declared as ‘uint8_t[32]’ {aka ‘unsigned char[32]’}
170 | int SHA256_Final(uint8_t[SHA256_DIGEST_LENGTH], SHA256_CTX*);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sha2.h:145:50: note: in definition of macro ‘SHA256_Final’
145 | #define SHA256_Final(d, c) SHA256_Finish(c, d)
| ^
sha2.c:643:44: warning: argument 2 of type ‘char[]’ with mismatched bound [-Warray-parameter=]
643 | char *SHA256_End(SHA256_CTX* context, char buffer[]) {
| ~~~~~^~~~~~~~
In file included from sha2.c:40:
sha2.h:171:31: note: previously declared as ‘char[65]’
171 | char* SHA256_End(SHA256_CTX*, char[SHA256_DIGEST_STRING_LENGTH]);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sha2.c:946:28: warning: argument 2 of type ‘sha2_byte[]’ {aka ‘unsigned char[]’} with mismatched bound [-Warray-parameter=]
946 | int SHA512_Final(sha2_byte digest[], SHA512_CTX* context) {
| ~~~~~~~~~~^~~~~~~~
sha2.h:163:50: note: in definition of macro ‘SHA512_Final’
163 | #define SHA512_Final(d, c) SHA512_Finish(c, d)
| ^
sha2.h:182:18: note: previously declared as ‘uint8_t[64]’ {aka ‘unsigned char[64]’}
182 | int SHA512_Final(uint8_t[SHA512_DIGEST_LENGTH], SHA512_CTX*);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sha2.h:163:50: note: in definition of macro ‘SHA512_Final’
163 | #define SHA512_Final(d, c) SHA512_Finish(c, d)
| ^
sha2.c:976:44: warning: argument 2 of type ‘char[]’ with mismatched bound [-Warray-parameter=]
976 | char *SHA512_End(SHA512_CTX* context, char buffer[]) {
| ~~~~~^~~~~~~~
In file included from sha2.c:40:
sha2.h:183:31: note: previously declared as ‘char[129]’
183 | char* SHA512_End(SHA512_CTX*, char[SHA512_DIGEST_STRING_LENGTH]);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sha2.c:1022:28: warning: argument 2 of type ‘sha2_byte[]’ {aka ‘unsigned char[]’} with mismatched bound [-Warray-parameter=]
1022 | int SHA384_Final(sha2_byte digest[], SHA384_CTX* context) {
| ~~~~~~~~~~^~~~~~~~
sha2.h:154:50: note: in definition of macro ‘SHA384_Final’
154 | #define SHA384_Final(d, c) SHA384_Finish(c, d)
| ^
sha2.h:176:18: note: previously declared as ‘uint8_t[48]’ {aka ‘unsigned char[48]’}
176 | int SHA384_Final(uint8_t[SHA384_DIGEST_LENGTH], SHA384_CTX*);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sha2.h:154:50: note: in definition of macro ‘SHA384_Final’
154 | #define SHA384_Final(d, c) SHA384_Finish(c, d)
| ^
sha2.c:1052:44: warning: argument 2 of type ‘char[]’ with mismatched bound [-Warray-parameter=]
1052 | char *SHA384_End(SHA384_CTX* context, char buffer[]) {
| ~~~~~^~~~~~~~
In file included from sha2.c:40:
sha2.h:177:31: note: previously declared as ‘char[97]’
177 | char* SHA384_End(SHA384_CTX*, char[SHA384_DIGEST_STRING_LENGTH]);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
installing default ripper libraries
linking shared-object ripper.so
cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics
make[2]: Leaving directory '/home/mmullen/.rvm/src/ruby-3.0.0/ext/socket'
linking shared-object digest/sha2.so
make[2]: Leaving directory '/home/mmullen/.rvm/src/ruby-3.0.0/ext/ripper'
make[2]: Leaving directory '/home/mmullen/.rvm/src/ruby-3.0.0/ext/digest/sha2'
make[1]: Leaving directory '/home/mmullen/.rvm/src/ruby-3.0.0'
make: *** [uncommon.mk:300: build-ext] Error 2
++ /scripts/functions/support : __rvm_make() 383 > return 2
(END)
Just in case someone else stumbles across this question, the answer can be found in the answers to this Github issue. Even though there are a few similar bug reports with similar answers exists for Ubuntu, this looks like the most direct.
$rvm pkg install openssl
$rvm install ruby-<version> --with-openssl-dir=/usr/share/rvm/usr

Error running '__rvm_make -j8' when trying to install ruby 2.6.2 on Ubuntu 22.4 [duplicate]

I have tried to install several versions of ruby (2.5.5, 2.6.6, 2.7.4, 3.0.0) and in all cases it has given the same error, of course with each version, in this example I only put the error for version 2.6.6:
$ rvm use ruby --install --default 2.6.6
Required ruby-2.6.6 is not installed - installing.
ruby-2.6.6 - #removing src/ruby-2.6.6..
Searching for binary rubies, this might take some time.
No binary rubies available for: ubuntu/22.04/x86_64/ruby-2.6.6.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for ubuntu.
Requirements installation successful.
Installing Ruby from source to: /home/elorat/.rvm/rubies/ruby-2.6.6, this may take a while depending on your cpu(s)...
ruby-2.6.6 - #downloading ruby-2.6.6, this may take a while depending on your connection...
ruby-2.6.6 - #extracting ruby-2.6.6 to /home/elorat/.rvm/src/ruby-2.6.6.....
ruby-2.6.6 - #configuring......................................................................
ruby-2.6.6 - #post-configuration..
ruby-2.6.6 - #compiling..........................................................................................................-
Error running '__rvm_make -j4',
please read /home/elorat/.rvm/log/1652140330_ruby-2.6.6/make.log
There has been an error while running make. Halting the installation.
This is my work environment:
$ rvm --version
rvm 1.29.12-next (master) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04 LTS
Release: 22.04
Codename: jammy
UPDATE
I can't put the whole make.log file because the Body is limited to 30000 characters; the make.log file is 90138 characters long. I'm going to put the first 18788 characters.
this is part of the file make.log.
[2022-05-10 07:17:47] __rvm_make
__rvm_make ()
{
\make "$#" || return $?
}
current path: /home/elorat/.rvm/src/ruby-2.6.6
GEM_PATH=/home/elorat/.rvm/gems/ruby-2.6.6:/home/elorat/.rvm/gems/ruby-2.6.6#global
PATH=/home/elorat/.rvm/gems/ruby-2.6.6/bin:/home/elorat/.rvm/gems/ruby-2.6.6#global/bin:/home/elorat/.rvm/rubies/ruby-2.6.6/bin:/home/elorat/.rvm/bin:/home/elorat/.nvm/versions/node/v12.22.9/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin
command(2): __rvm_make -j4
++ make -j4
BASERUBY = echo executable host ruby is required. use --with-baseruby option.; false
CC = gcc
LD = ld
LDSHARED = gcc -shared
CFLAGS = -O3 -ggdb3 -Wall -Wextra -Wdeclaration-after-statement -Wdeprecated-declarations -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wrestrict -Wwrite-strings -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -std=gnu99 -fPIC
XCFLAGS = -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fno-strict-overflow -fvisibility=hidden -fexcess-precision=standard -DRUBY_EXPORT -DCANONICALIZATION_FOR_MATHN
CPPFLAGS = -I. -I.ext/include/x86_64-linux -I./include -I. -I./enc/unicode/12.1.0
DLDFLAGS = -Wl,--compress-debug-sections=zlib -Wl,-soname,libruby.so.2.6 -fstack-protector-strong
SOLIBS = -lz -lpthread -lrt -lrt -lgmp -ldl -lcrypt -lm
LANG = en_US.UTF-8
LC_ALL =
LC_CTYPE =
gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
compiling ./main.c
compiling dmydln.c
compiling miniinit.c
compiling dmyext.c
compiling miniprelude.c
making dummy probes.h
compiling ast.c
compiling bignum.c
compiling class.c
compiling compar.c
In file included from ./include/ruby.h:33,
from internal.h:15,
from class.c:26:
class.c: In function ‘move_refined_method’:
class.c:955:30: warning: taking address of packed member of ‘struct rb_method_definition_struct’ may result in an unaligned pointer value [-Waddress-of-packed-member]
955 | RB_OBJ_WRITE(me, &me->def->body.refined.orig_me, NULL);
./include/ruby/ruby.h:1493:75: note: in definition of macro ‘RB_OBJ_WRITE’
1493 | #define RB_OBJ_WRITE(a, slot, b) rb_obj_write((VALUE)(a), (VALUE *)(slot), (VALUE)(b), __FILE__, __LINE__)
| ^~~~
compiling compile.c
compile.c: In function ‘update_catch_except_flags’:
compile.c:1291:54: warning: taking address of packed member of ‘struct iseq_catch_table’ may result in an unaligned pointer value [-Waddress-of-packed-member]
1291 | const struct iseq_catch_table_entry *entry = &ct->entries[i];
| ^~~~~~~~~~~~~~~
compile.c: In function ‘iseq_set_exception_table’:
compile.c:2356:21: warning: taking address of packed member of ‘struct iseq_catch_table’ may result in an unaligned pointer value [-Waddress-of-packed-member]
2356 | entry = &table->entries[i];
| ^~~~~~~~~~~~~~~~~~
compiling complex.c
class.c: At top level:
cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics
compiling cont.c
compiling debug.c
compiling debug_counter.c
compiling dir.c
compiling dln_find.c
compiling encoding.c
compiling enum.c
compiling enumerator.c
compiling error.c
compiling eval.c
compiling file.c
compiling gc.c
gc.c: In function ‘mark_current_machine_context’:
gc.c:4377:36: warning: expression does not compute the number of elements in this array; element type is ‘struct __jmp_buf_tag’, not ‘VALUE’ {aka ‘long unsigned int’} [-Wsizeof-array-div]
4377 | VALUE v[sizeof(rb_jmp_buf) / sizeof(VALUE)];
| ^
gc.c:4377:36: note: add parentheses around the second ‘sizeof’ to silence this warning
compiling hash.c
compiling inits.c
compile.c: At top level:
cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics
compiling io.c
compiling iseq.c
iseq.c: In function ‘rb_iseq_mark’:
iseq.c:252:25: warning: taking address of packed member of ‘struct iseq_catch_table’ may result in an unaligned pointer value [-Waddress-of-packed-member]
252 | entry = &table->entries[i];
| ^~~~~~~~~~~~~~~~~~
iseq.c: In function ‘rb_iseq_disasm_recursive’:
iseq.c:2067:58: warning: taking address of packed member of ‘struct iseq_catch_table’ may result in an unaligned pointer value [-Waddress-of-packed-member]
2067 | const struct iseq_catch_table_entry *entry = &body->catch_table->entries[i];
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
iseq.c: In function ‘iseq_iterate_children’:
iseq.c:2200:58: warning: taking address of packed member of ‘struct iseq_catch_table’ may result in an unaligned pointer value [-Waddress-of-packed-member]
2200 | const struct iseq_catch_table_entry *entry = &body->catch_table->entries[i];
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
iseq.c: In function ‘iseq_data_to_ary’:
iseq.c:2710:54: warning: taking address of packed member of ‘struct iseq_catch_table’ may result in an unaligned pointer value [-Waddress-of-packed-member]
2710 | const struct iseq_catch_table_entry *entry = &iseq_body->catch_table->entries[i];
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compiling load.c
compiling marshal.c
gc.c: At top level:
cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics
iseq.c: At top level:
cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics
compiling math.c
making mjit_config.h
compiling mjit_compile.c
compiling node.c
compiling numeric.c
compiling object.c
compiling pack.c
compiling parse.c
compiling proc.c
compiling process.c
compiling random.c
compiling range.c
compiling rational.c
compiling re.c
compiling regcomp.c
compiling regenc.c
compiling regerror.c
compiling regexec.c
compiling regparse.c
compiling regsyntax.c
compiling ruby.c
compiling safe.c
compiling signal.c
compiling sprintf.c
compiling st.c
compiling strftime.c
strftime.c: In function ‘rb_strftime_with_timespec’:
strftime.c:386:39: warning: comparison is always false due to limited range of data type [-Wtype-limits]
386 | if (vtm->wday < 0 || vtm->wday > 6)
| ^
strftime.c:397:39: warning: comparison is always false due to limited range of data type [-Wtype-limits]
397 | if (vtm->wday < 0 || vtm->wday > 6)
| ^
compiling string.c
string.c: In function ‘str_replace_shared_without_enc’:
string.c:1189:13: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
1189 | char *ptr2 = STR_HEAP_PTR(str2);
| ^~~~
string.c: In function ‘rb_str_setbyte’:
string.c:5471:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
5471 | VALUE v = rb_to_int(value);
| ^~~~~
string.c: In function ‘get_reg_grapheme_cluster’:
string.c:8521:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
8521 | int r = onig_new(&reg_grapheme_cluster, source, source + source_len,
| ^~~
strftime.c: At top level:
cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics
compiling struct.c
compiling symbol.c
compiling thread.c
In file included from thread.c:68:
thread_sync.c: In function ‘queue_alloc’:
eval_intern.h:172:64: warning: taking address of packed member of ‘struct rb_queue’ may result in an unaligned pointer value [-Waddress-of-packed-member]
172 | #define UNALIGNED_MEMBER_PTR(ptr, mem) UNALIGNED_MEMBER_ACCESS(&(ptr)->mem)
eval_intern.h:170:40: note: in definition of macro ‘UNALIGNED_MEMBER_ACCESS’
170 | # define UNALIGNED_MEMBER_ACCESS(expr) expr
| ^~~~
thread_sync.c:545:24: note: in expansion of macro ‘UNALIGNED_MEMBER_PTR’
545 | #define queue_waitq(q) UNALIGNED_MEMBER_PTR(q, waitq)
| ^~~~~~~~~~~~~~~~~~~~
thread_sync.c:590:20: note: in expansion of macro ‘queue_waitq’
590 | list_head_init(queue_waitq(q));
| ^~~~~~~~~~~
thread_sync.c: In function ‘queue_fork_check’:
eval_intern.h:172:64: warning: taking address of packed member of ‘struct rb_queue’ may result in an unaligned pointer value [-Waddress-of-packed-member]
172 | #define UNALIGNED_MEMBER_PTR(ptr, mem) UNALIGNED_MEMBER_ACCESS(&(ptr)->mem)
eval_intern.h:170:40: note: in definition of macro ‘UNALIGNED_MEMBER_ACCESS’
170 | # define UNALIGNED_MEMBER_ACCESS(expr) expr
| ^~~~
thread_sync.c:545:24: note: in expansion of macro ‘UNALIGNED_MEMBER_PTR’
545 | #define queue_waitq(q) UNALIGNED_MEMBER_PTR(q, waitq)
| ^~~~~~~~~~~~~~~~~~~~
thread_sync.c:604:20: note: in expansion of macro ‘queue_waitq’
604 | list_head_init(queue_waitq(q));
| ^~~~~~~~~~~
thread_sync.c: In function ‘szqueue_alloc’:
eval_intern.h:172:64: warning: taking address of packed member of ‘struct rb_queue’ may result in an unaligned pointer value [-Waddress-of-packed-member]
172 | #define UNALIGNED_MEMBER_PTR(ptr, mem) UNALIGNED_MEMBER_ACCESS(&(ptr)->mem)
eval_intern.h:170:40: note: in definition of macro ‘UNALIGNED_MEMBER_ACCESS’
170 | # define UNALIGNED_MEMBER_ACCESS(expr) expr
| ^~~~
thread_sync.c:553:27: note: in expansion of macro ‘UNALIGNED_MEMBER_PTR’
553 | #define szqueue_waitq(sq) UNALIGNED_MEMBER_PTR(sq, q.waitq)
| ^~~~~~~~~~~~~~~~~~~~
thread_sync.c:648:20: note: in expansion of macro ‘szqueue_waitq’
648 | list_head_init(szqueue_waitq(sq));
| ^~~~~~~~~~~~~
eval_intern.h:172:64: warning: taking address of packed member of ‘struct rb_szqueue’ may result in an unaligned pointer value [-Waddress-of-packed-member]
172 | #define UNALIGNED_MEMBER_PTR(ptr, mem) UNALIGNED_MEMBER_ACCESS(&(ptr)->mem)
eval_intern.h:170:40: note: in definition of macro ‘UNALIGNED_MEMBER_ACCESS’
170 | # define UNALIGNED_MEMBER_ACCESS(expr) expr
| ^~~~
thread_sync.c:554:27: note: in expansion of macro ‘UNALIGNED_MEMBER_PTR’
554 | #define szqueue_pushq(sq) UNALIGNED_MEMBER_PTR(sq, pushq)
| ^~~~~~~~~~~~~~~~~~~~
thread_sync.c:649:20: note: in expansion of macro ‘szqueue_pushq’
649 | list_head_init(szqueue_pushq(sq));
| ^~~~~~~~~~~~~
thread_sync.c: In function ‘szqueue_ptr’:
eval_intern.h:172:64: warning: taking address of packed member of ‘struct rb_szqueue’ may result in an unaligned pointer value [-Waddress-of-packed-member]
172 | #define UNALIGNED_MEMBER_PTR(ptr, mem) UNALIGNED_MEMBER_ACCESS(&(ptr)->mem)
eval_intern.h:170:40: note: in definition of macro ‘UNALIGNED_MEMBER_ACCESS’
170 | # define UNALIGNED_MEMBER_ACCESS(expr) expr
| ^~~~
thread_sync.c:554:27: note: in expansion of macro ‘UNALIGNED_MEMBER_PTR’
554 | #define szqueue_pushq(sq) UNALIGNED_MEMBER_PTR(sq, pushq)
| ^~~~~~~~~~~~~~~~~~~~
thread_sync.c:660:24: note: in expansion of macro ‘szqueue_pushq’
660 | list_head_init(szqueue_pushq(sq));
| ^~~~~~~~~~~~~
thread_sync.c: In function ‘rb_queue_initialize’:
thread_sync.c:761:24: warning: taking address of packed member of ‘struct rb_queue’ may result in an unaligned pointer value [-Waddress-of-packed-member]
761 | RB_OBJ_WRITE(self, &q->que, ary_buf_new());
eval_intern.h:170:40: note: in definition of macro ‘UNALIGNED_MEMBER_ACCESS’
170 | # define UNALIGNED_MEMBER_ACCESS(expr) expr
| ^~~~
thread_sync.c:761:5: note: in expansion of macro ‘RB_OBJ_WRITE’
761 | RB_OBJ_WRITE(self, &q->que, ary_buf_new());
| ^~~~~~~~~~~~
eval_intern.h:172:64: warning: taking address of packed member of ‘struct rb_queue’ may result in an unaligned pointer value [-Waddress-of-packed-member]
172 | #define UNALIGNED_MEMBER_PTR(ptr, mem) UNALIGNED_MEMBER_ACCESS(&(ptr)->mem)
eval_intern.h:170:40: note: in definition of macro ‘UNALIGNED_MEMBER_ACCESS’
170 | # define UNALIGNED_MEMBER_ACCESS(expr) expr
| ^~~~
thread_sync.c:545:24: note: in expansion of macro ‘UNALIGNED_MEMBER_PTR’
545 | #define queue_waitq(q) UNALIGNED_MEMBER_PTR(q, waitq)
| ^~~~~~~~~~~~~~~~~~~~
thread_sync.c:762:20: note: in expansion of macro ‘queue_waitq’
762 | list_head_init(queue_waitq(q));
| ^~~~~~~~~~~
thread_sync.c: In function ‘queue_do_push’:
eval_intern.h:172:64: warning: taking address of packed member of ‘struct rb_queue’ may result in an unaligned pointer value [-Waddress-of-packed-member]
172 | #define UNALIGNED_MEMBER_PTR(ptr, mem) UNALIGNED_MEMBER_ACCESS(&(ptr)->mem)
eval_intern.h:170:40: note: in definition of macro ‘UNALIGNED_MEMBER_ACCESS’
170 | # define UNALIGNED_MEMBER_ACCESS(expr) expr
| ^~~~
thread_sync.c:545:24: note: in expansion of macro ‘UNALIGNED_MEMBER_PTR’
545 | #define queue_waitq(q) UNALIGNED_MEMBER_PTR(q, waitq)
| ^~~~~~~~~~~~~~~~~~~~
thread_sync.c:773:16: note: in expansion of macro ‘queue_waitq’
773 | wakeup_one(queue_waitq(q));
| ^~~~~~~~~~~
thread_sync.c: In function ‘rb_queue_close’:
eval_intern.h:172:64: warning: taking address of packed member of ‘struct rb_queue’ may result in an unaligned pointer value [-Waddress-of-packed-member]
172 | #define UNALIGNED_MEMBER_PTR(ptr, mem) UNALIGNED_MEMBER_ACCESS(&(ptr)->mem)
eval_intern.h:170:40: note: in definition of macro ‘UNALIGNED_MEMBER_ACCESS’
170 | # define UNALIGNED_MEMBER_ACCESS(expr) expr
| ^~~~
thread_sync.c:545:24: note: in expansion of macro ‘UNALIGNED_MEMBER_PTR’
545 | #define queue_waitq(q) UNALIGNED_MEMBER_PTR(q, waitq)
| ^~~~~~~~~~~~~~~~~~~~
thread_sync.c:818:20: note: in expansion of macro ‘queue_waitq’
818 | wakeup_all(queue_waitq(q));
| ^~~~~~~~~~~
In file included from vm_core.h:77,
from eval_intern.h:5,
from thread.c:68:
thread_sync.c: In function ‘queue_do_pop’:
thread_sync.c:910:27: warning: taking address of packed member of ‘struct rb_queue’ may result in an unaligned pointer value [-Waddress-of-packed-member]
910 | list_add_tail(&qw.as.q->waitq, &qw.w.node);
| ^~~~~~~~~~~~~~~
ccan/list/list.h:195:44: note: in definition of macro ‘list_add_tail’
195 | #define list_add_tail(h, n) list_add_tail_(h, n, LIST_LOC)
| ^
In file included from thread.c:68:
thread_sync.c: In function ‘rb_szqueue_initialize’:
thread_sync.c:1036:24: warning: taking address of packed member of ‘struct rb_queue’ may result in an unaligned pointer value [-Waddress-of-packed-member]
1036 | RB_OBJ_WRITE(self, &sq->q.que, ary_buf_new());
eval_intern.h:170:40: note: in definition of macro ‘UNALIGNED_MEMBER_ACCESS’
170 | # define UNALIGNED_MEMBER_ACCESS(expr) expr
| ^~~~
thread_sync.c:1036:5: note: in expansion of macro ‘RB_OBJ_WRITE’
1036 | RB_OBJ_WRITE(self, &sq->q.que, ary_buf_new());
| ^~~~~~~~~~~~
eval_intern.h:172:64: warning: taking address of packed member of ‘struct rb_queue’ may result in an unaligned pointer value [-Waddress-of-packed-member]
172 | #define UNALIGNED_MEMBER_PTR(ptr, mem) UNALIGNED_MEMBER_ACCESS(&(ptr)->mem)
eval_intern.h:170:40: note: in definition of macro ‘UNALIGNED_MEMBER_ACCESS’
170 | # define UNALIGNED_MEMBER_ACCESS(expr) expr
| ^~~~
thread_sync.c:553:27: note: in expansion of macro ‘UNALIGNED_MEMBER_PTR’
553 | #define szqueue_waitq(sq) UNALIGNED_MEMBER_PTR(sq, q.waitq)
| ^~~~~~~~~~~~~~~~~~~~
thread_sync.c:1037:20: note: in expansion of macro ‘szqueue_waitq’
1037 | list_head_init(szqueue_waitq(sq));
| ^~~~~~~~~~~~~
eval_intern.h:172:64: warning: taking address of packed member of ‘struct rb_szqueue’ may result in an unaligned pointer value [-Waddress-of-packed-member]
172 | #define UNALIGNED_MEMBER_PTR(ptr, mem) UNALIGNED_MEMBER_ACCESS(&(ptr)->mem)
...
It appears you have installed OpenSSL 3.0 (which is the only version of OpenSSL available on Ubuntu 22.04).
As this is a major update from previous OpenSSL versions, many libraries using OpenSSL (including Ruby) need to be adapted to use the changed APIs of OpenSSL. OpenSSL 3.0 is supported starting with version 3.0.0 of the openssl gem, which in turn was first shipped with Ruby version 3.1.0.
As such, to be able to install a custom version of Ruby on your Ubuntu 22.0.4 (with rbenv / rvm / ruby-install), you have to use at least Ruby 3.1.0.
Ubuntu 22.04 ships with a patched version of Ruby 3.0.2 which you may also use. Older Ruby versions are unfortunately not supported directly. If you need an older Ruby version on Ubuntu 22.04, you would also have to compile a custom OpenSSL 1.1.1 and compile Ruby against this custom OpenSSL.
I was unable to install ruby 2.7.6 on ubuntu 22.04
$ lsb_release -d
Description: Ubuntu 22.04 LTS
$ rvm install ruby-2.7.6
...
ruby-2.7.6 - #extracting ruby-2.7.6 to /home/dgautier/.rvm/src/ruby-2.7.6 - please wait
ruby-2.7.6 - #configuring - please wait
ruby-2.7.6 - #post-configuration - please wait
ruby-2.7.6 - #compiling - please wait
ruby-2.7.6 - #installing - please wait
Error running '__rvm_make install',
please read /home/kriom/.rvm/log/1654075018_ruby-2.7.6/install.log
There has been an error while running make install. Halting the installation.
$ cat /home/kriom/.rvm/log/1654075018_ruby-2.7.6/install.log
installing default gems from lib: /home/dgautier/.rvm/rubies/ruby-2.7.6/lib/ruby/gems/2.7.0 (build_info, cache, doc, extensions, gems, specifications)
benchmark 0.1.0
/home/dgautier/.rvm/src/ruby-2.7.6/lib/rubygems/core_ext/kernel_require.rb:83:in `require': cannot load such file -- openssl (LoadError)
from /home/dgautier/.rvm/src/ruby-2.7.6/lib/rubygems/core_ext/kernel_require.rb:83:in `require'
from /home/dgautier/.rvm/src/ruby-2.7.6/lib/rubygems/specification.rb:2430:in `to_ruby'
from ./tool/rbinstall.rb:846:in `block (2 levels) in install_default_gem'
from ./tool/rbinstall.rb:279:in `open_for_install'
from ./tool/rbinstall.rb:845:in `block in install_default_gem'
from ./tool/rbinstall.rb:835:in `each'
from ./tool/rbinstall.rb:835:in `install_default_gem'
from ./tool/rbinstall.rb:799:in `block in <main>'
from ./tool/rbinstall.rb:950:in `block in <main>'
from ./tool/rbinstall.rb:947:in `each'
from ./tool/rbinstall.rb:947:in `<main>'
make: *** [uncommon.mk:380: do-install-nodoc] Error 1
++ return 2
This fix this issue :
$ rvm pkg install openssl
$ rvm reinstall 2.7.6 --with-openssl-dir=/home/$(whoami)/.rvm/usr
Run rvmsudo rvm pkg install openssl
then:
rvmsudo rvm install 2.5.1 --with-openssl-dir=/usr/share/rvm/usr
Issue command
rvm pkg install openssl
And watch output
Extracting openssl to /usr/share/rvm/src/openssl-1.0.1i.....
Configuring openssl in /usr/share/rvm/src/openssl-1.0.1i.........
Compiling openssl in /usr/share/rvm/src/openssl-1.0.1i.....
Installing openssl to /usr/share/rvm/usr.................
And then
rvm install 2.4.1 --with-openssl-dir=/usr/share/rvm/usr # directory taken from output Installing openssl to /usr/share/rvm/usr
I am also facing this issue while installing ruby-2.6.5 through rvm in Ubuntu-22.04
ruby-2.5 and below versions are not supported in Ubuntu-22.04 so for that I found one solution to install openssl which support all ruby versions
rvm get head
wget https://www.openssl.org/source/openssl-1.1.1g.tar.gz
tar zxvf openssl-1.1.1g.tar.gz
cd openssl-1.1.1g
./config --prefix=$HOME/.openssl/openssl-1.1.1g --openssldir=$HOME/.openssl/openssl-1.1.1g
make
make test
make install
rm -rf ~/.openssl/openssl-1.1.1g/certs
ln -s /etc/ssl/certs ~/.openssl/openssl-1.1.1g/certs
Install any ruby version with --with-openssl-dir option.
I installed ruby-2.6.5 like this:
rvm reinstall ruby-2.6.5 --with-openssl-dir=$HOME/.openssl/openssl-1.1.1g
As your errors highlited teh gemset not created, do in one line:
rvm use ruby-2.6.6 --install --default --create
or, if it fails, try:
ruby -v
rvm list
rvm install ruby-2.6.6
rvm use ruby-2.6.6 --default
The thing is that you are using the 22.04 version of ubuntu which contains only the openssl of version above 3 but ruby and rails runs on the version 1.1 of the ssl either u downgrade your ubuntu version or openssl version . I rather done downgrading my ubuntu version

How can I fix missing documentation for an enum when using pest?

I use the pest parser to parse my input, but it always gives me two "missing documentation" warnings:
#[allow(missing_copy_implementations, missing_docs)]
#[derive(Parser, Debug, Clone)]
#[grammar = "grammar.pest"]
pub struct MyParser;
leads to:
warning: missing documentation for an enum
--> src/lib.rs:76:10
|
76 | #[derive(Parser, Debug, Clone)]
| ^^^^^^
|
note: the lint level is defined here
--> src/lib.rs:7:5
|
7 | missing_docs,
| ^^^^^^^^^^^^
= note: this warning originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
warning: missing documentation for a variant
--> src/lib.rs:76:10
|
76 | #[derive(Parser, Debug, Clone)]
| ^^^^^^
|
= note: this warning originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
warning: 2 warnings emitted
How can I fix that? Only the struct should have documentation, the enum should be private.
Derive macros can choose to copy attributes when they generate new types -- so in theory Pest could copy over your #[allow(missing_docs)] directive to the enum it's generating (or copy over the documentation itself). Without Pest adding this feature, your only option to suppress this warning is to put #![allow(missing_docs)] at the top of the file.

qemu-irix fails to build under Alpine 3.10 (GCC 8.3)

Just for fun, I'm attempting to build the irixxxx's qemu-irix as a Docker image.
It builds successfuly under Debian Buster (using GCC 8 container). However, it fails to build under Alpine 3.10 (it fails only when I selected the Irix targets), with the following errors (at the make stage):
CC util/oslib-posix.o
In file included from util/oslib-posix.c:39:
/usr/include/sys/signal.h:1:2: warning: #warning redirecting incorrect #include <sys/signal.h> to <signal.h> [-Wcpp]
#warning redirecting incorrect #include <sys/signal.h> to <signal.h>
^~~~~~~
CC util/qemu-openpty.o
util/qemu-openpty.c: In function 'qemu_openpty_raw':
util/qemu-openpty.c:123:9: warning: implicit declaration of function 'openpty'; did you mean 'openat'? [-Wimplicit-function-declaration]
if (openpty(&amaster, aslave, pty_buf, NULL, NULL) < 0) {
^~~~~~~
openat
util/qemu-openpty.c:123:9: warning: nested extern declaration of 'openpty' [-Wnested-externs]
(...)
CC irix-linux-user/linux-user/syscall.o
/qemu-irix/linux-user/syscall.c:6784:22: error: 'F_EXLCK' undeclared here (not in a function); did you mean 'F_RDLCK'?
TRANSTBL_CONVERT(F_EXLCK),
^~~~~~~
/qemu-irix/linux-user/syscall.c:6779:51: note: in definition of macro 'TRANSTBL_CONVERT'
#define TRANSTBL_CONVERT(a) { -1, TARGET_##a, -1, a }
^
/qemu-irix/linux-user/syscall.c:6785:22: error: 'F_SHLCK' undeclared here (not in a function); did you mean 'F_RDLCK'?
TRANSTBL_CONVERT(F_SHLCK),
^~~~~~~
/qemu-irix/linux-user/syscall.c:6779:51: note: in definition of macro 'TRANSTBL_CONVERT'
#define TRANSTBL_CONVERT(a) { -1, TARGET_##a, -1, a }
^
In file included from /qemu-irix/linux-user/syscall.c:121:
/qemu-irix/linux-user/syscall.c: In function 'target_to_host_sigevent':
/qemu-irix/linux-user/syscall.c:7422:27: error: 'struct sigevent' has no member named '_sigev_un'; did you mean 'sigev_value'?
__get_user(host_sevp->_sigev_un._tid, &target_sevp->_sigev_un._tid);
^~~~~~~~~
/qemu-irix/linux-user/qemu.h:501:5: note: in definition of macro '__get_user_e'
((x) = (typeof(*hptr))( \
^
/qemu-irix/linux-user/syscall.c:7422:5: note: in expansion of macro '__get_user'
__get_user(host_sevp->_sigev_un._tid, &target_sevp->_sigev_un._tid);
^~~~~~~~~~
/qemu-irix/linux-user/syscall.c:7422:36: error: '(const bitmask_transtbl *)&<erroneous-expression>' is a pointer; did you mean to use '->'?
__get_user(host_sevp->_sigev_un._tid, &target_sevp->_sigev_un._tid);
^
/qemu-irix/linux-user/qemu.h:501:5: note: in definition of macro '__get_user_e'
((x) = (typeof(*hptr))( \
^
/qemu-irix/linux-user/syscall.c:7422:5: note: in expansion of macro '__get_user'
__get_user(host_sevp->_sigev_un._tid, &target_sevp->_sigev_un._tid);
^~~~~~~~~~
/qemu-irix/linux-user/qemu.h:506:13: warning: left-hand operand of comma expression has no effect [-Wunused-value]
(hptr)), (void)0)
^
/qemu-irix/linux-user/qemu.h:510:31: note: in expansion of macro '__get_user_e'
# define __get_user(x, hptr) __get_user_e(x, hptr, be)
^~~~~~~~~~~~
/qemu-irix/linux-user/syscall.c:7422:5: note: in expansion of macro '__get_user'
__get_user(host_sevp->_sigev_un._tid, &target_sevp->_sigev_un._tid);
^~~~~~~~~~
/qemu-irix/linux-user/syscall.c: In function 'do_syscall':
/qemu-irix/linux-user/syscall.c:13545:25: warning: implicit declaration of function 'sethostid'; did you mean 'gethostid'? [-Wimplicit-function-declaration]
ret = get_errno(sethostid(arg1));
^~~~~~~~~
gethostid
/qemu-irix/linux-user/syscall.c:13545:25: warning: nested extern declaration of 'sethostid' [-Wnested-externs]
make[1]: *** [/qemu-irix/rules.mak:66: linux-user/syscall.o] Error 1
make: *** [Makefile:472: subdir-irix-linux-user] Error 2
The command '/bin/sh -c make && DESTDIR=/tmp/qemu make install' returned a non-zero code: 2
I researched about the differences between Debian's and Alpine's GCC (in fact, libc6 and musl) about similar failures, but I haven't found any information about how to solve this without modifying the code.
So, where can I find more information about this issue and which packages may solve it? Thanks.
Dockerfiles and full log here. Docker container image (Debian Buster) here.
The difference seems to be caused by the underlying libc implementations: glibc of Debian, vs musl-libc of Alpine.
While GNU libc is the defacto standard libc implementation in Linux, musl libc is used by a handful of distributions, such as Alpine Linux and Void Linux. musl is a minimalistic strict-POSIX libc implementation, and is generally not compatible with glibc. Usually, software projects have to be ported to musl libc to be supported on Alpine, especially non trivial applications.
The compilation of syscall.c breaks on several places, the first being:
/qemu-irix/linux-user/syscall.c:6784:22: error: 'F_EXLCK' undeclared here (not in a function); did you mean 'F_RDLCK'?
TRANSTBL_CONVERT(F_EXLCK)
The F_EXLCK is macro is not defined in musl libc's fcntl.h. However, it could be easily patched by defining it manually, for example with make CFLAGS='"-DF_EXLCK=4"'. This is how qemu is patched for musl for non-irix targets (patch link).
However, there are more undefined macros down the road, such as __SIGRTMIN and __SIGRTMAX, the macro TRANSTBL_CONVERT, and probably others. Patching them ad-hoc may not be enough - so it appears to be that the qemu-irix project has to be properly ported for Alpine and musl libc.
If you're willing, you could try following existing qemu musl patches, and attempt to patch it yourself for qemu-irix:
- https://lists.gnu.org/archive/html/qemu-devel/2014-04/msg04773.html
- https://github.com/NixOS/nixpkgs/pull/46449/files
Off topic comment, use make -j to build parallely, which will end much faster.

Resources