From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 71275 invoked by alias); 19 Jul 2017 15:07:48 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 71253 invoked by uid 89); 19 Jul 2017 15:07:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=no version=3.3.2 spammy=mistaken, UD:main.o, maino, main.o X-HELO: mail-qt0-f176.google.com Received: from mail-qt0-f176.google.com (HELO mail-qt0-f176.google.com) (209.85.216.176) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 19 Jul 2017 15:07:45 +0000 Received: by mail-qt0-f176.google.com with SMTP id n42so4647624qtn.0 for ; Wed, 19 Jul 2017 08:07:45 -0700 (PDT) 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=W+noUce/E1/gIsnXUWLZ5cH9j8+c20tZaEp8xZBqtZI=; b=tcn+5Rq8zt1JftyXST1eX2h0TzgHi4BanQpOsujdLlbrznN0i65FPYOhGGMefqW0hP jJVt0gttCjikd72RnCE8Db8tmU8BrRKkJTqusmiecA+qfLvfSjUldmP4nkodXOBs49KB IQDrgQP7atd1Pxv1n4kkASt5ayKfa81YB+kiq6jxCdsHLZjAx/Z3T1foJw4bjN+HdaP4 Ou3DFA9RyEbvKbI/rtVHbEFWMHVmNkn8+n27fCTOWLQ9yqSM8ReV9yQ2wbKCwR41OWe0 jPSMsXHdSjDoceJtSkaP0rgXQT//0j0wI/l3NyhOCdYFo4O9VrmypeviCCQOzPOoF1Bk VNHA== X-Gm-Message-State: AIVw113DsYcXnRy3xj7bqmwtaQMrBYZUG8hb9iUASM+qtzr2nGPcvhzB v0IXrDfSCNlDugynqBMhqXNBYWwlUgte X-Received: by 10.237.47.227 with SMTP id m90mr598402qtd.103.1500476863359; Wed, 19 Jul 2017 08:07:43 -0700 (PDT) MIME-Version: 1.0 Received: by 10.140.19.149 with HTTP; Wed, 19 Jul 2017 08:07:42 -0700 (PDT) From: J Date: Wed, 19 Jul 2017 15:47:00 -0000 Message-ID: Subject: Link error with static version of zlib? To: cygwin@cygwin.com Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2017-07/txt/msg00276.txt.bz2 Hello, I am trying to produce an executable using mingw that uses all-static linking, that is, that it does not rely on any DLLs except possibly the Microsoft msvcrt.dll Is it possible? If I am not mistaken, when selecting the package mingw64-x86_64-zlib with the installer, it installs the library, which has been compiled as both a DLL and a static library. But it appears that the minizip library included within the zlib package is only present in DLL form. When building, I get the following make x86_64-w64-mingw32-g++ -O2 -fno-strength-reduce -O2 -fno-strength-reduce -g -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/ -DDEBUG -D_WIN32 -std=c++11 -c -o main.o main.cpp x86_64-w64-mingw32-g++ -o app.exe -O2 -fno-strength-reduce -g -Wall -Wpointer-arith -L/usr/lib main.o -mwindows -static -lws2_32 -lgdi32 -lcomctl32 -lcomdlg32 -lminizip -lz -Wl,--enable-auto-import,--enable-runtime-pseudo-reloc /usr/lib/gcc/x86_64-w64-mingw32/5.4.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find -lminizip collect2: error: ld returned 1 exit status But yet, when I build the with the exact same command on linux, I get an executable and it depends only on msvcrt.dll (and comctl32.dll, comdlg32.dll, kernel32.dll, user32.dll and ws2_32.dll, obviously). If I modify the link line to instead link -lminizip.dll, I get the following errors /usr/lib/libpthread.a(t-d001060.o):fake:(.text+0x2): undefined reference to `__imp_pthread_getspecific' /usr/lib/libpthread.a(t-d001062.o):fake:(.text+0x2): undefined reference to `__imp_pthread_key_create' /usr/lib/libpthread.a(t-d001063.o):fake:(.text+0x2): undefined reference to `__imp_pthread_key_delete' /usr/lib/libpthread.a(t-d001065.o):fake:(.text+0x2): undefined reference to `__imp_pthread_mutex_destroy' /usr/lib/libpthread.a(t-d001067.o):fake:(.text+0x2): undefined reference to `__imp_pthread_mutex_init' /usr/lib/libpthread.a(t-d001068.o):fake:(.text+0x2): undefined reference to `__imp_pthread_mutex_lock' /usr/lib/libpthread.a(t-d001071.o):fake:(.text+0x2): undefined reference to `__imp_pthread_mutex_unlock' /usr/lib/libpthread.a(t-d001101.o):fake:(.text+0x2): undefined reference to `__imp_pthread_setspecific' collect2: error: ld returned 1 exit status Is there a proper way of getting the minizip lib statically-compiled? Thank you -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple