From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-f43.google.com (mail-lf0-f43.google.com [209.85.215.43]) by dpdk.org (Postfix) with ESMTP id D255B2BF1 for ; Mon, 5 Mar 2018 06:08:46 +0100 (CET) Received: by mail-lf0-f43.google.com with SMTP id g72so21245621lfg.3 for ; Sun, 04 Mar 2018 21:08:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=XCMJEJAeMyrAwTVbEwEqLCkGZg/23TauYvV6lKW0ERI=; b=ZDe7dMqrPviW7BMpR5k4u+V7tKIPNfEJYzurRJSc2RRQrsULNhzBdsXuOdTS1+Fl0B lLjoVmWaR/KF26raxaPIjjbSFwzYqPuLqEWKhuyUyTdX/9LyR9q02V8LHTW5grMIxOlS 89D+mxUcBt6nhUjljfqpChYn4cT9Ocakc/HUbTc3+9XWUMZ8V97X48mGXyIBjceMr/Bf 51g7wnhrOgv/Gb3JsIXJct386HQv1qzuOf3sxBJ/YU4Vkw/avSZiLNlj7pYCSgMCe7Ju irCmXLifUAknp23Gs8NW3gWjHY4WIjmkXjNADqRlBrcsa+4PmwpMljMJNrvPhNdY/idw AZ7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=XCMJEJAeMyrAwTVbEwEqLCkGZg/23TauYvV6lKW0ERI=; b=gEqprkdRITcstioYVZkBhgjk4H3IIJZ6nvIjJCGWLpgP1fU52FH+LpxWQGsqlgkPK7 BfqYeuDAHn735w7bzLSaFQv4+25vGAF698QSKTVU+Dhab45nvGzLGBml9gxg30AKabh4 gNp21OZqGkpvaMx3FlrG/c3OG3e2QZ/ByxrdLgesr2U5I8pE/pME+Rk13zjaAXu7/mDa SwQS89EJriUKauMBhLxiYYY57APDpVH2DZEzvDUXTyUYlTpgS2qAbmiJPQnsJ5Yi8ird eUL0Rnb1LGt0pwfEQd4xDTIpeDzjpGiGlCCyTkIcGzQErwfBXHsfsdflc8wdCixGBEPh jlkw== X-Gm-Message-State: AElRT7Gv/bcohUiZPs3NedJr1UiYurMrme1oCw1wqiIeBxY72Qa3u7tL PGe4P3GYpvB3as7mrw8rDUk+iy7E8goVH3NZD4yDMcwB X-Google-Smtp-Source: AG47ELsN0CGAsz2exU+w9idbUYICayYd1QBAo6+JXBmcNTDCZ2qgJKT0+zSWvV76w1XmZwGLX4W/S7cm0Yks7lzGb9Q= X-Received: by 10.25.29.81 with SMTP id d78mr9275801lfd.18.1520226525953; Sun, 04 Mar 2018 21:08:45 -0800 (PST) MIME-Version: 1.0 Received: by 10.46.0.196 with HTTP; Sun, 4 Mar 2018 21:08:45 -0800 (PST) From: Hui Liu Date: Sun, 4 Mar 2018 21:08:45 -0800 Message-ID: To: users@dpdk.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: [dpdk-users] DPDK library link issue with __attribute__((constructor)) X-BeenThere: users@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK usage discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Mar 2018 05:08:47 -0000 Hi Guys, I am using DPDK with the yocto build system. I found some static library is not linked because of the linker's as-needed decision. Some .a file use __attribute__((constructor)) to register their APIs, we only know if we use these APIs at runtime, but linker make the decision early and then discarded them. I tried a lot to link the library I need: 1, use -Wl, --no-as-needed, for example: gcc a.c *-Wl, --no-as-needed* -ldl -ldpdk 2, Put the library explicitly to the linker like this: gcc a.c -Wl, --no-as-needed -ldl -ldpdk *-lrte_mempool* At last, I still didn't find my library in the elf file. Is there anything else I can try to link these library? -- Thanks & Best Regards Liu Hui --