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:reply-to:subject:to:references:from:message-id :date:mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=j9WllDizU9TCwAyT hTfTlnWp8lbxNyrwsZw3UU4nIBD5imxOTGpEjJ806grz3cz/MVulMNYREhEIIkPt dkliQcdCHvjHKsiHT3D2cMEfhIhBGDwvy8dJVhiDTxNgdZAs7/GhIyuxYelFSme1 tgmgRfWC6aMle5Hp9VMi/IINcAM= 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:reply-to:subject:to:references:from:message-id :date:mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=WL8Qf6WOMMFLKxAXKBp3lZ DC0z4=; b=JtqIxjf4U3jIqlM+1jllVJ03abnrJYCMw40yUNbEIFywTti6TZ32wi w2aY896HoVvmArx4MTxAoF6+g3SqjNEZ8tkMN+R3QgpjyLlvQyfLHVmOD5AXo4TQ R+Dm2xJe37QewdBYNPh8bIvNa+qdWGBVSoB1pmbXqCqUwmazMeml4= 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-Spam-SWARE-Status: No, score=-3.4 required=5.0 tests=AWL,BAYES_00,KAM_SHORT,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 spammy=volunteers, retest, conforming, tip X-HELO: smtp-out-so.shaw.ca Reply-To: Brian DOT Inglis AT SystematicSw DOT ab DOT ca Subject: Re: linker fails with multiple definitions after inline thread_local var within class To: cygwin AT cygwin DOT com References: From: Brian Inglis Openpgp: preference=signencrypt Message-ID: <769583d7-b1d7-fbc3-15ec-d377163c9d7f@SystematicSw.ab.ca> Date: Fri, 15 Nov 2019 11:38:56 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes On 2019-11-15 00:55, Arthur Norman wrote: >> You appear to be running into a conflict with Cygwin managing Windows TLS, as >> Cygwin does its own messing around to support Unix/Linux/POSIX/g++ semantics for >> TLS and everything else under Windows. You should either use the supplied API, >> or write a Windows program that allows you to control TLS within Windows rules >> on what you can do with it. Otherwise you will have to get deep into the >> changeable and not directly supported underbelly of the Cygwin implementation. > > Than you for the prompt response, but while the motivation for my example > involved the Windows native TLS API the sample code that fails to link for me > does not touch that at all and tried to be generic C++ code. Where it > superficially appears that the cygwin TLS initialization code fails to pick up > the "inline" attribute that I believe it should inherit from the fact that the > TLS fields and methods that I use are inline and hence allowed to be > defined/declared multiple times. So does my sample code that fails breach the > C++ standard or is this a Cygwin limitation please? I notice that you are not independently compiling your source files and have no include guard in t.h. Could I suggest that you add the include guard to t.h and retest. If you still have an issue, try independently compiling your source files, then linking them as a separate step, to see if that works. You could also test reproducing the issue on another gcc platform, under a Unix VM, or a WSL Linux distro. You would have to check the C++17 standard, gcc docs, and/or mailing list, or bugzilla, to see if using that feature in that manner is supported, or if there are issues, limitations, or restrictions on doing so. It may be more useful to ask about such language/build interaction issues first on forums such as StackOverflow and/or language mailing lists, before posting here, as Cygwin and gcc are implemented in C++, so most issues are likely to have been noticed and fixed, but language/build issues are not often discussed, as all support is from volunteers, and language issues are off topic. There may be little response here unless someone has encountered the same issue using the same features. General points: Support by gcc of standards often lags; library feature support is dependent on libstdc++, newlib, and Cygwin winsup; and the Cygwin gcc release is a couple of versions behind the head/tip: https://gcc.gnu.org/projects/cxx-status.html#cxx17 https://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#status.iso.2017 Specifying the language standard -std=c++17 requires your sources to be strictly conforming, as it disables a lot of the GNU, POSIX, and Cygwin features and support that extend and relax the standards, sometimes with GNU rather than standard semantics, with issues, limitations, or restrictions, or may not yet be available. Features may not work, and may not issue a diagnostic, if that is not required, or just not yet implemented, perhaps dependent on support in binutils or other parts of the tool chain. -- Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada This email may be disturbing to some readers as it contains too much technical detail. Reader discretion is advised. -- 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