Closed nullsoft8411 closed 3 years ago
Had the same issue.
As a workaround, you can disable the '-Werror' flag which is causing this by modifying the AM_CFLAGS variable in src/Makefile
I replaced (line 636) \:
AM_CFLAGS = -D_GNU_SOURCE -Wall -Werror -fno-builtin \
with
AM_CFLAGS = -D_GNU_SOURCE -Wall -fno-builtin \
and 'make' now issues some warnings but is compiling fine.
The whole codebase has this issue in multiple places; I was hoping there would be a few places to fix, but they're truly a ton. Looks like the packed structs are used for multiple things, and the code just assumes it can reference the address of the members of the struct, which shouldn't be done as the alignment of the pointers would be compromised.
If keeping the structs packed is truly mandatory, these cases can be fixed like this (e.g. in this case below last_bw_time
is only being read, not being updated, so no need to update it after the function call):
diff --git a/src/chilli.c b/src/chilli.c
index 0a7ba30..c3d86c0 100644
--- a/src/chilli.c
+++ b/src/chilli.c
@@ -643,8 +643,10 @@ leaky_bucket(struct app_conn_t *conn,
int result = 0;
uint64_t upbytes=0, dnbytes=0;
long double timediff;
+ struct timespec last_bw_time;
- timediff = mainclock_diffd(&conn->s_state.last_bw_time);
+ last_bw_time = conn->s_state.last_bw_time;
+ timediff = mainclock_diffd(&last_bw_time);
Or we can just close our eyes and remove the -Werror
.... (or add -Wno-error=address-of-packed-member
)
Here is the error that i get:
`
can someone help me to fix this please
BR, Sahin