Project

General

Profile

Actions

Bug #6362

closed

osmo-epdg fails to build for 32 bit

Added by osmith 3 months ago. Updated 2 months ago.

Status:
Resolved
Priority:
Low
Assignee:
Target version:
-
Start date:
02/16/2024
Due date:
% Done:

100%


Description

Since 2024-02-12, osmo-epdg fails to build for 32 bit architectures (i586, armv7l). As discussed in the team meeting, supporting 32 bit is not important for osmo-epdg.

I've disabled building the nightly osmo-epdg packages for 32 bit for now, so we don't get mails about failed builds every day.


Files

Actions #1

Updated by osmith 3 months ago

Build errors:

[   96s] gen_socket_nif.c: In function 'nif_recv':
[   96s] gen_socket_nif.c:584:35: error: passing argument 3 of 'enif_get_long' from incompatible pointer type [-Werror=incompatible-pointer-types]
[   96s]   584 |  || !enif_get_ssize(env, argv[1], &len))
[   96s]       |                                   ^~~~
[   96s]       |                                   |
[   96s]       |                                   ssize_t * {aka int *}
[   96s] In file included from gen_socket_nif.c:64:
[   96s] /usr/lib/erlang/erts-11.1.8/include/erl_nif_api_funcs.h:104:79: note: expected 'long int *' but argument is of type 'ssize_t *' {aka 'int *'}
[   96s]   104 | ERL_NIF_API_FUNC_DECL(int,enif_get_long,(ErlNifEnv*, ERL_NIF_TERM term, long* ip));
[   96s]       |                                                                         ~~~~~~^~
[   96s] /usr/lib/erlang/erts-11.1.8/include/erl_nif.h:339:76: note: in definition of macro 'ERL_NIF_API_FUNC_DECL'
[   96s]   339 | #  define ERL_NIF_API_FUNC_DECL(RET_TYPE, NAME, ARGS) extern RET_TYPE NAME ARGS
[   96s]       |                                                                            ^~~~
[   96s] gen_socket_nif.c: In function 'nif_recvmsg':
[   96s] gen_socket_nif.c:640:35: error: passing argument 3 of 'enif_get_long' from incompatible pointer type [-Werror=incompatible-pointer-types]
[   96s]   640 |  || !enif_get_ssize(env, argv[2], &len))
[   96s]       |                                   ^~~~
[   96s]       |                                   |
[   96s]       |                                   ssize_t * {aka int *}
[   96s] In file included from gen_socket_nif.c:64:
[   96s] /usr/lib/erlang/erts-11.1.8/include/erl_nif_api_funcs.h:104:79: note: expected 'long int *' but argument is of type 'ssize_t *' {aka 'int *'}
[   96s]   104 | ERL_NIF_API_FUNC_DECL(int,enif_get_long,(ErlNifEnv*, ERL_NIF_TERM term, long* ip));
[   96s]       |                                                                         ~~~~~~^~
[   96s] /usr/lib/erlang/erts-11.1.8/include/erl_nif.h:339:76: note: in definition of macro 'ERL_NIF_API_FUNC_DECL'
[   96s]   339 | #  define ERL_NIF_API_FUNC_DECL(RET_TYPE, NAME, ARGS) extern RET_TYPE NAME ARGS
[   96s]       |                                                                            ^~~~
[   96s] gen_socket_nif.c: In function 'nif_recvfrom':
[   96s] gen_socket_nif.c:731:35: error: passing argument 3 of 'enif_get_long' from incompatible pointer type [-Werror=incompatible-pointer-types]
[   96s]   731 |  || !enif_get_ssize(env, argv[1], &len))
[   96s]       |                                   ^~~~
[   96s]       |                                   |
[   96s]       |                                   ssize_t * {aka int *}
[   96s] In file included from gen_socket_nif.c:64:
[   96s] /usr/lib/erlang/erts-11.1.8/include/erl_nif_api_funcs.h:104:79: note: expected 'long int *' but argument is of type 'ssize_t *' {aka 'int *'}
[   96s]   104 | ERL_NIF_API_FUNC_DECL(int,enif_get_long,(ErlNifEnv*, ERL_NIF_TERM term, long* ip));
[   96s]       |                                                                         ~~~~~~^~
[   96s] /usr/lib/erlang/erts-11.1.8/include/erl_nif.h:339:76: note: in definition of macro 'ERL_NIF_API_FUNC_DECL'
[   96s]   339 | #  define ERL_NIF_API_FUNC_DECL(RET_TYPE, NAME, ARGS) extern RET_TYPE NAME ARGS
[   96s]       |                                                                            ^~~~
[   96s] gen_socket_nif.c: In function 'nif_read':
[   96s] gen_socket_nif.c:853:35: error: passing argument 3 of 'enif_get_long' from incompatible pointer type [-Werror=incompatible-pointer-types]
[   96s]   853 |  || !enif_get_ssize(env, argv[1], &len))
[   96s]       |                                   ^~~~
[   96s]       |                                   |
[   96s]       |                                   ssize_t * {aka int *}
[   96s] In file included from gen_socket_nif.c:64:
[   96s] /usr/lib/erlang/erts-11.1.8/include/erl_nif_api_funcs.h:104:79: note: expected 'long int *' but argument is of type 'ssize_t *' {aka 'int *'}
[   96s]   104 | ERL_NIF_API_FUNC_DECL(int,enif_get_long,(ErlNifEnv*, ERL_NIF_TERM term, long* ip));
[   96s]       |                                                                         ~~~~~~^~
[   96s] /usr/lib/erlang/erts-11.1.8/include/erl_nif.h:339:76: note: in definition of macro 'ERL_NIF_API_FUNC_DECL'
[   96s]   339 | #  define ERL_NIF_API_FUNC_DECL(RET_TYPE, NAME, ARGS) extern RET_TYPE NAME ARGS
[   96s]       |                                                                            ^~~~
[   96s] cc1: all warnings being treated as errors
[   96s] make[3]: *** [<builtin>: gen_socket_nif.o] Error 1
[   96s] make[3]: Leaving directory '/usr/src/packages/BUILD/_checkouts/gen_socket/c_src'
[   96s] ===> Hook for compile failed!
[   96s] 
[   96s] make[2]: *** [Makefile:4: build] Error 1
Actions #2

