[{"id":25316,"web_url":"https://patchwork.libcamera.org/comment/25316/","msgid":"<57f84cf9-505c-6a74-3e31-7a04cd3b377d@ideasonboard.com>","date":"2022-10-05T17:35:00","subject":"Re: [libcamera-devel] [PATCH v2] test: threads: Fix link failure\n\tdue to missing dependency","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/people/86/","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"content":"Hi Laurent,\n\nOn 10/5/22 9:10 PM, Laurent Pinchart via libcamera-devel wrote:\n> Commit 036d26d6677e (\"test: threads: Test thread cleanup upon abnormal\n> termination\") added calls to functions provided by the pthread library\n> in the threads test, but didn't add the corresponding dependency. This\n> caused a link breakage on some platforms:\n>\n> /usr/bin/ld: test/threads.p/threads.cpp.o: undefined reference to symbol 'pthread_cancel@@GLIBC_2.4'\n> /usr/bin/ld: /lib/arm-linux-gnueabihf/libpthread.so.0: error adding symbols: DSO missing from command line\n> collect2: error: ld returned 1 exit status\n>\n> The threads test binary needs to be linked with the pthread library. To\n> keep meson.build simple, link all internal tests to pthread\n> unconditionally.\n>\n> Fixes: 036d26d6677e (\"test: threads: Test thread cleanup upon abnormal termination\")\n> Reported-by: Naushir Patuck <naush@raspberrypi.com>\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> Reviewed-by: Naushir Patuck <naush@raspberrypi.com>\n> Tested-by: Naushir Patuck <naush@raspberrypi.com>\n> ---\n> By popular request, a simplified version. I personally think it's much\n> more of a quick & dirty solution than v1, which I still prefer over v2.\n\nI like this one for simplicity ;-)\n\nReviewed-by: Umang Jain <umang.jain@ideasonboard.com>\n\n\nBut I understand the concern linking it with every thread so I guess you \nalready have some thoughts on improving the v1 perhaps on top...\n> ---\n>   src/libcamera/base/meson.build | 2 +-\n>   src/libcamera/meson.build      | 1 +\n>   test/meson.build               | 2 +-\n>   3 files changed, 3 insertions(+), 2 deletions(-)\n>\n> diff --git a/src/libcamera/base/meson.build b/src/libcamera/base/meson.build\n> index 3b9d74efe935..7a75914ab2a8 100644\n> --- a/src/libcamera/base/meson.build\n> +++ b/src/libcamera/base/meson.build\n> @@ -38,9 +38,9 @@ if libunwind.found()\n>   endif\n>   \n>   libcamera_base_deps = [\n> -    dependency('threads'),\n>       libatomic,\n>       libdw,\n> +    libthreads,\n>       libunwind,\n>   ]\n>   \n> diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build\n> index 63b47b177fd2..7fcbb2ddc9e7 100644\n> --- a/src/libcamera/meson.build\n> +++ b/src/libcamera/meson.build\n> @@ -58,6 +58,7 @@ includes = [\n>   ]\n>   \n>   libatomic = cc.find_library('atomic', required : false)\n> +libthreads = dependency('threads')\n>   \n>   subdir('base')\n>   subdir('ipa')\n> diff --git a/test/meson.build b/test/meson.build\n> index 6cc778415dc8..f39f537035be 100644\n> --- a/test/meson.build\n> +++ b/test/meson.build\n> @@ -75,7 +75,7 @@ endforeach\n>   \n>   foreach t : internal_tests\n>       exe = executable(t[0], t[1],\n> -                     dependencies : libcamera_private,\n> +                     dependencies : [libcamera_private, libthreads],\n>                        link_with : test_libraries,\n>                        include_directories : test_includes_internal)\n>   \n>\n> base-commit: 487989eec64aa9f57f39b3bdcf619a5d435efac6","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 2E085C0DA4\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  5 Oct 2022 17:35:09 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 839D562CC9;\n\tWed,  5 Oct 2022 19:35:08 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id EFFEB601C7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  5 Oct 2022 19:35:06 +0200 (CEST)","from [192.168.1.103] (unknown [103.86.18.245])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 96EF1415;\n\tWed,  5 Oct 2022 19:35:05 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1664991308;\n\tbh=h8d8TvKfAmE6c5j5Bc/5kTkEzJg+tcGJ7iGa1zI9LpI=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=I+3WbdOvkrt11/jr8BT5WCH5q6dD8w9QqF1UFqzCZGw4Gd9pAKGjmdSHlcqWJ7giY\n\tgyDFLhXJ4KcX9I7/VoNUCMh2bdOyR2od8LNcwn4ZEjaPXfMkDbVn/Y6MSVqDhWJvV9\n\tETP3yvFuc5twVrR0/pCAd++tyMk/fBcn4Gvovv7J9IuJT16q36WkEoFPkFAvXFny5z\n\t3icr/Ibcrbg7KAolgjVwBUp9jvlifaMIcR0v6aSDnBfUbcCWBsD3ZeVKZ//pC94YQX\n\tPv9nRN9dphqyDrA468omTf+VMTntsS70eA88SkvJZx01VznXkCUproFNuv09VxR9gu\n\tuyx4I9EhOCVdg==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1664991306;\n\tbh=h8d8TvKfAmE6c5j5Bc/5kTkEzJg+tcGJ7iGa1zI9LpI=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=MbM+qZ+4SOnR1Q6ySY9ELjI0u4jf80CdtZyqJl44cJs/akNkaPn0A/YmvuBm88rvh\n\ta0NuDDeacyxe+9WVzNb6BzAZ1igPTBnrmgVZFyf0cB+H8tbZfWyZC2l++32w/qxzCt\n\tiBIg4bqli/TpLDHQDgc8SlPxKQhRHda3eq1itjpE="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"MbM+qZ+4\"; dkim-atps=neutral","Message-ID":"<57f84cf9-505c-6a74-3e31-7a04cd3b377d@ideasonboard.com>","Date":"Wed, 5 Oct 2022 23:05:00 +0530","MIME-Version":"1.0","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101\n\tThunderbird/102.2.1","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20221005154042.7302-1-laurent.pinchart@ideasonboard.com>","Content-Language":"en-US","In-Reply-To":"<20221005154042.7302-1-laurent.pinchart@ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH v2] test: threads: Fix link failure\n\tdue to missing dependency","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Umang Jain via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Umang Jain <umang.jain@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":25317,"web_url":"https://patchwork.libcamera.org/comment/25317/","msgid":"<ee7a49c9-e959-b0f5-d040-2121743e75ea@ideasonboard.com>","date":"2022-10-05T17:38:09","subject":"Re: [libcamera-devel] [PATCH v2] test: threads: Fix link failure\n\tdue to missing dependency","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/people/86/","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"content":"On 10/5/22 11:05 PM, Umang Jain via libcamera-devel wrote:\n> Hi Laurent,\n>\n> On 10/5/22 9:10 PM, Laurent Pinchart via libcamera-devel wrote:\n>> Commit 036d26d6677e (\"test: threads: Test thread cleanup upon abnormal\n>> termination\") added calls to functions provided by the pthread library\n>> in the threads test, but didn't add the corresponding dependency. This\n>> caused a link breakage on some platforms:\n>>\n>> /usr/bin/ld: test/threads.p/threads.cpp.o: undefined reference to \n>> symbol 'pthread_cancel@@GLIBC_2.4'\n>> /usr/bin/ld: /lib/arm-linux-gnueabihf/libpthread.so.0: error adding \n>> symbols: DSO missing from command line\n>> collect2: error: ld returned 1 exit status\n>>\n>> The threads test binary needs to be linked with the pthread library. To\n>> keep meson.build simple, link all internal tests to pthread\n>> unconditionally.\n>>\n>> Fixes: 036d26d6677e (\"test: threads: Test thread cleanup upon \n>> abnormal termination\")\n>> Reported-by: Naushir Patuck <naush@raspberrypi.com>\n>> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n>> Reviewed-by: Naushir Patuck <naush@raspberrypi.com>\n>> Tested-by: Naushir Patuck <naush@raspberrypi.com>\n>> ---\n>> By popular request, a simplified version. I personally think it's much\n>> more of a quick & dirty solution than v1, which I still prefer over v2.\n>\n> I like this one for simplicity ;-)\n>\n> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>\n>\n>\n> But I understand the concern linking it with every thread so I guess \n> you already have some thoughts on improving the v1 perhaps on top...\n\ns/thread/test/\n>> ---\n>>   src/libcamera/base/meson.build | 2 +-\n>>   src/libcamera/meson.build      | 1 +\n>>   test/meson.build               | 2 +-\n>>   3 files changed, 3 insertions(+), 2 deletions(-)\n>>\n>> diff --git a/src/libcamera/base/meson.build \n>> b/src/libcamera/base/meson.build\n>> index 3b9d74efe935..7a75914ab2a8 100644\n>> --- a/src/libcamera/base/meson.build\n>> +++ b/src/libcamera/base/meson.build\n>> @@ -38,9 +38,9 @@ if libunwind.found()\n>>   endif\n>>     libcamera_base_deps = [\n>> -    dependency('threads'),\n>>       libatomic,\n>>       libdw,\n>> +    libthreads,\n>>       libunwind,\n>>   ]\n>>   diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build\n>> index 63b47b177fd2..7fcbb2ddc9e7 100644\n>> --- a/src/libcamera/meson.build\n>> +++ b/src/libcamera/meson.build\n>> @@ -58,6 +58,7 @@ includes = [\n>>   ]\n>>     libatomic = cc.find_library('atomic', required : false)\n>> +libthreads = dependency('threads')\n>>     subdir('base')\n>>   subdir('ipa')\n>> diff --git a/test/meson.build b/test/meson.build\n>> index 6cc778415dc8..f39f537035be 100644\n>> --- a/test/meson.build\n>> +++ b/test/meson.build\n>> @@ -75,7 +75,7 @@ endforeach\n>>     foreach t : internal_tests\n>>       exe = executable(t[0], t[1],\n>> -                     dependencies : libcamera_private,\n>> +                     dependencies : [libcamera_private, libthreads],\n>>                        link_with : test_libraries,\n>>                        include_directories : test_includes_internal)\n>>\n>> base-commit: 487989eec64aa9f57f39b3bdcf619a5d435efac6\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id F3FA7BD16B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  5 Oct 2022 17:38:18 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3CFE262CE4;\n\tWed,  5 Oct 2022 19:38:18 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C1D17601C7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  5 Oct 2022 19:38:16 +0200 (CEST)","from [192.168.1.103] (unknown [103.86.18.245])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 78925415;\n\tWed,  5 Oct 2022 19:38:15 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1664991498;\n\tbh=4Lh2UA0IV9hZcSGeO1f2tPlBCzNzXNMIgG1yw/Ia8dU=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=houQ60Wb7PApDLKTfkJFGrZQbe3jlf5Qqlc/rgAI1udD/v9g6xu6J3L33axel2hYS\n\toz8/GapFzn6OARgNPlXTyVnDNggpSg2VLdaaMgcrLSnmoL0X1NHNUo/ETRyX1+nC09\n\t/xyT6MO832qcm/+SNJg1DHKwM2GrxkCYggQ0/viyRgSrMmJrP/nzlQGTJPU9ga2Wg6\n\tFa9UC/UvsNT/W3k8QT4gYleTUI8Y/IwnSjlMeb4riEcsfAionPXBdyaXNl0wzdTqM/\n\tb3TBkPbE7xoRpl99sR0k4JrqRf6UeFqDeQag9iovAvHavAN7kX1hJrCp5Jxq8Kc+JJ\n\tMQlzzfQzz8KGg==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1664991496;\n\tbh=4Lh2UA0IV9hZcSGeO1f2tPlBCzNzXNMIgG1yw/Ia8dU=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=V8eCcGTPXpt8VJ+UxRLQ1L99ptMIxIjxWwS3Fb1efJ6X9ifUTARriGaqMugE8ZsMg\n\tDzSUqlBdYZ5sfJCy6J7Ke+EEpDMfax8TvO8I8cKgFixGhXnd6KGqQEk4LQ7sfUKvJF\n\t4kqZeT9TveFxFbxbvztY+hVV1ARxq3zrPF5a2fbQ="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"V8eCcGTP\"; dkim-atps=neutral","Message-ID":"<ee7a49c9-e959-b0f5-d040-2121743e75ea@ideasonboard.com>","Date":"Wed, 5 Oct 2022 23:08:09 +0530","MIME-Version":"1.0","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101\n\tThunderbird/102.2.1","Content-Language":"en-US","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20221005154042.7302-1-laurent.pinchart@ideasonboard.com>\n\t<57f84cf9-505c-6a74-3e31-7a04cd3b377d@ideasonboard.com>","In-Reply-To":"<57f84cf9-505c-6a74-3e31-7a04cd3b377d@ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"8bit","Subject":"Re: [libcamera-devel] [PATCH v2] test: threads: Fix link failure\n\tdue to missing dependency","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Umang Jain via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Umang Jain <umang.jain@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]