[PATCH 2/3] build: allow using a system-provided talloc properly

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Jan Engelhardt jengelh at inai.de
Fri Oct 3 11:34:22 UTC 2014


On Friday 2014-10-03 13:19, Holger Hans Peter Freyther wrote:
>On Fri, Oct 03, 2014 at 12:57:03PM +0200, Jan Engelhardt wrote:
>> When --disable-talloc was given to configure, it would already link
>> libosmocore.so to libtalloc. Make it use pkg-config to discover
>> talloc's flags and location, and when the system talloc is used,
>> make sure to use its API header file too.
>
>>  include/osmocom/core/talloc.h.in  |   6 ++
>
>Have you considered patching libosmocore.pc.in as well to list talloc
>as "required" there? This way users of libosmocore do not need to check
>for talloc themselves?

I can do that.


>>  AC_ARG_ENABLE(talloc,
>>  	[AS_HELP_STRING(
>>  		[--disable-talloc],
>> -		[Disable building talloc memory allocator]
>> +		[Disable using bundled talloc memory allocator]
>>  	)],
>>  	[enable_talloc=$enableval], [enable_talloc="yes"])
>>  AM_CONDITIONAL(ENABLE_TALLOC, [test x"$enable_talloc" = x"yes"])
>> +AS_IF([test x"$enable_talloc" = xno],
>
>I think the wording does not reflect the two different usecases we have here.
>
>* Firmware builds with no talloc

That may be the use case, but it is not what was implemented. If you
build 0.7.0 [336915aa0a] with --disable-talloc, `ldd
src/.libs/libosmocore.so` will show libtalloc.so.2. Which kind of
goes against this use case. Therefore, "disable-talloc" really just
meant "disable-system-talloc".


>> diff --git a/include/osmocom/core/talloc_int.h b/include/osmocom/core/talloc_int.h
>> new file mode 100644
>> index 0000000..dde102b
>> --- /dev/null
>> +++ b/include/osmocom/core/talloc_int.h
>
>Do you know the '-M' option for send-email/format-patch? It helps with
>reviewing simple renames.

Been there, tried that. And when I used it, comes someone who wants
a non-M submission because they are using some traditional utility
or something. Not here, but I remember it occurring on netfilter-devel.


>> diff --git a/tests/msgfile/msgfile_test.c b/tests/msgfile/msgfile_test.c
>> index a919694..2684b6a 100644
>> --- a/tests/msgfile/msgfile_test.c
>> +++ b/tests/msgfile/msgfile_test.c
>> @@ -20,6 +20,7 @@
>>   */
>>  
>>  #include <osmocom/core/msgfile.h>
>> +#include <osmocom/core/talloc.h>
>
>Is this hunk needed?

Yes, because system talloc has a

#define talloc_free(ctx) _talloc_free(ctx, __location__)

and otherwise, one gets "implicit definition of talloc_free" and
"undefined reference to `talloc_free'".


>If you address the pkg-config issue I am happy to inclue your patch. In
>terms of options.. maybe we can just remove --disable-talloc instead of
>having sort of a tri-state?

What's the third option?




More information about the OpenBSC mailing list