Updated by pespin 2 months ago

osmith I submitted the following patch to gen_socket.git branch "osmocom/master" which I believe should fix the issue:

commit c21cc03cc157a9c952d4406f900c4897d48ec342 (HEAD -> osmocom/master, osmo/osmocom/master)
Author: Pau Espin Pedrol <pespin@sysmocom.de>
Date:   Tue Feb 20 13:09:13 2024 +0100

    gen_socket_nif.c: Fix compilation on 32bit linux

    Fixes following error:
    """ 
    gen_socket_nif.c: In function 'nif_read':
    gen_socket_nif.c:853:35: error: passing argument 3 of 'enif_get_long' from incompatible pointer type [-Werror=incompatible-pointer-types]
       853 |  || !enif_get_ssize(env, argv[1], &len))
           |                                   ^~~~
           |                                   |
           |                                   ssize_t * {aka int *}
     In file included from gen_socket_nif.c:64:
     /usr/lib/erlang/erts-11.1.8/include/erl_nif_api_funcs.h:104:79: note: expected 'long int *' but argument is of type 'ssize_t *' {aka 'int *'}
       104 | ERL_NIF_API_FUNC_DECL(int,enif_get_long,(ErlNifEnv*, ERL_NIF_TERM term, long* ip));
           |                                                                         ~~~~~~^~
    """ 

    Related: https://osmocom.org/issues/6362

diff --git a/c_src/gen_socket_nif.c b/c_src/gen_socket_nif.c
index 18ff5b7..3550699 100644
--- a/c_src/gen_socket_nif.c
+++ b/c_src/gen_socket_nif.c
@@ -1,5 +1,6 @@
 /*
- * Copyright (c) 2010-2012, Travelping GmbH <info@travelping.com
+ * Copyright (c) 2010-2012, Travelping GmbH <info@travelping.com>
+ * Copyright (c) 2024 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -81,7 +82,12 @@ static ERL_NIF_TERM atom_sock_err;

 // -------------------------------------------------------------------------------------------------
 // -- MISC INTERNAL HELPER FUNCTIONS
+#if SSIZE_MAX >= LONG_MAX
 #define enif_get_ssize enif_get_long
+#else
+#define enif_get_ssize enif_get_int
+#endif

Actions #3

Updated by pespin 2 months ago

  • Status changed from New to Feedback
  • Assignee changed from pespin to osmith
Actions #4

Updated by osmith 2 months ago

  • % Done changed from 0 to 50

Thanks! I'll wait until https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/36021/1 is merged and the nightlies based on that are pushed to OBS, then re-enable the 32 bit arch.

Actions #5

Updated by osmith 2 months ago

  • Status changed from Feedback to Resolved
  • % Done changed from 50 to 100

I've tested yesterday that the patches will fix it. The patches are merged and I have re-enabled 32 bit arches for osmo-epdg nightly.

Actions

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)