X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:from:date:message-id:subject:to :content-type; q=dns; s=default; b=SM0uL09DAZulKBwb6DTVZiLOQBEIo hklM0Wc09kax09riK+UjF4ONriSvBEJ9D1eaDu8m31Ip9i/G2edB8yifUDyrtzmT xbindcXb3FAMzL0Z87/IiAF2196FuVLdXm+Qk/pK+W2IXsmnEjPQBqk3an2lERxq HiFhCK0d9pboyQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:from:date:message-id:subject:to :content-type; s=default; bh=i7r3k4R2GtSUAFfBDYw0qKIr0vA=; b=iSY 0SAK6pgRrLOF7L7ir6RdTEnHq9ct5UY5bqDgEImHL5Qx0QOpOFjHKinbmpgu98Hl b3NXwAEeTdn97mncviF7q1ayq4Tus93QcoYAn+R0rQdfYTpfr5zP3YAjysUVJidq MCweeJKI/WQwhdyObdlIkwT7hUsJwSLPpUa9Ego8= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com 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 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 From: J Date: Wed, 19 Jul 2017 11:07:42 -0400 Message-ID: Subject: Link error with static version of zlib? To: cygwin AT cygwin DOT com Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes 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