CHLone installation fails - hdf5

I am trying to install CHLone v0.49 on Ubuntu 16.04 in order to install pyCGNS. The dependencies are installed and seem to be found by scons, as the beginning of the output shows when I run scons:
scons: Reading SConscript files ...
# =================================================================
# CHLone: production setup...
# CHLone: Cython & numpy found, add CGNS/Python build
# CHLone: Configuration uses HDF5 version 1.10.0-patch1 with:
# CHLone: + thread safe HDF5
# CHLone: + includes in ['/usr/local/hdf5/include']
# CHLone: + libraries in ['/usr/local/hdf5/lib']
# CHLone: compiler is gcc
# =================================================================
# CHLone: Build v0.49
# =================================================================
scons: done reading SConscript files.
However, it then runs into problems with an output like:
scons: done reading SConscript files.
scons: Building targets ...
# CHLone: Compiling shared src/l3.c
.scons.linux2.tmp/build/src/l3.c: In function 'objlist_status':
.scons.linux2.tmp/build/src/l3.c:172:14: warning: format '%d' expects argument of type 'int', but argument 2 has type 'hid_t {aka long int}' [-Wformat=]
printf("# L3 :HDF5 ID %d ALIVE (%s:%d) {%s}\n", \
^
.scons.linux2.tmp/build/src/l3.c: In function 'HDF_Read_Array':
.scons.linux2.tmp/build/src/l3.c:680:20: warning: format '%d' expects argument of type 'int', but argument 5 has type 'hsize_t {aka long long unsigned int}' [-Wformat=]
sprintf(dims,"%s%c%d",dims,pad,int_dim_vals[n]);
^
In file included from .scons.linux2.tmp/build/src/l3P.h:6:0,
from .scons.linux2.tmp/build/src/l3.c:42:
.scons.linux2.tmp/build/src/l3.c:687:19: warning: format '%d' expects argument of type 'int', but argument 3 has type 'hid_t {aka long int}' [-Wformat=]
L3M_DBG(ctxt,("HDF_Read_Array ALLOCATE %p from %d size %s)x%d=%d %s\n",
^
.scons.linux2.tmp/build/src/include/CHLone/l3.h:777:28: note: in definition of macro 'L3M_DBG'
{printf("# L3 : +");printf msg;fflush(stdout);}}
^
.scons.linux2.tmp/build/src/l3.c:687:19: warning: format '%d' expects argument of type 'int', but argument 5 has type 'size_t {aka long unsigned int}' [-Wformat=]
L3M_DBG(ctxt,("HDF_Read_Array ALLOCATE %p from %d size %s)x%d=%d %s\n",
^
.scons.linux2.tmp/build/src/include/CHLone/l3.h:777:28: note: in definition of macro 'L3M_DBG'
{printf("# L3 : +");printf msg;fflush(stdout);}}
^
.scons.linux2.tmp/build/src/l3.c:687:19: warning: format '%d' expects argument of type 'int', but argument 6 has type 'long long unsigned int' [-Wformat=]
L3M_DBG(ctxt,("HDF_Read_Array ALLOCATE %p from %d size %s)x%d=%d %s\n",
^
.scons.linux2.tmp/build/src/include/CHLone/l3.h:777:28: note: in definition of macro 'L3M_DBG'
{printf("# L3 : +");printf msg;fflush(stdout);}}
^
.scons.linux2.tmp/build/src/l3.c:692:19: warning: format '%d' expects argument of type 'int', but argument 3 has type 'hid_t {aka long int}' [-Wformat=]
L3M_DBG(ctxt,("HDF_Read_Array NO ALLOCATE %p from %d\n",data,nid));
^
.scons.linux2.tmp/build/src/include/CHLone/l3.h:777:28: note: in definition of macro 'L3M_DBG'
{printf("# L3 : +");printf msg;fflush(stdout);}}
^
.scons.linux2.tmp/build/src/l3.c: In function 'HDF_Get_DataArray':
.scons.linux2.tmp/build/src/l3.c:779:17: warning: format '%d' expects argument of type 'int', but argument 2 has type 'hid_t {aka long int}' [-Wformat=]
L3M_DBG(ctxt,("HDF_Get_DataArray from %d/%d/%d/%d\n",
^
.scons.linux2.tmp/build/src/include/CHLone/l3.h:777:28: note: in definition of macro 'L3M_DBG'
{printf("# L3 : +");printf msg;fflush(stdout);}}
^
.scons.linux2.tmp/build/src/l3.c:779:17: warning: format '%d' expects argument of type 'int', but argument 3 has type 'hid_t {aka long int}' [-Wformat=]
L3M_DBG(ctxt,("HDF_Get_DataArray from %d/%d/%d/%d\n",
^
.scons.linux2.tmp/build/src/include/CHLone/l3.h:777:28: note: in definition of macro 'L3M_DBG'
{printf("# L3 : +");printf msg;fflush(stdout);}}
^
.scons.linux2.tmp/build/src/l3.c:779:17: warning: format '%d' expects argument of type 'int', but argument 4 has type 'hid_t {aka long int}' [-Wformat=]
L3M_DBG(ctxt,("HDF_Get_DataArray from %d/%d/%d/%d\n",
^
.scons.linux2.tmp/build/src/include/CHLone/l3.h:777:28: note: in definition of macro 'L3M_DBG'
{printf("# L3 : +");printf msg;fflush(stdout);}}
^
.scons.linux2.tmp/build/src/l3.c:779:17: warning: format '%d' expects argument of type 'int', but argument 5 has type 'hid_t {aka long int}' [-Wformat=]
L3M_DBG(ctxt,("HDF_Get_DataArray from %d/%d/%d/%d\n",
^
.scons.linux2.tmp/build/src/include/CHLone/l3.h:777:28: note: in definition of macro 'L3M_DBG'
{printf("# L3 : +");printf msg;fflush(stdout);}}
^
.scons.linux2.tmp/build/src/l3.c: In function 'L3_nodeUpdate':
.scons.linux2.tmp/build/src/l3.c:1318:21: warning: format '%d' expects argument of type 'int', but argument 2 has type 'hid_t {aka long int}' [-Wformat=]
L3M_TRACE(ctxt,("L3_nodeUpdate H5Lmove [%d:%s]%d:%s\n",pid,oldname,pid,node->name));
^
.scons.linux2.tmp/build/src/include/CHLone/l3.h:781:26: note: in definition of macro 'L3M_TRACE'
{printf("# L3 :");printf msg ;fflush(stdout);}}
^
.scons.linux2.tmp/build/src/l3.c:1318:21: warning: format '%d' expects argument of type 'int', but argument 4 has type 'hid_t {aka long int}' [-Wformat=]
L3M_TRACE(ctxt,("L3_nodeUpdate H5Lmove [%d:%s]%d:%s\n",pid,oldname,pid,node->name));
^
.scons.linux2.tmp/build/src/include/CHLone/l3.h:781:26: note: in definition of macro 'L3M_TRACE'
{printf("# L3 :");printf msg ;fflush(stdout);}}
^
.scons.linux2.tmp/build/src/l3.c: In function 'L3_nodeRetrieve':
.scons.linux2.tmp/build/src/l3.c:1604:19: warning: format '%d' expects argument of type 'int', but argument 2 has type 'hid_t {aka long int}' [-Wformat=]
L3M_TRACE(ctxt,("L3_nodeRetrieve [%d]\n",oid));
^
.scons.linux2.tmp/build/src/include/CHLone/l3.h:781:26: note: in definition of macro 'L3M_TRACE'
{printf("# L3 :");printf msg ;fflush(stdout);}}
^
.scons.linux2.tmp/build/src/l3.c: At top level:
.scons.linux2.tmp/build/src/l3.c:2045:7: error: conflicting types for 'L3_incRef'
hid_t L3_incRef(L3_Cursor_t *ctxt,hid_t id)
^
In file included from .scons.linux2.tmp/build/src/l3P.h:6:0,
from .scons.linux2.tmp/build/src/l3.c:42:
.scons.linux2.tmp/build/src/include/CHLone/l3.h:517:10: note: previous declaration of 'L3_incRef' was here
/*#*/int L3_incRef(L3_Cursor_t *ctxt,hid_t id);
^
scons: *** [.scons.linux2.tmp/build/src/l3.os] Error 1
scons: building terminated because of errors.
Can anyone help me what to do? I have no clue what the problem might be...

I had the same problem and the answer is in fact in the compiler log. It says that the return type of function L3_incRef in l3.c (int) is not consistent with the one in the header l3.h (hid_t).
After changing the return type of L3_incRef into int in l3.C, the code compiles successfully.

Related

Ubuntu Sqlite3 1.4.2 gem install error. Any ideas?

I installed libsqlite3-dev but it hasn't helped. My ruby version is 3.0.0 .And this is my error :
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /home/nurlaney/.gem/gems/sqlite3-1.4.2/ext/sqlite3
/snap/ruby/201/bin/ruby -I /snap/ruby/201/lib/ruby/3.0.0 -r ./siteconf20210129-26408-4tihlx.rb extconf.rb
checking for sqlite3.h... yes
checking for pthread_create() in -lpthread... yes
checking for -ldl... yes
checking for sqlite3_libversion_number() in -lsqlite3... yes
checking for rb_proc_arity()... no
checking for rb_integer_pack()... no
checking for sqlite3_initialize()... yes
checking for sqlite3_backup_init()... yes
checking for sqlite3_column_database_name()... yes
checking for sqlite3_enable_load_extension()... yes
checking for sqlite3_load_extension()... yes
checking for sqlite3_open_v2()... yes
checking for sqlite3_prepare_v2()... yes
checking for sqlite3_int64 in sqlite3.h... yes
checking for sqlite3_uint64 in sqlite3.h... yes
creating Makefile
current directory: /home/nurlaney/.gem/gems/sqlite3-1.4.2/ext/sqlite3
make "DESTDIR=" clean
current directory: /home/nurlaney/.gem/gems/sqlite3-1.4.2/ext/sqlite3
make "DESTDIR="
compiling aggregator.c
compiling backup.c
compiling database.c
database.c: In function ‘rb_sqlite3_open_v2’:
database.c:38:9: warning: unused variable ‘flags’ [-Wunused-variable]
38 | VALUE flags;
| ^~~~~
database.c: In function ‘exec_batch’:
database.c:726:57: warning: passing argument 3 of ‘sqlite3_exec’ from incompatible pointer type
[-Wincompatible-pointer-types]
726 | status = sqlite3_exec(ctx->db, StringValuePtr(sql), hash_callback_function, callback_ary, &errMsg);
| ^~~~~~~~~~~~~~~~~~~~~~
| |
| int (*)(VALUE, int, char **, char **) {aka int
(*)(long unsigned int, int, char **, char **)}
In file included from ./sqlite3_ruby.h:25,
from database.c:1:
/usr/include/sqlite3.h:409:9: note: expected ‘int (*)(void *, int, char **, char **)’ but argument is of type ‘int
(*)(VALUE, int, char **, char **)’ {aka ‘int (*)(long unsigned int, int, char **, char **)’}
409 | int (*callback)(void*,int,char**,char**), /* Callback function */
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
database.c:726:81: warning: passing argument 4 of ‘sqlite3_exec’ makes pointer from integer without a cast
[-Wint-conversion]
726 | status = sqlite3_exec(ctx->db, StringValuePtr(sql), hash_callback_function, callback_ary, &errMsg);
| ^~~~~~~~~~~~
| |
| VALUE {aka long unsigned int}
In file included from ./sqlite3_ruby.h:25,
from database.c:1:
/usr/include/sqlite3.h:410:3: note: expected ‘void *’ but argument is of type ‘VALUE’ {aka ‘long unsigned int’}
410 | void *, /* 1st argument to callback */
| ^~~~~~
database.c:728:57: warning: passing argument 3 of ‘sqlite3_exec’ from incompatible pointer type
[-Wincompatible-pointer-types]
728 | status = sqlite3_exec(ctx->db, StringValuePtr(sql), regular_callback_function, callback_ary, &errMsg);
| ^~~~~~~~~~~~~~~~~~~~~~~~~
| |
| int (*)(VALUE, int, char **, char **) {aka int
(*)(long unsigned int, int, char **, char **)}
In file included from ./sqlite3_ruby.h:25,
from database.c:1:
/usr/include/sqlite3.h:409:9: note: expected ‘int (*)(void *, int, char **, char **)’ but argument is of type ‘int
(*)(VALUE, int, char **, char **)’ {aka ‘int (*)(long unsigned int, int, char **, char **)’}
409 | int (*callback)(void*,int,char**,char**), /* Callback function */
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
database.c:728:84: warning: passing argument 4 of ‘sqlite3_exec’ makes pointer from integer without a cast
[-Wint-conversion]
728 | status = sqlite3_exec(ctx->db, StringValuePtr(sql), regular_callback_function, callback_ary, &errMsg);
| ^~~~~~~~~~~~
| |
| VALUE {aka long unsigned
int}
In file included from ./sqlite3_ruby.h:25,
from database.c:1:
/usr/include/sqlite3.h:410:3: note: expected ‘void *’ but argument is of type ‘VALUE’ {aka ‘long unsigned int’}
410 | void *, /* 1st argument to callback */
| ^~~~~~
database.c: At top level:
cc1: warning: unrecognized command line option ‘-Wno-self-assign’
cc1: warning: unrecognized command line option ‘-Wno-parentheses-equality’
cc1: warning: unrecognized command line option ‘-Wno-constant-logical-operand’
compiling exception.c
compiling sqlite3.c
sqlite3.c: In function ‘bignum_to_int64’:
sqlite3.c:33:27: warning: implicit declaration of function ‘RBIGNUM’; did you mean ‘T_BIGNUM’?
[-Wimplicit-function-declaration]
33 | # define RBIGNUM_LEN(x) RBIGNUM(x)->len
| ^~~~~~~
sqlite3.c:35:20: note: in expansion of macro ‘RBIGNUM_LEN’
35 | const long len = RBIGNUM_LEN(value);
| ^~~~~~~~~~~
sqlite3.c:33:37: error: invalid type argument of ‘->’ (have ‘int’)
33 | # define RBIGNUM_LEN(x) RBIGNUM(x)->len
| ^~
sqlite3.c:35:20: note: in expansion of macro ‘RBIGNUM_LEN’
35 | const long len = RBIGNUM_LEN(value);
| ^~~~~~~~~~~
sqlite3.c:40:19: error: ‘SIZEOF_BDIGITS’ undeclared (first use in this function); did you mean ‘SIZEOF_INT’?
40 | if (len > 63 / (SIZEOF_BDIGITS * CHAR_BIT) + 1) return 0;
| ^~~~~~~~~~~~~~
| SIZEOF_INT
sqlite3.c:40:19: note: each undeclared identifier is reported only once for each function it appears in
sqlite3.c:42:11: error: unknown type name ‘BDIGIT’
42 | const BDIGIT *digits = RBIGNUM_DIGITS(value);
| ^~~~~~
sqlite3.c:42:28: warning: implicit declaration of function ‘RBIGNUM_DIGITS’; did you mean ‘RBIGNUM_SIGN’?
[-Wimplicit-function-declaration]
42 | const BDIGIT *digits = RBIGNUM_DIGITS(value);
| ^~~~~~~~~~~~~~
| RBIGNUM_SIGN
sqlite3.c:42:28: warning: initialization of ‘const int *’ from ‘int’ makes pointer from integer without a cast
[-Wint-conversion]
sqlite3.c:43:5: error: unknown type name ‘BDIGIT’; did you mean ‘ISDIGIT’?
43 | BDIGIT blast = digits[len-1];
| ^~~~~~
| ISDIGIT
sqlite3.c:44:5: error: unknown type name ‘BDIGIT’; did you mean ‘ISDIGIT’?
44 | BDIGIT bmax = (BDIGIT)1UL << (63 % (CHAR_BIT * SIZEOF_BDIGITS));
| ^~~~~~
| ISDIGIT
sqlite3.c:44:20: error: ‘BDIGIT’ undeclared (first use in this function); did you mean ‘ISDIGIT’?
44 | BDIGIT bmax = (BDIGIT)1UL << (63 % (CHAR_BIT * SIZEOF_BDIGITS));
| ^~~~~~
| ISDIGIT
sqlite3.c:44:27: error: expected ‘,’ or ‘;’ before numeric constant
44 | BDIGIT bmax = (BDIGIT)1UL << (63 % (CHAR_BIT * SIZEOF_BDIGITS));
| ^~~
sqlite3.c: At top level:
cc1: warning: unrecognized command line option ‘-Wno-self-assign’
cc1: warning: unrecognized command line option ‘-Wno-parentheses-equality’
cc1: warning: unrecognized command line option ‘-Wno-constant-logical-operand’
make: *** [Makefile:245: sqlite3.o] Error 1
make failed, exit code 2
Gem files will remain installed in /home/nurlaney/.gem/gems/sqlite3-1.4.2 for inspection.
Results logged to /home/nurlaney/.gem/extensions/x86_64-linux/3.0.0/sqlite3-1.4.2/gem_make.out
An error occurred while installing sqlite3 (1.4.2), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.4.2' --source 'http://rubygems.org/'` succeeds before bundling.
In Gemfile:
sqlite3
I looked at other topics and none of them helped. Should i install DevKit like in Windows ? And if this can install, how is it ?
I installed ruby from snap channel.
I tried install sqlite3 gem but it returns me same error again. Then i tried to install gem locally but it doesnt help again. So im stuck. I don't know how to fix. Any ideas ?
Please check following simple steps for install sqlite3 in Ubuntu 20.04
sudo apt update
sudo apt install sqlite3
sqlite3 --version
If above comment not working for your machine, you can directly download the .deb file here and install https://ubuntu.pkgs.org/20.04/ubuntu-main-amd64/libsqlite3-dev_3.31.1-4_amd64.deb.html
Install sqlite3 Gem
sudo apt-get install sqlite3 libsqlite3-dev
sudo gem install sqlite3-ruby
Let me if you need any help thanks :)

Ruby gem 'byebug 5.0.0' failing on install due to make error

I'm attempting to install the byebug gem v5.0.0 in a ubuntu environment.
The v 5.0.0 is a project requirement, I can not use a newer version.
These are the current versions that I am using
bundle -v
Bundler version 2.1.4
ruby -v
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux-gnu]
bundle -v
Bundler version 2.1.4
rvm -v
rvm 1.29.10 (manual) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]
rails -v
Rails 5.2.3
When I attempt to install with gem install byebug -v 5.0.0 the following is written to cli.
The install appears to be failing when executing the make file for the gem
Even if i attempt to execute make in the /var/lib/gems/2.7.0/gems/byebug-5.0.0/ext/byebug directory, I get the same error message starting with the context.c file.
This seems to be some install issue with the 5.0.0 version, I did attempt to install the newest version of byebug for testing, and it installed successfully.
current directory: /var/lib/gems/2.7.0/gems/byebug-5.0.0/ext/byebug
/usr/bin/ruby2.7 -I /usr/lib/ruby/2.7.0 -r ./siteconf20201011-7796-1qpm603.rb extconf.rb
creating Makefile
current directory: /var/lib/gems/2.7.0/gems/byebug-5.0.0/ext/byebug
make "DESTDIR=" clean
current directory: /var/lib/gems/2.7.0/gems/byebug-5.0.0/ext/byebug
make "DESTDIR="
compiling breakpoint.c
compiling byebug.c
compiling context.c
context.c: In function ‘call_with_debug_inspector’:
context.c:191:20: error: passing argument 1 of ‘rb_ensure’ from incompatible pointer type [-Werror=incompatible-pointer-types]
191 | return rb_ensure(open_debug_inspector, (VALUE) data, close_debug_inspector,
| ^~~~~~~~~~~~~~~~~~~~
| |
| VALUE (*)(struct call_with_inspection_data *) {aka long unsigned int (*)(struct call_with_inspection_data *)}
In file included from /usr/include/ruby-2.7.0/ruby.h:33,
from ./byebug.h:4,
from context.c:1:
/usr/include/ruby-2.7.0/ruby/ruby.h:1990:17: note: expected ‘VALUE (*)(VALUE)’ {aka ‘long unsigned int (*)(long unsigned int)’} but argument is of type ‘VALUE (*)(struct call_with_inspection_data *)’ {aka ‘long unsigned int (*)(struct call_with_inspection_data *)’}
1990 | VALUE rb_ensure(VALUE(*)(VALUE),VALUE,VALUE(*)(VALUE),VALUE);
| ^~~~~~~~~~~~~~~
context.c:191:56: error: passing argument 3 of ‘rb_ensure’ from incompatible pointer type [-Werror=incompatible-pointer-types]
191 | return rb_ensure(open_debug_inspector, (VALUE) data, close_debug_inspector,
| ^~~~~~~~~~~~~~~~~~~~~
| |
| VALUE (*)(struct call_with_inspection_data *) {aka long unsigned int (*)(struct call_with_inspection_data *)}
In file included from /usr/include/ruby-2.7.0/ruby.h:33,
from ./byebug.h:4,
from context.c:1:
/usr/include/ruby-2.7.0/ruby/ruby.h:1990:39: note: expected ‘VALUE (*)(VALUE)’ {aka ‘long unsigned int (*)(long unsigned int)’} but argument is of type ‘VALUE (*)(struct call_with_inspection_data *)’ {aka ‘long unsigned int (*)(struct call_with_inspection_data *)’}
1990 | VALUE rb_ensure(VALUE(*)(VALUE),VALUE,VALUE(*)(VALUE),VALUE);
| ^~~~~~~~~~~~~~~
In file included from /usr/include/ruby-2.7.0/ruby/ruby.h:2148,
from /usr/include/ruby-2.7.0/ruby.h:33,
from ./byebug.h:4,
from context.c:1:
context.c: In function ‘Init_context’:
/usr/include/ruby-2.7.0/ruby/intern.h:1218:137: error: passing argument 3 of ‘rb_define_singleton_method1’ from incompatible pointer type [-Werror=incompatible-pointer-types]
1218 | #define rb_define_singleton_method(klass, mid, func, arity) rb_define_singleton_method_choose_prototypem3((arity),(func))((klass),(mid),(func),(arity));
| ^~~~~~
| |
| VALUE (*)(VALUE) {aka long unsigned int (*)(long unsigned int)}
context.c:673:3: note: in expansion of macro ‘rb_define_singleton_method’
673 | rb_define_singleton_method(cDebugThread, "inherited", dt_inherited, 1);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/ruby-2.7.0/ruby/intern.h:1195:27: note: expected ‘VALUE (*)(VALUE, VALUE)’ {aka ‘long unsigned int (*)(long unsigned int, long unsigned int)’} but argument is of type ‘VALUE (*)(VALUE)’ {aka ‘long unsigned int (*)(long unsigned int)’}
1195 | RB_METHOD_DEFINITION_DECL(rb_define_singleton_method, (2,3), (VALUE klass, const char *name), (klass, name))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/ruby-2.7.0/ruby/intern.h:1042:82: note: in definition of macro ‘RB_METHOD_DEFINITION_DECL_C’
1042 | __attribute__((__unused__,__weakref__(#def),__nonnull__ nonnull))static void defname(RB_UNWRAP_MACRO decl,VALUE(*func)funcargs,int arity);
| ^~~~~~~
/usr/include/ruby-2.7.0/ruby/intern.h:1075:1: note: in expansion of macro ‘RB_METHOD_DEFINITION_DECL_1’
1075 | RB_METHOD_DEFINITION_DECL_1(def,nonnull,def##1 ,1 ,decl,vars,(VALUE,VALUE)) \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/ruby-2.7.0/ruby/intern.h:1195:1: note: in expansion of macro ‘RB_METHOD_DEFINITION_DECL’
1195 | RB_METHOD_DEFINITION_DECL(rb_define_singleton_method, (2,3), (VALUE klass, const char *name), (klass, name))
| ^~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make: *** [Makefile:245: context.o] Error 1
make failed, exit code 2
That version of byebug is from 2015 when ruby was on v2.2.1
If you can’t use a newer bye bug; use the older ruby.
That older version of ruby is probably going to require you to use older versions of all the gems your project needs. Do you have a Gemfile.lock showing the target versions? If not you might have to use ruby gems to find what version each gen was the latest in early 2015.
https://rubygems.org/gems/byebug/versions Shows the version released dates for byebug.

mysql2 Ruby Gem failed to install ubuntu 20.04

Does anyone know what causes this and how I can fix it? I am trying to install a ruby gem for my project which is an old project running on rails 3, but I'm running on ubuntu 20.04. All I am doing is essentially running bundle install and then I get everything else working except this ruby gem. Please advise!
current directory: /home/decil/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/mysql2-0.3.21/ext/mysql2
make "DESTDIR=" clean
current directory: /home/decil/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/mysql2-0.3.21/ext/mysql2
make "DESTDIR="
compiling client.c
client.c: In function ‘nogvl_read_query_result’:
client.c:439:3: error: unknown type name ‘my_bool’; did you mean ‘bool’?
439 | my_bool res = mysql_read_query_result(client);
| ^~~~~~~
| bool
client.c: In function ‘rb_query’:
client.c:687:14: warning: passing argument 1 of ‘rb_rescue2’ from incompatible pointer type [-Wincompatible-pointer-types]
687 | rb_rescue2(do_send_query, (VALUE)&args, disconnect_and_raise, self, rb_eException, (VALUE)0);
| ^~~~~~~~~~~~~
| |
| VALUE (*)(void *) {aka long unsigned int (*)(void *)}
In file included from /home/decil/.rbenv/versions/2.7.1/include/ruby-2.7.0/ruby.h:33,
from ./mysql2_ext.h:8,
from client.c:1:
/home/decil/.rbenv/versions/2.7.1/include/ruby-2.7.0/ruby/ruby.h:1988:18: note: expected ‘VALUE (*)(VALUE)’ {aka ‘long unsigned int (*)(long unsigned int)’} but argument is of type ‘VALUE (*)(void *)’ {aka ‘long unsigned int (*)(void *)’}
1988 | VALUE rb_rescue2(VALUE(*)(VALUE),VALUE,VALUE(*)(VALUE,VALUE),VALUE,...);
| ^~~~~~~~~~~~~~~
client.c:695:16: warning: passing argument 1 of ‘rb_rescue2’ from incompatible pointer type [-Wincompatible-pointer-types]
695 | rb_rescue2(do_query, (VALUE)&async_args, disconnect_and_raise, self, rb_eException, (VALUE)0);
| ^~~~~~~~
| |
| VALUE (*)(void *) {aka long unsigned int (*)(void *)}
In file included from /home/decil/.rbenv/versions/2.7.1/include/ruby-2.7.0/ruby.h:33,
from ./mysql2_ext.h:8,
from client.c:1:
/home/decil/.rbenv/versions/2.7.1/include/ruby-2.7.0/ruby/ruby.h:1988:18: note: expected ‘VALUE (*)(VALUE)’ {aka ‘long unsigned int (*)(long unsigned int)’} but argument is of type ‘VALUE (*)(void *)’ {aka ‘long unsigned int (*)(void *)’}
1988 | VALUE rb_rescue2(VALUE(*)(VALUE),VALUE,VALUE(*)(VALUE,VALUE),VALUE,...);
| ^~~~~~~~~~~~~~~
client.c: In function ‘_mysql_client_options’:
client.c:762:3: error: unknown type name ‘my_bool’; did you mean ‘bool’?
762 | my_bool boolval;
| ^~~~~~~
| bool
client.c:797:10: error: ‘MYSQL_SECURE_AUTH’ undeclared (first use in this function); did you mean ‘MYSQL_DEFAULT_AUTH’?
797 | case MYSQL_SECURE_AUTH:
| ^~~~~~~~~~~~~~~~~
| MYSQL_DEFAULT_AUTH
client.c:797:10: note: each undeclared identifier is reported only once for each function it appears in
client.c: In function ‘set_secure_auth’:
client.c:1185:38: error: ‘MYSQL_SECURE_AUTH’ undeclared (first use in this function); did you mean ‘MYSQL_DEFAULT_AUTH’?
1185 | return _mysql_client_options(self, MYSQL_SECURE_AUTH, value);
| ^~~~~~~~~~~~~~~~~
| MYSQL_DEFAULT_AUTH
client.c:1186:1: warning: control reaches end of non-void function [-Wreturn-type]
1186 | }
| ^
client.c: At top level:
cc1: warning: unrecognized command line option ‘-Wno-self-assign’
cc1: warning: unrecognized command line option ‘-Wno-parentheses-equality’
cc1: warning: unrecognized command line option ‘-Wno-constant-logical-operand’
make: *** [Makefile:245: client.o] Error 1
I had a similar issue with version 0.4.5, It worked fine for me with version 0.4.10
Try with the below on your Gemfile:
gem 'mysql2', '0.4.10'
The latest version of the mysql2 gem compatible with Rails 3 is v0.3.21 (source).
mysql2 gem v0.3.21 depends on the my_bool datatype in MySQL itself.
MySQL 5.7 has the my_bool datatype but it was removed in MySQL 8.0 (source).
Ubuntu 20.04 does not have MySQL 5.7, only 8.0+ (source).
Therefore you need to install MySQL 5.7 from MySQL's own apt repositories and stop your server from installing any MySQL stuff from Ubuntu's apt repositories.
I just did all this and successfully got a Rails 3.2 app running on Ubuntu 20.04 LTS.
(Also, Rails 3.2.x is only compatible with Ruby <= 2.3.x.)
my env:ruby2.3,rails3,ubuntu20 server
first of all uninstall mysql5.8, and install mysql5.7
you can see this
enter link description here
but the most important is that make sure the libmysqlclient-dev's version before you install gem mysql2'0.3.11' .
the default libmysqlclient-dev's version is 8.0
i download the
libmysqlclient20_5.7.35-1ubuntu18.04_amd64.deb
libmysqlclient-dev_5.7.35-1ubuntu18.04_amd64.deb
and install them sudo dpkg -i them
that ok

MOXA Nport 5110A Driver Failed Installation (On Linux Ubuntu 14.04)

I am trying to install MOXA Nport 5110A Driver in my Linux Ubuntu 14.04, but failed miserably. The details about installation process is too long for me to understand where the problem is (and frankly I am still a noob in Linux world). The details is listed below.
===============================================================================
Copyright (C) 2002-2012 Moxa Inc.
All Rights Reserved.
MOXA NPort Server Real TTY Driver V1.18 Installation.
System Imformation: Kernel 3.13.0-62-generic; Machine x86_64.
===============================================================================
Tar files, please wait ... OK!
Building driver...
If you want to use secure communication with target,
you might choose [y] to enable the SSL function.
Note: This function support RealCOM with secure mode only.
Do you want to enable secure function? [y/N].
N
make -C /lib/modules/3.13.0-62-generic/build SUBDIRS=/tmp/moxa modules
make[1]: Entering directory `/usr/src/linux-headers-3.13.0-62-generic'
CC [M] /tmp/moxa/npreal2.o
/tmp/moxa/npreal2.c: In function ‘npreal_init_tty’:
/tmp/moxa/npreal2.c:661:11: error: dereferencing pointer to incomplete type
de->data = (void *) net_node;
^
/tmp/moxa/npreal2.c:663:11: error: dereferencing pointer to incomplete type
de->proc_fops = &npreal_net_fops;
^
In file included from /tmp/moxa/npreal2.c:92:0:
/tmp/moxa/npreal2.c: In function ‘npreal_init’:
/tmp/moxa/npreal2.h:28:35: error: ‘struct tty_driver’ has no member named ‘termios_locked’
#define DRV_VAR_P(x) npvar_sdriver->x
^
/tmp/moxa/npreal2.c:779:5: note: in expansion of macro ‘DRV_VAR_P’
DRV_VAR_P(termios_locked) = npvar_termios_locked;
^
/tmp/moxa/npreal2.c: In function ‘npreal_open’:
/tmp/moxa/npreal2.c:1064:13: error: invalid type argument of unary ‘*’ (have ‘struct ktermios’)
*tty->termios = info->normal_termios;
^
/tmp/moxa/npreal2.c:1066:13: error: invalid type argument of unary ‘*’ (have ‘struct ktermios’)
*tty->termios = info->callout_termios;
^
/tmp/moxa/npreal2.c:1080:8: error: ‘struct tty_struct’ has no member named ‘low_latency’
tty->low_latency = 1;
^
/tmp/moxa/npreal2.c: In function ‘npreal_close’:
/tmp/moxa/npreal2.c:1170:32: error: invalid type argument of unary ‘*’ (have ‘struct ktermios’)
info->normal_termios = *tty->termios;
^
/tmp/moxa/npreal2.c:1172:33: error: invalid type argument of unary ‘*’ (have ‘struct ktermios’)
info->callout_termios = *tty->termios;
^
/tmp/moxa/npreal2.c: In function ‘npreal_ioctl’:
/tmp/moxa/npreal2.c:1612:21: error: invalid type argument of ‘->’ (have ‘struct ktermios’)
tty->termios->c_cflag = ((tty->termios->c_cflag & ~CLOCAL) |
^
/tmp/moxa/npreal2.c:1612:47: error: invalid type argument of ‘->’ (have ‘struct ktermios’)
tty->termios->c_cflag = ((tty->termios->c_cflag & ~CLOCAL) |
^
/tmp/moxa/npreal2.c: In function ‘npreal_block_til_ready’:
/tmp/moxa/npreal2.c:1962:26: error: invalid type argument of ‘->’ (have ‘struct ktermios’)
if ( tty->termios->c_cflag & CLOCAL )
^
/tmp/moxa/npreal2.c: In function ‘npreal_startup’:
/tmp/moxa/npreal2.c:2155:27: error: invalid type argument of ‘->’ (have ‘struct ktermios’)
if (info->tty->termios->c_cflag & CBAUD)
^
/tmp/moxa/npreal2.c: In function ‘npreal_shutdown’:
/tmp/moxa/npreal2.c:2278:42: error: invalid type argument of ‘->’ (have ‘struct ktermios’)
if (!info->tty || (info->tty->termios->c_cflag & HUPCL))
^
/tmp/moxa/npreal2.c: In function ‘npreal_port_init’:
/tmp/moxa/npreal2.c:2325:18: error: incompatible types when assigning to type ‘struct ktermios *’ from type ‘struct ktermios’
if (!(termio = info->tty->termios))
^
/tmp/moxa/npreal2.c: In function ‘npreal_port_shutdown’:
/tmp/moxa/npreal2.c:2700:18: error: incompatible types when assigning to type ‘struct ktermios *’ from type ‘struct ktermios’
if (!(termio = info->tty->termios))
^
/tmp/moxa/npreal2.c: In function ‘tty_buffer_free’:
/tmp/moxa/npreal2.c:3352:9: error: implicit declaration of function ‘kfree’ [-Werror=implicit-function-declaration]
kfree(b);
^
/tmp/moxa/npreal2.c:3355:22: error: ‘struct tty_struct’ has no member named ‘buf’
b->next = tty->buf.free;
^
/tmp/moxa/npreal2.c:3356:12: error: ‘struct tty_struct’ has no member named ‘buf’
tty->buf.free = b;
^
In file included from include/linux/seqlock.h:35:0,
from include/linux/time.h:5,
from include/linux/stat.h:18,
from include/linux/module.h:10,
from /tmp/moxa/npreal2.c:42:
/tmp/moxa/npreal2.c: In function ‘npreal_flush_to_ldisc’:
/tmp/moxa/npreal2.c:3424:31: error: ‘struct tty_struct’ has no member named ‘buf’
spin_lock_irqsave(&tty->buf.lock, flags);
^
include/linux/spinlock.h:199:34: note: in definition of macro ‘raw_spin_lock_irqsave’
flags = _raw_spin_lock_irqsave(lock); \
^
/tmp/moxa/npreal2.c:3424:9: note: in expansion of macro ‘spin_lock_irqsave’
spin_lock_irqsave(&tty->buf.lock, flags);
^
/tmp/moxa/npreal2.c:3425:19: error: ‘struct tty_struct’ has no member named ‘buf’
head = tty->buf.head;
^
/tmp/moxa/npreal2.c:3428:16: error: ‘struct tty_struct’ has no member named ‘buf’
tty->buf.head = NULL;
^
/tmp/moxa/npreal2.c:3452:26: error: ‘struct tty_buffer’ has no member named ‘char_buf_ptr’
cp = head->char_buf_ptr + head->read;
^
/tmp/moxa/npreal2.c:3453:26: error: ‘struct tty_buffer’ has no member named ‘flag_buf_ptr’
fp = head->flag_buf_ptr + head->read;
^
/tmp/moxa/npreal2.c:3455:44: error: ‘struct tty_struct’ has no member named ‘buf’
spin_unlock_irqrestore(&tty->buf.lock, flags);
^
In file included from include/linux/seqlock.h:35:0,
from include/linux/time.h:5,
from include/linux/stat.h:18,
from include/linux/module.h:10,
from /tmp/moxa/npreal2.c:42:
/tmp/moxa/npreal2.c:3461:39: error: ‘struct tty_struct’ has no member named ‘buf’
spin_lock_irqsave(&tty->buf.lock, flags);
^
include/linux/spinlock.h:199:34: note: in definition of macro ‘raw_spin_lock_irqsave’
flags = _raw_spin_lock_irqsave(lock); \
^
/tmp/moxa/npreal2.c:3461:17: note: in expansion of macro ‘spin_lock_irqsave’
spin_lock_irqsave(&tty->buf.lock, flags);
^
/tmp/moxa/npreal2.c:3463:16: error: ‘struct tty_struct’ has no member named ‘buf’
tty->buf.head = head;
^
/tmp/moxa/npreal2.c:3465:36: error: ‘struct tty_struct’ has no member named ‘buf’
spin_unlock_irqrestore(&tty->buf.lock, flags);
^
/tmp/moxa/npreal2.c: In function ‘npreal_create_proc_entry’:
/tmp/moxa/npreal2.c:3546:5: error: implicit declaration of function ‘create_proc_entry’ [-Werror=implicit-function-declaration]
return( create_proc_entry( name, mode, parent ) );
^
/tmp/moxa/npreal2.c:3546:5: warning: return makes pointer from integer without a cast [enabled by default]
/tmp/moxa/npreal2.c: In function ‘npreal_remove_proc_entry’:
/tmp/moxa/npreal2.c:3554:26: error: dereferencing pointer to incomplete type
remove_proc_entry(pde->name, pde->parent);
^
/tmp/moxa/npreal2.c:3554:37: error: dereferencing pointer to incomplete type
remove_proc_entry(pde->name, pde->parent);
^
/tmp/moxa/npreal2.c: In function ‘npreal_net_open’:
/tmp/moxa/npreal2.c:3606:5: error: implicit declaration of function ‘PDE’ [-Werror=implicit-function-declaration]
de = PDE(inode);
^
/tmp/moxa/npreal2.c:3606:8: warning: assignment makes pointer from integer without a cast [enabled by default]
de = PDE(inode);
^
/tmp/moxa/npreal2.c:3615:32: error: dereferencing pointer to incomplete type
nd = (struct nd_struct *)de->data;
^
/tmp/moxa/npreal2.c: In function ‘npreal_net_write’:
/tmp/moxa/npreal2.c:4255:18: error: ‘struct tty_struct’ has no member named ‘low_latency’
if(!info->tty->low_latency)
^
/tmp/moxa/npreal2.c:4283:5: warning: passing argument 1 of ‘tty_buffer_request_room’ from incompatible pointer type [enabled by default]
if ((cnt = tty_buffer_request_room(tty, count)) <= 0)
^
In file included from /tmp/moxa/npreal2.c:57:0:
include/linux/tty_flip.h:5:12: note: expected ‘struct tty_port *’ but argument is of type ‘struct tty_struct *’
extern int tty_buffer_request_room(struct tty_port *port, size_t size);
^
/tmp/moxa/npreal2.c:4296:17: error: ‘struct tty_struct’ has no member named ‘icanon’
if (!tty->icanon || tty->canon_data)
^
/tmp/moxa/npreal2.c:4296:32: error: ‘struct tty_struct’ has no member named ‘canon_data’
if (!tty->icanon || tty->canon_data)
^
/tmp/moxa/npreal2.c:4311:13: error: ‘struct tty_struct’ has no member named ‘icanon’
if (!tty->icanon || tty->canon_data)
^
/tmp/moxa/npreal2.c:4311:28: error: ‘struct tty_struct’ has no member named ‘canon_data’
if (!tty->icanon || tty->canon_data)
^
/tmp/moxa/npreal2.c:4313:52: error: ‘struct tty_struct’ has no member named ‘read_cnt’
if ((cnt = MIN(cnt,(N_TTY_BUF_SIZE-1) - tty->read_cnt )) <= 0)
^
/tmp/moxa/npreal2.c:117:26: note: in definition of macro ‘MIN’
#define MIN(a,b) ((a) < (b) ? (a) : (b))
^
/tmp/moxa/npreal2.c:4313:52: error: ‘struct tty_struct’ has no member named ‘read_cnt’
if ((cnt = MIN(cnt,(N_TTY_BUF_SIZE-1) - tty->read_cnt )) <= 0)
^
/tmp/moxa/npreal2.c:117:38: note: in definition of macro ‘MIN’
#define MIN(a,b) ((a) < (b) ? (a) : (b))
^
/tmp/moxa/npreal2.c:4347:5: warning: passing argument 1 of ‘tty_insert_flip_string’ from incompatible pointer type [enabled by default]
if ((count = tty_insert_flip_string(tty, (unsigned char *)buf, cnt)))
^
In file included from /tmp/moxa/npreal2.c:57:0:
include/linux/tty_flip.h:29:19: note: expected ‘struct tty_port *’ but argument is of type ‘struct tty_struct *’
static inline int tty_insert_flip_string(struct tty_port *port,
^
/tmp/moxa/npreal2.c:4349:9: warning: passing argument 1 of ‘tty_flip_buffer_push’ from incompatible pointer type [enabled by default]
tty_flip_buffer_push(tty);
^
In file included from /tmp/moxa/npreal2.c:57:0:
include/linux/tty_flip.h:14:13: note: expected ‘struct tty_port *’ but argument is of type ‘struct tty_struct *’
extern void tty_flip_buffer_push(struct tty_port *port);
^
/tmp/moxa/npreal2.c: In function ‘npreal_process_notify’:
/tmp/moxa/npreal2.c:4516:16: error: ‘struct tty_struct’ has no member named ‘low_latency’
if(!tty->low_latency)
^
/tmp/moxa/npreal2.c:4522:9: warning: passing argument 1 of ‘tty_insert_flip_char’ from incompatible pointer type [enabled by default]
tty_insert_flip_char(tty, 0, TTY_BREAK);
^
In file included from /tmp/moxa/npreal2.c:57:0:
include/linux/tty_flip.h:17:19: note: expected ‘struct tty_port *’ but argument is of type ‘struct tty_struct *’
static inline int tty_insert_flip_char(struct tty_port *port,
^
/tmp/moxa/npreal2.c: In function ‘npreal_do_session_recovery’:
/tmp/moxa/npreal2.c:4571:22: error: incompatible types when assigning to type ‘struct ktermios *’ from type ‘struct ktermios’
if (!(termio = info->tty->termios))
^
cc1: some warnings being treated as errors
make[2]: *** [/tmp/moxa/npreal2.o] Error 1
make[1]: *** [_module_/tmp/moxa] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-3.13.0-62-generic'
make: *** [module] Error 2
Check Driver...
FAILED !!!
Install Not Completed !
Can you help me finding out where is the problem?
I attach the link to download the driver files here:
NPort Real TTY Driver for Linux
I had the same problem and got in contact with MOXA. They managed to redirect me to the distributor (systerra in Germany). They (systerra) sent to me the driver version 1.18.51_build_15051816 which worked just fine. I asked MOXA to upload this version to their website as well, don't know if they managed so far.
To help anyone else with this problem, you need a MUCH later driver. As of Oct 2015 the latest driver is available from this link (Linux) moxa support forum link
Please remind Moxa tech support that it looks REALLY bad that the product they are selling has a 4 year old driver, not updated on their site!

clang can't parse my .h file standalone

I'm using python binding of libclang but I think this problem is caused by libclang not by python binding.
I have a header object.h
#ifndef OBJECT_H
#define OBJECT_H
class Object {
public:
int run();
};
#endif
And a implementation object.cpp
#include "object.h"
int Object::run() {
int a = 0;
return a*a;
}
If I visit AST of the translation unit of object.h, the last AST node is VAR_DECL class Object and that's it. It won't visit public:... part. If I use clang to check syntax directly is would complain about my header file is wrong.
$ clang -Xclang -ast-dump -fsyntax-only object/object.h
object/object.h:4:1: error: unknown type name 'class'
class Object {
^
object/object.h:4:13: error: expected ';' after top level declarator
class Object {
^
;
TranslationUnitDecl 0x7f816102d2d0 <<invalid sloc>>
|-TypedefDecl 0x7f816102d7d0 <<invalid sloc>> __int128_t '__int128'
|-TypedefDecl 0x7f816102d830 <<invalid sloc>> __uint128_t 'unsigned __int128'
|-TypedefDecl 0x7f816102db80 <<invalid sloc>> __builtin_va_list '__va_list_tag [1]'
`-VarDecl 0x7f816102dbf0 <object/object.h:4:1, col:7> Object 'int' invalid
2 errors generated.
If I use clang to dump ast of object.cpp, I won't have that error.
$ clang -Xclang -ast-dump -fsyntax-only object/object.cpp
TranslationUnitDecl 0x7fc6230302d0 <<invalid sloc>>
|-TypedefDecl 0x7fc623030810 <<invalid sloc>> __int128_t '__int128'
|-TypedefDecl 0x7fc623030870 <<invalid sloc>> __uint128_t 'unsigned __int128'
|-TypedefDecl 0x7fc623030c30 <<invalid sloc>> __builtin_va_list '__va_list_tag [1]'
|-CXXRecordDecl 0x7fc623030c80 <object/object.h:4:1, line:7:1> class Object definition
| |-CXXRecordDecl 0x7fc623030d90 <line:4:1, col:7> class Object
| |-AccessSpecDecl 0x7fc623030e20 <line:5:1, col:7> public
| `-CXXMethodDecl 0x7fc623030ea0 <line:6:3, col:11> run 'int (void)'
`-CXXMethodDecl 0x7fc62307be10 parent 0x7fc623030c80 prev 0x7fc623030ea0 <object/object.cpp:3:1, line:6:1> run 'int (void)'
`-CompoundStmt 0x7fc62307c058 <line:3:19, line:6:1>
|-DeclStmt 0x7fc62307bf78 <line:4:3, col:12>
| `-VarDecl 0x7fc62307bf00 <col:3, col:11> a 'int'
| `-IntegerLiteral 0x7fc62307bf58 <col:11> 'int' 0
`-ReturnStmt 0x7fc62307c038 <line:5:3, col:12>
`-BinaryOperator 0x7fc62307c010 <col:10, col:12> 'int' '*'
|-ImplicitCastExpr 0x7fc62307bfe0 <col:10> 'int' <LValueToRValue>
| `-DeclRefExpr 0x7fc62307bf90 <col:10> 'int' lvalue Var 0x7fc62307bf00 'a' 'int'
`-ImplicitCastExpr 0x7fc62307bff8 <col:12> 'int' <LValueToRValue>
`-DeclRefExpr 0x7fc62307bfb8 <col:12> 'int' lvalue Var 0x7fc62307bf00 'a' 'int'
It seems like clang combine object.h object.cpp together then do the parsing.
If that's so, how do I get the ast node of Object in thrid line of object.cpp int Object::run() {? Is there a ast node for that?
It also confuses me a lot like when I visit the run() method in object.cpp, it will say current location is in object.cpp but the extent is in object.h. What does the extent mean exactly? Any easier tutorial documents other than libclang API document?
Clang doesn't know that you have C++ code in your .h file. By default, it treats a .h file as plain C. When you run clang on your .cpp file, it knows that it's parsing C++.
There are two ways to fix this.
Tell clang what language is in the file using the -x flag:
clang -x c++ -Xclang -ast-dump -fsyntax-only object/object.h
Rename your file to use a .hh or .hpp suffix. These suffixes tell clang to assume the file contains C++ code.
mv object/object.h object/object.hpp
clang -Xclang -ast-dump -fsyntax-only object/object.hpp
If you rename your header file, you'll need to change your #include statement to match.

Resources