From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 039EEA0543 for ; Fri, 11 Nov 2022 15:49:01 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8634A4014F; Fri, 11 Nov 2022 15:49:01 +0100 (CET) Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48]) by mails.dpdk.org (Postfix) with ESMTP id 659C240141 for ; Fri, 11 Nov 2022 15:49:00 +0100 (CET) Received: by mail-lf1-f48.google.com with SMTP id j16so8601800lfe.12 for ; Fri, 11 Nov 2022 06:49:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=El9VUm4OMR2obgaWCYOFkBQvjgaZ9VtEbkOC26uEBXg=; b=LKBaD4eqYIFJRo9RQTmlioQ/MeIriAWERLWIqpwBvP5/t9yTx+tP+yYuhgIHrfKn7N o+uuAWpUUs3oeQqO7e5aivQm14E21XSjWmRpP4d6q68M85l25+qHeoRGOIPdmJkzZWMf DXKg1DJgtF1N2uh2LZMkje4CfnyE08bF63Am7MTRD4xeHg89bUm9cxcVdjs92n6mXiwE F9pjAapmq6vMfu7uXNABPHMjbq63I4Dj1vaAXPhP91bx+B4DeUmoQ/h7pcWrQ/FJNODj fsvJZZGzMyZBMziDKTpfmT4a0fl5qIXC8MvyOSZTQ9ts7ygE5WNmkuUD+3rW0MUIELZq jzCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=El9VUm4OMR2obgaWCYOFkBQvjgaZ9VtEbkOC26uEBXg=; b=qIcv9nDnCKAJFoxTbATQ8VVf/dxtePnNF3roD5ZxUq9NLYjrBn5pLjxHTrLIpql4DS reJfWbMtTbakqVpxNHQpumg0RgXUiXnPYV2tZOBzraHisvxdFtImvJFEkA1GkOaGN12t zkzGsVKesIHCstaEXP3Gtbf7Ta3WqzaXou9xI/y+TLV20AJW+ZHpo9/OPPtPFuVEn7yQ dNx3YGIZ8lBlp1r3rho8AV49NZc8qM1tVnO7DnKP9xPFuxbqGaIXszIVL4PpsRmWMXXA JQcaZs395rAPafh1P6bnLg+gg0egIJhcrrN0+AXwJ3SS6dfV2dUJ/N1zHNSiYgbmKd/c f7IQ== X-Gm-Message-State: ANoB5plknKyAqqLi5+kbthjRM0G6nMSHCRKHgHOU7nGFU49B8lNeZ8c6 va3Ji/IVyTVLF/ar5V1GOhuKSaHjvfM= X-Google-Smtp-Source: AA0mqf5c6zWhFVU2+z6CjBEbyFX5oo009ezHKzbXNq5mHz4hBUhoX0jPagXuFetoIAK2ZAOyfZsfNA== X-Received: by 2002:ac2:5e9e:0:b0:49f:cb82:b3b0 with SMTP id b30-20020ac25e9e000000b0049fcb82b3b0mr977015lfq.293.1668178139638; Fri, 11 Nov 2022 06:48:59 -0800 (PST) Received: from sovereign (broadband-37-110-65-23.ip.moscow.rt.ru. [37.110.65.23]) by smtp.gmail.com with ESMTPSA id bs15-20020a05651c194f00b00277025ddc9esm435242ljb.54.2022.11.11.06.48.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Nov 2022 06:48:58 -0800 (PST) Date: Fri, 11 Nov 2022 17:48:57 +0300 From: Dmitry Kozlyuk To: Robert Hable Cc: "users@dpdk.org" Subject: Re: rte_eth_dev_count_avail returns different value in library Message-ID: <20221111174857.71cdc2f7@sovereign> In-Reply-To: References: <20221028134808.78435c9d@sovereign> X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: users@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK usage discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: users-bounces@dpdk.org 2022-11-11 13:51 (UTC+0000), Robert Hable: > Hello Dimitry, > > Yes, I am building DPDK as static library. As far as I have seen it should also be the default option on windows builds? DPDK builds both static and dynamic libraries by default ("default_library=static" means that DPDK apps will use static libraries). However, DLLs don't work on Windows currently. > I tried linking the following libraries to my application, which is using my own dpdk-library, but I had no success in using any dpdk functionality (rte_eth_dev_count_avail() returns 0). > In the linker output I found out that the libraries are currently unused: > > 1>Unused libraries: > 1> C:\Dev\Extern\dpdk\build\lib\librte_eal.a > 1> C:\Dev\Extern\dpdk\build\lib\librte_mbuf.a > 1> C:\Dev\Extern\dpdk\build\lib\librte_mempool.a > 1> C:\Dev\Extern\dpdk\build\lib\librte_ethdev.a I'm puzzled why these four are unused. If the DLL using rte_eth_dev_count_avail() links successfully, the linked must use "librte_ethdev.a". > 1> C:\Dev\Extern\dpdk\build\drivers\librte_common_mlx5.a > 1> C:\Dev\Extern\dpdk\build\drivers\librte_net_mlx5.a > > Do you have any other ideas what I am missing there and why they are not linked to it? Is it may be possible to include all the PMD libraries already in my own library, so I only need to link against one library? > Yes, rte_eth_dev_count_avail() is called directly after rte_eal_init(). > > By the way I am using the visual studio 2022 compiler to build my own application and clang for compiling dpdk if that matters. Please try /WHOLEARCHIVE for these libraries as documented here: https://learn.microsoft.com/en-us/cpp/build/reference/wholearchive-include-all-library-object-files?view=msvc-160 On Unices, PMDs are also linked using a similar --whole-archive option. This is needed because there are no direct references from DPDK libraries to PMDs, because PMDs register themselves at startup.