[v4l-utils,v1] v4l2-tracer: fix 'symbol mmap64/open64 is already defined' compile failure
Message ID | 20230330150606.20483-1-ps.report@gmx.net (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Hans Verkuil |
Headers |
Received: from vger.kernel.org ([23.128.96.18]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from <linux-media-owner@vger.kernel.org>) id 1phtqw-009i4v-8c; Thu, 30 Mar 2023 15:06:14 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232726AbjC3PGM (ORCPT <rfc822;mkrufky@linuxtv.org> + 1 other); Thu, 30 Mar 2023 11:06:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232602AbjC3PGK (ORCPT <rfc822;linux-media@vger.kernel.org>); Thu, 30 Mar 2023 11:06:10 -0400 Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5191ABB9C for <linux-media@vger.kernel.org>; Thu, 30 Mar 2023 08:06:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=s31663417; t=1680188766; i=ps.report@gmx.net; bh=UzUTtBMgSqAInpvT37/M+h3pkYjAPNNQuTbfmVrLJ8s=; h=X-UI-Sender-Class:From:To:Subject:Date; b=PCO1oqosHLmU6RYfs2XOz3KL9eO+RXrY6l2XOUBl2c5fl1IL4nvF+nU8chod2L9is cQZYHnPIXVIcSwMqyDXS/ov4H99ZcdHwx2epvz4Vhl4lv89oxqYmdXVvjZ2JjiGIpZ RDMo613k25phTlNad52wM2DC5ZEgKAOBkzg4UEe8NYsvqAw5mi3yfj9zpfS9IMUnQB n8bskd04TPY5jvzcbAcJqIl22hSDnswdMQoIvQfBNSUJfrS3TjLUPe65Xd58xJW/gQ 7Qx6SeoDUrVwBWAVbQLZxtttO7XVH/ty75hbDlGH4/XM+Q3sHS6Y+P1oj0ayTxOdNZ YOPRwSFRRssCw== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from localhost.fritz.box ([62.216.208.135]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MtOKi-1qaHgW33mw-00uuit for <linux-media@vger.kernel.org>; Thu, 30 Mar 2023 17:06:06 +0200 From: Peter Seiderer <ps.report@gmx.net> To: linux-media@vger.kernel.org Subject: [PATCH v4l-utils v1] v4l2-tracer: fix 'symbol mmap64/open64 is already defined' compile failure Date: Thu, 30 Mar 2023 17:06:06 +0200 Message-Id: <20230330150606.20483-1-ps.report@gmx.net> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 Content-Transfer-Encoding: base64 X-Provags-ID: V03:K1:LO7t/yYIl4IfjOYlMZ2wdzsURmCgmTnUr8b3071CfU1yoeVBrG1 S7sj1u1p8L/dFipiP5OoROXGxtNZUTXIFch/PLl1XEHlmcXm22MIRaQauG9u+NLpzFxbCw+ EUyIdCfL2B/qu/mEjJ+hP5ZKWx1EUb+ORWeXFoyx4IsMQdrRfPrM1WzvSkA4YKCekBjxplv NAgZVS/GnVR+QUUmIw2Jw== UI-OutboundReport: notjunk:1;M01:P0:HPeU8mVifBE=;wOw4IzqY7UPcxZeJCWpOn3QqBrP txu55pLSK10hsmOpoZSMcH3ogPypgE5uJ/YvYHv1c8OjD/jvxwgQyZHHTBLRNtJxOM7XJ4Dsl N67MayvC0LrMse2FaqnzmuEwyUGWr6lP/Si5S4YHDtpBXuf+9g30Hrnk4azcx8y1KCaIEJ/be qZAQXQnlXNf4L8iWWtjDHZmMJRxG30Ba1PqM71F+wntQn+yBowVCBu21wBO3om5QctMb8b15w FBVgvIrZxyvlAN8lWWh5BZAqKsr7cWHDhXJWLAhubx07SmZttArwUEbXQWNZHQz78MdUsZWkH vsD+81ASMQVdkZiK4+wlnxejtv/ii69QlzrmHU7pkiWeeyrZsvDFD0p4SfieGfFIIk7zVoVcM Jx0eL+3bqugYZn2BSj9WplAx3m0H1jNKq1hjxl+qU0qeuNXcSvwf8P+RNF3sEKa2NOCEBKozd qOepGQWWQKvfwhh+/X+aSLp//249CjuWkH90LhagmkrbXISDwJoztj9tHEA+MdpJIY8tiVNJn TbizKky9/o3Y5xQOTSnezp0Gq+9Q8LEQN97DtieCspAsPZJ6ibcAK6JgHUkTMH1RdJaqE+H6Z ootb7wQ9hiKTqZ1R7JfI12vtV2avFsixhZDEr+tjr64TY+4HjfdPK21sGYXXSxzZg8R5pawpx m/8taYD//zhzTVYIDPs0kVMSfmm/oR/yE5nOesRjR0zgWjojjDae9wKiLcOo028GGk6kefPT1 +Wy80Npi1Q4/k3xIh64Oz8PjgflPU1MfEpF6BLIX/fRLs43ABfsc5/m3/84Gv2m1rSGKG9qlU q//zOgyzjVWU266mPxyaoEVhx3v11reHhJauT6CoUVuUtqrWFVp+SNBwmF9UlvhYOPdQsJAn1 /wqoyozR9LzYzR1FwZasFhntMtzL/Ie3TY18tpdOZlpSZHG+z/3RseYBJY3X5yYy3Wube0TRh My3G9Yg+Nhj6s5nQcLcl+mAe18o= X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,MIME_BASE64_TEXT, RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-media.vger.kernel.org> X-Mailing-List: linux-media@vger.kernel.org X-LSpam-Score: -0.8 (/) X-LSpam-Report: No, score=-0.8 required=5.0 tests=BAYES_00=-1.9,DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1,FREEMAIL_FORGED_FROMDOMAIN=0.001,FREEMAIL_FROM=0.001,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1,MIME_BASE64_TEXT=1.741 autolearn=ham autolearn_force=no |
Series |
[v4l-utils,v1] v4l2-tracer: fix 'symbol mmap64/open64 is already defined' compile failure
|
|
Commit Message
Peter Seiderer
March 30, 2023, 3:06 p.m. UTC
Compiling for RPi4 (64-bit) using buildroot failes with the following
error:
.../host/bin/aarch64-buildroot-linux-gnu-g++ -DHAVE_CONFIG_H -I. -I../.. -I../../utils/common -I.../aarch64-buildroot-linux-gnu/sysroot/usr/include/json-c -I../../lib/include -Wall -Wpointer-arith -D_GNU_SOURCE -I../../include -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -g0 -D_FORTIFY_SOURCE=1 -std=gnu++11 -c libv4l2tracer.cpp -fPIC -DPIC -o .libs/libv4l2tracer_la-libv4l2tracer.o
/tmp/ccfbectY.s: Assembler messages:
/tmp/ccfbectY.s:208: Error: symbol `open64' is already defined
/tmp/ccfbectY.s:762: Error: symbol `mmap64' is already defined
The preprocessor output shows:
[...]
extern "C" {
# 61 ".../host/aarch64-buildroot-linux-gnu/sysroot/usr/include/sys/mman.h" 3 4
extern void * mmap (void *__addr, size_t __len, int __prot, int __flags, int __fd, __off64_t __offset) noexcept (true) __asm__ ("" "mmap64");
[...]
extern void *mmap64 (void *__addr, size_t __len, int __prot,
int __flags, int __fd, __off64_t __offset) noexcept (true);
And host/aarch64-buildroot-linux-gnu/sysroot/usr/include/sys/mman.h:
56 #ifndef __USE_FILE_OFFSET64
57 extern void *mmap (void *__addr, size_t __len, int __prot,
58 int __flags, int __fd, __off_t __offset) __THROW;
59 #else
60 # ifdef __REDIRECT_NTH
61 extern void * __REDIRECT_NTH (mmap,
62 (void *__addr, size_t __len, int __prot,
63 int __flags, int __fd, __off64_t __offset),
64 mmap64);
65 # else
66 # define mmap mmap64
67 # endif
68 #endif
69 #ifdef __USE_LARGEFILE64
70 extern void *mmap64 (void *__addr, size_t __len, int __prot,
71 int __flags, int __fd, __off64_t __offset) __THROW;
72 #endif
Fix it by applying the same undef _LARGEFILE_SOURCE/_FILE_OFFSET_BITS,
define _LARGEFILE64_SOURCE as in as in lib/libv4l1/v4l1compat.c
Signed-off-by: Peter Seiderer <ps.report@gmx.net>
---
Notes:
- maybe the 'defined(linux) && defined(__GLIBC__)' protection
present in lib/libv4l1/v4l1compat.c for open64/mmap64 is needed
for non glibc compiles of utils/v4l2-tracer/libv4l2tracer.cpp too?
---
utils/v4l2-tracer/libv4l2tracer.cpp | 5 +++++
1 file changed, 5 insertions(+)
Comments
Hi Peter, On 30/03/2023 17:06, Peter Seiderer wrote: > Compiling for RPi4 (64-bit) using buildroot failes with the following > error: > > .../host/bin/aarch64-buildroot-linux-gnu-g++ -DHAVE_CONFIG_H -I. -I../.. -I../../utils/common -I.../aarch64-buildroot-linux-gnu/sysroot/usr/include/json-c -I../../lib/include -Wall -Wpointer-arith -D_GNU_SOURCE -I../../include -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -g0 -D_FORTIFY_SOURCE=1 -std=gnu++11 -c libv4l2tracer.cpp -fPIC -DPIC -o .libs/libv4l2tracer_la-libv4l2tracer.o > /tmp/ccfbectY.s: Assembler messages: > /tmp/ccfbectY.s:208: Error: symbol `open64' is already defined > /tmp/ccfbectY.s:762: Error: symbol `mmap64' is already defined > > The preprocessor output shows: > > [...] > extern "C" { > # 61 ".../host/aarch64-buildroot-linux-gnu/sysroot/usr/include/sys/mman.h" 3 4 > extern void * mmap (void *__addr, size_t __len, int __prot, int __flags, int __fd, __off64_t __offset) noexcept (true) __asm__ ("" "mmap64"); > [...] > extern void *mmap64 (void *__addr, size_t __len, int __prot, > int __flags, int __fd, __off64_t __offset) noexcept (true); > > And host/aarch64-buildroot-linux-gnu/sysroot/usr/include/sys/mman.h: > > 56 #ifndef __USE_FILE_OFFSET64 > 57 extern void *mmap (void *__addr, size_t __len, int __prot, > 58 int __flags, int __fd, __off_t __offset) __THROW; > 59 #else > 60 # ifdef __REDIRECT_NTH > 61 extern void * __REDIRECT_NTH (mmap, > 62 (void *__addr, size_t __len, int __prot, > 63 int __flags, int __fd, __off64_t __offset), > 64 mmap64); > 65 # else > 66 # define mmap mmap64 > 67 # endif > 68 #endif > 69 #ifdef __USE_LARGEFILE64 > 70 extern void *mmap64 (void *__addr, size_t __len, int __prot, > 71 int __flags, int __fd, __off64_t __offset) __THROW; > 72 #endif > > Fix it by applying the same undef _LARGEFILE_SOURCE/_FILE_OFFSET_BITS, > define _LARGEFILE64_SOURCE as in as in lib/libv4l1/v4l1compat.c If I look at 'man feature_test_macros', then that man page suggests that _LARGEFILE64_SOURCE is out of date and instead you should use '#define _FILE_OFFSET_BITS 64'. Can you test that? If this works, then it should be applied to v4l1compat.c as well. > > Signed-off-by: Peter Seiderer <ps.report@gmx.net> > --- > Notes: > > - maybe the 'defined(linux) && defined(__GLIBC__)' protection > present in lib/libv4l1/v4l1compat.c for open64/mmap64 is needed > for non glibc compiles of utils/v4l2-tracer/libv4l2tracer.cpp too? I think we need this too. If nothing else, it is consistent. Regards, Hans > --- > utils/v4l2-tracer/libv4l2tracer.cpp | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/utils/v4l2-tracer/libv4l2tracer.cpp b/utils/v4l2-tracer/libv4l2tracer.cpp > index a9f039c7..1e3900db 100644 > --- a/utils/v4l2-tracer/libv4l2tracer.cpp > +++ b/utils/v4l2-tracer/libv4l2tracer.cpp > @@ -3,6 +3,11 @@ > * Copyright 2022 Collabora Ltd. > */ > > +/* ensure we see *64 variants and they aren't transparently used */ > +#undef _LARGEFILE_SOURCE > +#undef _FILE_OFFSET_BITS > +#define _LARGEFILE64_SOURCE 1 > + > #include "trace.h" > #include <dlfcn.h> > #include <stdarg.h>
Hello Hans, On Fri, 31 Mar 2023 10:27:18 +0200, Hans Verkuil <hverkuil@xs4all.nl> wrote: > Hi Peter, > > On 30/03/2023 17:06, Peter Seiderer wrote: > > Compiling for RPi4 (64-bit) using buildroot failes with the following > > error: > > > > .../host/bin/aarch64-buildroot-linux-gnu-g++ -DHAVE_CONFIG_H -I. -I../.. -I../../utils/common -I.../aarch64-buildroot-linux-gnu/sysroot/usr/include/json-c -I../../lib/include -Wall -Wpointer-arith -D_GNU_SOURCE -I../../include -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -g0 -D_FORTIFY_SOURCE=1 -std=gnu++11 -c libv4l2tracer.cpp -fPIC -DPIC -o .libs/libv4l2tracer_la-libv4l2tracer.o > > /tmp/ccfbectY.s: Assembler messages: > > /tmp/ccfbectY.s:208: Error: symbol `open64' is already defined > > /tmp/ccfbectY.s:762: Error: symbol `mmap64' is already defined > > > > The preprocessor output shows: > > > > [...] > > extern "C" { > > # 61 ".../host/aarch64-buildroot-linux-gnu/sysroot/usr/include/sys/mman.h" 3 4 > > extern void * mmap (void *__addr, size_t __len, int __prot, int __flags, int __fd, __off64_t __offset) noexcept (true) __asm__ ("" "mmap64"); > > [...] > > extern void *mmap64 (void *__addr, size_t __len, int __prot, > > int __flags, int __fd, __off64_t __offset) noexcept (true); > > > > And host/aarch64-buildroot-linux-gnu/sysroot/usr/include/sys/mman.h: > > > > 56 #ifndef __USE_FILE_OFFSET64 > > 57 extern void *mmap (void *__addr, size_t __len, int __prot, > > 58 int __flags, int __fd, __off_t __offset) __THROW; > > 59 #else > > 60 # ifdef __REDIRECT_NTH > > 61 extern void * __REDIRECT_NTH (mmap, > > 62 (void *__addr, size_t __len, int __prot, > > 63 int __flags, int __fd, __off64_t __offset), > > 64 mmap64); > > 65 # else > > 66 # define mmap mmap64 > > 67 # endif > > 68 #endif > > 69 #ifdef __USE_LARGEFILE64 > > 70 extern void *mmap64 (void *__addr, size_t __len, int __prot, > > 71 int __flags, int __fd, __off64_t __offset) __THROW; > > 72 #endif > > > > Fix it by applying the same undef _LARGEFILE_SOURCE/_FILE_OFFSET_BITS, > > define _LARGEFILE64_SOURCE as in as in lib/libv4l1/v4l1compat.c > > If I look at 'man feature_test_macros', then that man page suggests that > _LARGEFILE64_SOURCE is out of date and instead you should use > '#define _FILE_OFFSET_BITS 64'. > > Can you test that? If this works, then it should be applied to v4l1compat.c > as well. Did you mean as utils/v4l2-tracer/meson.build all ready does: 73 libv4l2_tracer_cpp_args = [ 74 # Meson enables large file support unconditionally, which redirects file 75 # operations to 64-bit versions. This results in some symbols being 76 # renamed, for instance open() being renamed to open64(). As the library 77 # needs to provide both 32-bit and 64-bit versions of file operations, 78 # disable transparent large file support. 79 '-U_FILE_OFFSET_BITS', 80 '-D_FILE_OFFSET_BITS=32', 81 '-D_LARGEFILE64_SOURCE', 82 ] Did my previous test against the 1.24.1 release using the autoconf/automake build system... A quick (compile) test for lib/libv4l1/v4l1compat.c with #undef _FILE_OFFSET_BITS #define _FILE_OFFSET_BITS 32 #define _LARGEFILE64_SOURCE 1 seems to work... > > > > > Signed-off-by: Peter Seiderer <ps.report@gmx.net> > > --- > > Notes: > > > > - maybe the 'defined(linux) && defined(__GLIBC__)' protection > > present in lib/libv4l1/v4l1compat.c for open64/mmap64 is needed > > for non glibc compiles of utils/v4l2-tracer/libv4l2tracer.cpp too? > > I think we need this too. If nothing else, it is consistent. So this patch should be o.k. for the stable-1.24 branch? Will send one adding the 'defined(linux) && defined(__GLIBC__)' to v4l2-tracer and one changing the in-file undef/define to the meson.build solution for lib/libv4l1/v4l1compat.c (in case this is o.k. here)... Regards, Peter > > Regards, > > Hans > > > --- > > utils/v4l2-tracer/libv4l2tracer.cpp | 5 +++++ > > 1 file changed, 5 insertions(+) > > > > diff --git a/utils/v4l2-tracer/libv4l2tracer.cpp b/utils/v4l2-tracer/libv4l2tracer.cpp > > index a9f039c7..1e3900db 100644 > > --- a/utils/v4l2-tracer/libv4l2tracer.cpp > > +++ b/utils/v4l2-tracer/libv4l2tracer.cpp > > @@ -3,6 +3,11 @@ > > * Copyright 2022 Collabora Ltd. > > */ > > > > +/* ensure we see *64 variants and they aren't transparently used */ > > +#undef _LARGEFILE_SOURCE > > +#undef _FILE_OFFSET_BITS > > +#define _LARGEFILE64_SOURCE 1 > > + > > #include "trace.h" > > #include <dlfcn.h> > > #include <stdarg.h> >
diff --git a/utils/v4l2-tracer/libv4l2tracer.cpp b/utils/v4l2-tracer/libv4l2tracer.cpp index a9f039c7..1e3900db 100644 --- a/utils/v4l2-tracer/libv4l2tracer.cpp +++ b/utils/v4l2-tracer/libv4l2tracer.cpp @@ -3,6 +3,11 @@ * Copyright 2022 Collabora Ltd. */ +/* ensure we see *64 variants and they aren't transparently used */ +#undef _LARGEFILE_SOURCE +#undef _FILE_OFFSET_BITS +#define _LARGEFILE64_SOURCE 1 + #include "trace.h" #include <dlfcn.h> #include <stdarg.h>