Use common meson c_args/cpp_args to disable transparent large file support for the wrappers as already done in utils/v4l2-tracer for lib/libv4l1/v4l1compat.c and lib/libv4l2/v4l2convert.c too. Signed-off-by: Peter Seiderer <ps.report@xxxxxxx> --- lib/libv4l1/meson.build | 1 + lib/libv4l1/v4l1compat.c | 5 ----- lib/libv4l2/meson.build | 1 + lib/libv4l2/v4l2convert.c | 5 ----- meson.build | 10 ++++++++++ utils/v4l2-tracer/meson.build | 13 +------------ 6 files changed, 13 insertions(+), 22 deletions(-) diff --git a/lib/libv4l1/meson.build b/lib/libv4l1/meson.build index e1df2fa2..e1fba346 100644 --- a/lib/libv4l1/meson.build +++ b/lib/libv4l1/meson.build @@ -60,5 +60,6 @@ v4l1compat = shared_module('v4l1compat', name_prefix : '', install : true, install_dir : libv4l1privdir, + c_args : v4l2_wrapper_args, dependencies : v4l1compat_deps, include_directories : v4l2_utils_incdir) diff --git a/lib/libv4l1/v4l1compat.c b/lib/libv4l1/v4l1compat.c index 705d7d4b..2db68423 100644 --- a/lib/libv4l1/v4l1compat.c +++ b/lib/libv4l1/v4l1compat.c @@ -19,11 +19,6 @@ # Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ -/* ensure we see *64 variants and they aren't transparently used */ -#undef _LARGEFILE_SOURCE -#undef _FILE_OFFSET_BITS -#define _LARGEFILE64_SOURCE 1 - #include <stdlib.h> #include <stdarg.h> #include <fcntl.h> diff --git a/lib/libv4l2/meson.build b/lib/libv4l2/meson.build index bd6e0e7f..9d6ecd5f 100644 --- a/lib/libv4l2/meson.build +++ b/lib/libv4l2/meson.build @@ -69,5 +69,6 @@ v4l2convert = shared_module('v4l2convert', name_prefix : '', install : true, install_dir : libv4l2privdir, + c_args : v4l2_wrapper_args, dependencies : v4l2convert_deps, include_directories : v4l2_utils_incdir) diff --git a/lib/libv4l2/v4l2convert.c b/lib/libv4l2/v4l2convert.c index 97bed9a9..396ed3ea 100644 --- a/lib/libv4l2/v4l2convert.c +++ b/lib/libv4l2/v4l2convert.c @@ -23,11 +23,6 @@ /* prevent GCC 4.7 inlining error */ #undef _FORTIFY_SOURCE -/* ensure we see *64 variants and they aren't transparently used */ -#undef _LARGEFILE_SOURCE -#undef _FILE_OFFSET_BITS -#define _LARGEFILE64_SOURCE 1 - #include <stdarg.h> #include <stdlib.h> #include <fcntl.h> diff --git a/meson.build b/meson.build index 1e76b0f4..75398917 100644 --- a/meson.build +++ b/meson.build @@ -47,6 +47,16 @@ common_arguments = [ '-include', meson.current_build_dir() / 'config.h', ] +v4l2_wrapper_args = [ + # As the library needs to provide both 32-bit and 64-bit versions + # of file operations, disable transparent large file support (fixes + # 'Error: symbol `open64/mmap64' is already defined' compile failure + # otherwise) + '-U_FILE_OFFSET_BITS', + '-D_FILE_OFFSET_BITS=32', + '-D_LARGEFILE64_SOURCE', +] + v4l2_utils_incdir_arr = [ 'lib' / 'include', ] diff --git a/utils/v4l2-tracer/meson.build b/utils/v4l2-tracer/meson.build index ed2c1df8..47c0a1f6 100644 --- a/utils/v4l2-tracer/meson.build +++ b/utils/v4l2-tracer/meson.build @@ -70,21 +70,10 @@ libv4l2_tracer_incdir = [ v4l2_utils_incdir, ] -libv4l2_tracer_cpp_args = [ - # Meson enables large file support unconditionally, which redirects file - # operations to 64-bit versions. This results in some symbols being - # renamed, for instance open() being renamed to open64(). As the library - # needs to provide both 32-bit and 64-bit versions of file operations, - # disable transparent large file support. - '-U_FILE_OFFSET_BITS', - '-D_FILE_OFFSET_BITS=32', - '-D_LARGEFILE64_SOURCE', -] - libv4l2tracer = shared_module('v4l2tracer', libv4l2tracer_sources, install : true, - cpp_args : libv4l2_tracer_cpp_args, + cpp_args : v4l2_wrapper_args, dependencies : libv4l2tracer_deps, include_directories : libv4l2_tracer_incdir) -- 2.40.0