From patchwork Mon Mar 20 13:57:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 9634241 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 65B826020B for ; Mon, 20 Mar 2017 13:57:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 598E721F61 for ; Mon, 20 Mar 2017 13:57:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4DF5C26E8A; Mon, 20 Mar 2017 13:57:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E3D9025D99 for ; Mon, 20 Mar 2017 13:57:26 +0000 (UTC) Received: from localhost ([::1]:33110 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cpxoM-0006RI-4K for patchwork-qemu-devel@patchwork.kernel.org; Mon, 20 Mar 2017 09:57:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34326) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cpxoB-0006Q1-8k for qemu-devel@nongnu.org; Mon, 20 Mar 2017 09:57:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cpxo8-0002Uj-6P for qemu-devel@nongnu.org; Mon, 20 Mar 2017 09:57:15 -0400 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]:36795) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cpxo7-0002UV-W2 for qemu-devel@nongnu.org; Mon, 20 Mar 2017 09:57:12 -0400 Received: by mail-wr0-x242.google.com with SMTP id l37so18218682wrc.3 for ; Mon, 20 Mar 2017 06:57:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=a62gRLj5MYXI/5O1PP3bLrDECtP8fB2LLnF4IRR2kwg=; b=cKel1Fj8VyPRd33HAkEA6H6gWNmcu9LrObCSx40dQxasxmFlNRoR/+9uJ0/bmJZ0un Zns71SR4bjW0yHrE7FNg8xBMpmj1ZTCAwbV4lPj+Mn80r0E0xTcQwKQlEge7PO/OCl0u sdY9JU37OghF0Cmyj6qKtrNEwtdetdn6roO8BBwnzBl6YALtf+/d9O+A5myQB1vHsmil 3b/fQFkI1PFlD5CCX1dva1AeCdyxPwi6X+0qhGBB496bAlA5NYjzKB724HWceNFvnI29 38Sl7HHd2HQeY2//InSgH0qbqq46u1FDl4kJP42YQ4QdYtbr+x5h6PX4ewvxZRL7LsIL dGsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=a62gRLj5MYXI/5O1PP3bLrDECtP8fB2LLnF4IRR2kwg=; b=g9GVeXS+bt2ZS1tZO0osj/jhdClNH8K9kAvEFv8wuRGTap5FRfq/nSkTdAIrvoDCTZ oqaghxOgWISMiMyW6zHjj4TYhz+LN6p0SBCXxZfKMmFDt4GMDY3LuvdE/Kf2vIja9B+c 4eS6vpf0yJF+xodeVOTsAs4GaL3EjodN+xCpPzv5smZ48ElOT5hhsiAFe/Ow6P2uiyom l0lg0Ssold/6zHml0k8iupgeCxlnLDh5yoxVq49n0iIqRezhyI2jfJbiaAjZnGid/d4e 51F//dAFwWbYdhAI2Zh6wzqh/jooSAs7EUZS/B3/k9Z3QA/3tjPBqnU4AefGPZmxC/uw pRRw== X-Gm-Message-State: AFeK/H2QFqc43tLfqiQ2M9Mz1L+oMrHoqKUOYJsI630mNQOCzft7rNDp6fax308rIz4ztw== X-Received: by 10.223.138.139 with SMTP id y11mr23768454wry.190.1490018230845; Mon, 20 Mar 2017 06:57:10 -0700 (PDT) Received: from localhost ([51.15.41.238]) by smtp.gmail.com with ESMTPSA id m186sm13553471wmd.21.2017.03.20.06.57.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 20 Mar 2017 06:57:09 -0700 (PDT) Date: Mon, 20 Mar 2017 13:57:08 +0000 From: Stefan Hajnoczi To: Sameeh Jubran Message-ID: <20170320135708.GV17887@stefanha-x1.localdomain> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.7.1 (2016-10-04) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::242 Subject: Re: [Qemu-devel] qemu-ga static compilation X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Roth , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP On Tue, Mar 14, 2017 at 06:51:37PM +0200, Sameeh Jubran wrote: > I am trying to compile qemu-ga for Windows statically using the following > commands: > > ./configure --disable-docs --target-list=x86_64-softmmu > --cross-prefix=x86_64-w64-mingw32- --static --enable-guest-agent-msi > --with-vss-sdk=/path/to/VSSSDK72 > > make -j8 qemu-ga > > > And I keep getting this error: > > /home/sameeh/Builds/q/stubs/error-printf.c:7: undefined reference to > `__imp_g_test_config_vars' > collect2: error: ld returned 1 exit status > Makefile:444: recipe for target 'qemu-ga.exe' failed > make: *** [qemu-ga.exe] Error 1 > > > Notes to consider: > * without --static I can compile it successfully > * Build machine is running Fedora 25 > * I have upgraded all of the tools to their latest version > * If I comment out the function which is causing the issue > (g_test_initialized()), qemu ga compiles statically and runs successfully > without the need of any dlls. > > Can anyone reproduce this? Do you have any idea why is this happening? I guess GLIB_STATIC_COMPILATION is not defined in your build (see the definition of GLIB_VAR in the glib headers). The pkg-config file for glib doesn't define GLIB_STATIC_COMPILATION for pkg-config --static. I guess we must add it manually. Does this work? diff --git a/configure b/configure index 99d8bec..10f23b7 100755 --- a/configure +++ b/configure @@ -3047,6 +3047,10 @@ if test "$modules" = yes; then glib_modules="$glib_modules gmodule-2.0" fi +if test "$static" = yes; then + QEMU_CFLAGS="-DGLIB_STATIC_COMPILATION $QEMU_CFLAGS" +fi + for i in $glib_modules; do if $pkg_config --atleast-version=$glib_req_ver $i; then glib_cflags=$($pkg_config --cflags $i)