From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by sourceware.org (Postfix) with ESMTPS id 729ED3858009 for ; Sat, 20 Mar 2021 21:07:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 729ED3858009 Received: by mail-wm1-x329.google.com with SMTP id j4-20020a05600c4104b029010c62bc1e20so7058249wmi.3 for ; Sat, 20 Mar 2021 14:07:08 -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:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=KGTRrUpe++/RLw3LfbvdugdCrOeVNYybbFhnJd9X2cc=; b=ZN5/Bs2HubeerkQUw8nQq3/RTN/0A3kXsam8xcR1ul/L7n31ipN3eIGpC+j1c2e/u3 SDc/NrDTRVAyNiMS7j0iJGNYtrAR11zUhXCTreoE5gmJbCBWhOHW/XEN7+qOaDX1iv4A qtUX4Ztpk3/LnmSiWOy/DsINCK1rEmU235yZvgB/VWjHtBK/fbWTDb9Gosk7MagjA51C I6GwULo1bmh71IdRmbbJQy30HSUZvSKV2FZn5nVkPInRrBmMoTupkw/pdUJ2QvO8z52H bvCa8ZwQePjhQ+DYEq2+wXKw3vrs4lnDTEykpEEhhChN6wfynLPu1or9JPGvHZDROcVk LJMg== X-Gm-Message-State: AOAM533PGekNtOae3raPNt3e7QLjXbilONM5l/SiEmV/8/M+F88/svP9 FfbeeMF4abLKwOGsV7BpZqo= X-Google-Smtp-Source: ABdhPJzRFW07J560TZTKKP2TCkfHT4AXTs416IlEo2yEA8uFHLKBq05cCLzOKW1vaO9tCMBlDTt8jg== X-Received: by 2002:a05:600c:198d:: with SMTP id t13mr9360440wmq.73.1616274427542; Sat, 20 Mar 2021 14:07:07 -0700 (PDT) Received: from [192.168.1.212] (host81-138-1-83.in-addr.btopenworld.com. [81.138.1.83]) by smtp.googlemail.com with ESMTPSA id i3sm15454603wra.66.2021.03.20.14.07.06 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 20 Mar 2021 14:07:06 -0700 (PDT) Content-Type: text/plain; charset=utf-8; delsp=yes; format=flowed Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: gfortran static linking under OS X (was: Re: ) From: Iain Sandoe In-Reply-To: Date: Sat, 20 Mar 2021 21:07:05 +0000 Cc: Fortran List Content-Transfer-Encoding: 8bit Message-Id: References: <73d99495-1edf-9c54-ad8d-5db0c5e0dafd@nber.org> <3CB88FD5-29C9-48B1-83B7-3E852A8D1029@googlemail.com> To: feenberg@nber.org X-Mailer: Apple Mail (2.3273) X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: fortran@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Fortran mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2021 21:07:09 -0000 Daniel Feenberg wrote: > On 3/19/21, Iain Sandoe wrote: > >>> On Fri, 19 Mar 2021, Tobias Burnus wrote: > >> you should be able to work around this without changing the compiler or >> rebuilding it, >> %rename lib liborig >> *lib: -lquadmath -lm %(libgcc) %(liborig) >> >> change the last line line to : >> >> *lib: %{!static-libgfortran: -lquadmath } %{static-libgfortran: >> libquadmath.a%s} %(libgcc) %(liborig) ^^ this line is presumably not broken in your file - i.e. this is a mailer phenomenon? >> === >> >> and try your link again > > Tried that, the error message is: > > ld: library not found for -lSystem Please could you either file a PR or send the output of /your complete command line/ with ‘-save-temps -v’ appended to me off-list. ---- For the record, this was not completely theoretical on my part; I actually tried this on a macOS 11.2.3 system with gcc-6.5 (which is the closest I have to what you’re using) …./gcc-6-5/bin/gfortran /source/test/fortran/hello.f -static-libgfortran -static-libgcc -o h $ otool -Lv h h: /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.60.1) time stamp 2 Thu Jan 1 01:00:02 1970 This ^^ is what I expect to see; libgfortran, libquadmath and libgcc have all been linked statically, leaving only the "/usr/lib/libSystem.B.dylib” which is fine and expected. > Indeed there is no libsystem.a anywhere on the computer. macOS does not allow the equivalent of a “completely statically linked” user-mode executable. Exes are always started by “dyld” (dynamic linker) and they always refer to libSystem.dylib. So you should never be needing to find a libSystem.a (there isn’t one, as you found). Nor do you need to care about it - since it’s available to all your end-users as part of their system (as are things like the Accelerate framework). > Any ideas? I am somewhat surprised that 6.3 behaves any differently from 6.5 - let’s investigate a little more. cheers Iain