Subject: Bug report about megatools
From: Reinier Quevedo batista
Date: Sun, 7 May 2023 01:53:12 -0400
Hi friend,

Im trying to build megatools-1.11.1.20230212.tar.gz in Alpine Linux but 
im getting this error:

[1/17] Compiling C object 'megatools@exe/tools_shell.c.o'
[2/17] Compiling C object 'megatools@exe/tools_copy.c.o'
[3/17] Compiling C object 'megatools@exe/tools_rm.c.o'
[4/17] Compiling C object 'megatools@exe/tools_reg.c.o'
[5/17] Compiling C object 'megatools@exe/tools_put.c.o'
[6/17] Compiling C object 'megatools@exe/tools_mkdir.c.o'
[7/17] Compiling C object 'megatools@exe/tools_export.c.o'
[8/17] Compiling C object 'megatools@exe/tools_test.c.o'
[9/17] Compiling C object 'megatools@exe/tools_ls.c.o'
[10/17] Compiling C object 'megatools@exe/tools_get.c.o'
[11/17] Compiling C object 'megatools@exe/tools_dl.c.o'
[12/17] Compiling C object 'megatools@exe/tools_df.c.o'
[13/17] Compiling C object 'megatools@exe/lib_tools.c.o'
[14/17] Compiling C object 'megatools@exe/lib_mega.c.o'
[15/17] Compiling C object 'megatools@exe/lib_http.c.o'
[16/17] Compiling C object 'megatools@exe/lib_sjson.gen.c.o'
ninja: job failed: cc -Imegatools@exe -I. -I.. -I../lib -I../tools 
-I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include 
-I/usr/include/libmount -I/usr/include/blkid -fdiagnostics-color=always 
-pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=gnu99 -g 
-Wno-unused -Wno-pointer-sign -pthread -MD -MQ 
'megatools@exe/lib_http.c.o' -MF 'megatools@exe/lib_http.c.o.d' -o 
'megatools@exe/lib_http.c.o' -c ../lib/http.c
In file included from /usr/include/curl/curl.h:3054,
                  from ../lib/http.c:23:
../lib/http.c: In function 'http_new':
../lib/http.c:148:28: error: 'CURLOPT_PROTOCOLS_STR' undeclared (first 
use in this function); did you mean 'CURLOPT_PROTOCOLS'?
   148 |  curl_easy_setopt(h->curl, CURLOPT_PROTOCOLS_STR, "http,https");
       |                            ^~~~~~~~~~~~~~~~~~~~~
../lib/http.c:148:28: note: each undeclared identifier is reported only 
once for each function it appears in
../lib/mega.c: In function 'make_random_key':
../lib/mega.c:854:9: warning: implicit declaration of function 
'g_memdup2'; did you mean 'g_memdup'? [-Wimplicit-function-declaration]
   854 |  return g_memdup2(k, 16);
       |         ^~~~~~~~~
       |         g_memdup
../lib/mega.c:854:9: warning: returning 'int' from a function with 
return type 'guchar *' {aka 'unsigned char *'} makes pointer from 
integer without a cast [-Wint-conversion]
   854 |  return g_memdup2(k, 16);
       |         ^~~~~~~~~~~~~~~~
../lib/mega.c: In function 'make_password_key':
../lib/mega.c:883:9: warning: returning 'int' from a function with 
return type 'guchar *' {aka 'unsigned char *'} makes pointer from 
integer without a cast [-Wint-conversion]
   883 |  return g_memdup2(pkey, 16);
       |         ^~~~~~~~~~~~~~~~~~~
../lib/mega.c: In function 'add_share_key':
../lib/mega.c:1820:55: warning: passing argument 3 of 
'g_hash_table_insert' makes pointer from integer without a cast 
[-Wint-conversion]
  1820 |  g_hash_table_insert(s->share_keys, g_strdup(handle), 
g_memdup2(key, 16));
       | ^~~~~~~~~~~~~~~~~~
       |                                                       |
       |                                                       int
In file included from /usr/include/glib-2.0/glib.h:50,
                  from ../lib/mega.h:23,
                  from ../lib/mega.c:21:
/usr/include/glib-2.0/glib/ghash.h:69:61: note: expected 'gpointer' {aka 
'void *'} but argument is of type 'int'
    69 | gpointer        value);
       | ~~~~~~~~~~~~~~~~^~~~~
../lib/mega.c: In function 'mega_session_open':
../lib/mega.c:2377:19: warning: assignment to 'guchar *' {aka 'unsigned 
char *'} from 'int' makes pointer from integer without a cast 
[-Wint-conversion]
  2377 |   s->password_key = g_memdup2(key, 16);
       |                   ^
../lib/mega.c: In function 'mega_session_new_node_attribute':
../lib/mega.c:3069:26: warning: initialization of 'guchar *' {aka 
'unsigned char *'} from 'int' makes pointer from integer without a cast 
[-Wint-conversion]
  3069 |  gc_free guchar *plain = g_memdup2(data, len);
       |                          ^~~~~~~~~
ninja: subcommand failed
The command '/bin/sh -c ninja -C .build' returned a non-zero code: 1

-------------------------------------------------------------------------------------------------------------------------------

Before build i install these packages:

apk add --update build-base libcurl curl-dev asciidoc openssl-dev 
glib-dev glib libtool automake autoconf meson ninja

Thank you in advance, dont hesitate to ask for more debug or build info.