From patchwork Thu Mar 30 15:06:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Seiderer X-Patchwork-Id: 13194319 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13589C77B60 for ; Thu, 30 Mar 2023 15:06:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232726AbjC3PGM (ORCPT ); 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 ); 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 ; 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 ; Thu, 30 Mar 2023 17:06:06 +0200 From: Peter Seiderer 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 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= Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 --- 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(+) 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 #include