X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 915903857B98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1699026547; bh=MDHu2mEtRfr8kQHqWlnoCj79SltcSoQt9SvaTGNpjNg=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=ijdIWwtU7jFzMWFthYdWyJ8mNxIF6+AS9wTOg5mNZcA4aamSaEOo1FGvdleU6xdlF 0nfbA/vXTVRkMQ7UZLCfYl2OIPIby1xhaCItkSZUCBRawOrP5Xh4eHooIneunWoFLG gnJpBL/ckNMSxpts7iiEZBA3DM5vkZamfhIUr+rA= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DF8F23858D28 ARC-Filter: OpenARC Filter v1.0.0 sourceware.org DF8F23858D28 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699026533; cv=none; b=BPH3WH3M6HUhJeu4M+fKgP1eZ9r6Bat1km0gvT/6pIEf2bbPbri/J9OByfklcb9G9Dzg0rhaY03L6S/MucK1GPU9GSXTGpuOyegyynuWrn9t3/wbK84r2bffMWLbf56LGuklOW2cMS/ZdiPoNhAxkfokFrqSUzf5Abp6MNBNID0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699026533; c=relaxed/simple; bh=vU3ByIt4P824LJur2WSpmkQ0DhpuR/6dJwOb12LT88I=; h=Message-ID:Date:MIME-Version:Subject:To:From; b=LRFIDN1iFei+N2BSfOQal3TiLHb1eZ8JymGCdFr1HVVD4zLRyOk6ckAC/WnBIEdsdMg7TM4gqdspFHowScvd1QwKfDn9SCbG5ln1sboA1sduu3IX/5Y5OMzBo2gYSK0CJkfzGgjys7Mnb83GomL7c2tvfqudqXFEi6Zj7iEfWg4= ARC-Authentication-Results: i=1; server2.sourceware.org Message-ID: <1a8eae1e-12ff-4a0f-a01a-259f9cdb77bc@johannesthoma.com> Date: Fri, 3 Nov 2023 16:48:50 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Question on statically linking with cygwin To: cygwin AT cygwin DOT com References: <71e853b9-1b6c-4796-9488-b58f69c7de1e AT dronecode DOT org DOT uk> In-Reply-To: X-Provags-ID: V03:K1:Df5aPZE1m7TPoeM2e4qGYM3nRFRvFK1ELojDtwfu7WE/bSZ5SK+ pe3yNncACxdjfGpc5jlp9dpZbPsFE7SBbQJ4QAODifZwoQ4PVMyAw9R4H3HnMZG38wle+0W /qqL8fRVvjku2WETAQ0yOoUyl9yFF7ACp5QhUv8Bd2JK7E/1YRCF61Z60krKzB3FPRqnEb7 nRphWmjmF6TARbJ29mzcQ== UI-OutboundReport: notjunk:1;M01:P0:NQ4W7S1ksrI=;Y99KLE93XKuC3vfrmh96ql4lA4y vh1jw42nMjz0jTuCZSW42J4EpEJIZw9jVXDZk+P8e84bayzHj0a0mgmM4Hnot1jSAnunfnxbD ctR+d+mE0vRh5i7Ly+yqFyXqDYWv47kux11y1qwk5idSfTJDSJ3wBQXzFWS4QlWC/OH06R4Vq QllbJZuiiiaUnNzgq1Q4LwZvkesieDe5bwWGlbyiUv7qVKsDSCmUPiir7KDU75rS4wz9KXhWZ sTQPA4Y6L5zc3s4elEgXF7pCvn/PkuLya0sQisarrnBxzuEQBLF8Ht4r4wF21k+HMlIsAF0ro AEiHWyfOLsPyG+0Nili8+wBx9SLY7iNLBMExglyFjxR4LHOGyHETcIcCxugdvCU026a5wz+lz DIkoUBIbj9bu8GTR/CiWlRuU0XWrXLb5lIq3YYOtLl3h53icjP3TzLBarXRTo1+93o4Ngqut9 GYQ0vtOd/kFxH6M0ZyPRGGlnuRcPezavip7IDmlZSTT7w35hCjUvgsapumLr0zlknSyzCcG5l MLfHzj+kKRAeNGZIvNF0kB45ye1vmcReduFMY3yAkOITVARwQhZFIAf+Zg/9/sra97Dd/LfDK 8SjxH/l+HOofZmmLhbhJlu428Ow0+3Xeit1poVK4A49W0kNDXYOoRJcQ449JJHj3nIBd5wfjZ C4AEuArfexLLDwL+3P1yIa16u18oZAH6/W480zBFNA9txgFMD2txyg3J4s1h+EVMVvDFwtoBR Z41CfvLwpTEW8PdKZ24DMMHhTOoQW37RhBLF2FlQfEB4ZcLakn2bA4PfHLl9e9KjPaeoegNa4 GPXRfsgvODQviYZMFgnpWUKFAwT4Xwc/cg8wGcJIfYgveFjxXD4yI5gsrxEenBIvGeK71Qc75 bMx8AkVcn576KGQ== X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.30 List-Id: General Cygwin discussions and problem reports List-Archive: List-Post: List-Help: List-Subscribe: , From: Johannes Thoma via Cygwin Reply-To: Johannes Thoma Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "Cygwin" Hi, As I promised some updates below. Am 02.11.23 um 18:33 schrieb Johannes Thoma via Cygwin: >>>> [...] >>>> Interesting. >>>> But how (from a developers perspective) do you link cygwin1.dll >>>> statically into a binary? >>>> >>> I would build my own cygwin1.lib or cygwin1.a and statically link >>> against it. >> >> If you do work out how to do this, patches would be welcome... >> > You are right it is far from trivial. I am working on it, not > sure now if it will be possible or how long it takes (my main > project is WinDRBD, so unfortunately I cannot spend full time on > getting static linking work). Right now, I can compile cygwin on my own > and digged a little bit in the program startup code (lib subdir), > I will keep you updated once I go along. > I can link a simple hello world program (which uses write(2) to produce output to test the POSIX variant) with something like: LDFLAGS=-L. -lcygwin-static -lcygserver -lntdll -lkernel32 -lc -lg -lm -lgcc -static -nodefaultlibs and copiing the newlib libc, libm and other libraries from the build. The ntdll and kernel32 libs are from a mingw-w64 installation. the cygwin-static library contains every .o file in the winsup/cygwin build directory except: lib/libcmain.o and ctype.o (for now had to patch __set_ctype out of cygwin and take the newlib version, maybe I can fix that somehow). Right now it links and produces a (22 Megabytes) EXE binary, however it crashes in the thread_allocator C++ class (most likely because the matching constructor is not called before that) this will be the next thing to fix. Ok have a great weekend everybody and I will get back once I continue on the static linking feature. Best regards, - Johannes -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple