From owner-freebsd-hackers@FreeBSD.ORG Wed Jun 10 01:15:42 2015 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A80E8C7B; Wed, 10 Jun 2015 01:15:42 +0000 (UTC) (envelope-from rcarter@pinyon.org) Received: from quine.pinyon.org (quine.pinyon.org [65.101.5.249]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8198A1FBA; Wed, 10 Jun 2015 01:15:42 +0000 (UTC) (envelope-from rcarter@pinyon.org) Received: by quine.pinyon.org (Postfix, from userid 122) id 824AB1602CD; Tue, 9 Jun 2015 18:15:41 -0700 (MST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on quine.pinyon.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=3.4.0 Received: from feyerabend.n1.pinyon.org (feyerabend.n1.pinyon.org [10.0.10.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by quine.pinyon.org (Postfix) with ESMTPSA id 0F455160166; Tue, 9 Jun 2015 18:15:39 -0700 (MST) Message-ID: <55778FBA.5010004@pinyon.org> Date: Tue, 09 Jun 2015 18:15:38 -0700 From: "Russell L. Carter" User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Daniel Eischen CC: freebsd-hackers@freebsd.org Subject: Re: umtx_lock and friends References: <55777108.5020206@pinyon.org> <55778A60.9090200@pinyon.org> In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jun 2015 01:15:42 -0000 On 06/09/15 18:03, Daniel Eischen wrote: > On Tue, 9 Jun 2015, Daniel Eischen wrote: > >> On Tue, 9 Jun 2015, Russell L. Carter wrote: >> >>> On FreeBSD 10-stable r283752 amd64, here is the compile line: >>> >>> /usr/bin/cc -O -Wall tester.cpp -o tester >>> /tmp/tester-b681b3.o: In function `main': >>> tester.cpp:(.text+0x35): undefined reference to `_umtx_lock(umtx*)' >>> tester.cpp:(.text+0x5c): undefined reference to `_umtx_unlock(umtx*)' >>> >>> Compilers don't matter, linking against libthr or libstdthreads >>> doesn't matter. >> >> Is cc doing something special because it thinks it is C++? >> I'm on 10-stable amd64 and that example (saved as tester.c) >> works just fine. Yep! That made me laugh. I generally test as c++ and I thought I would cut this one down to just c, but that extension matters to every c compiler I tried. Putting the standard extern "C" { ... } guards around #include cures this problem. Thanks! Russell > > Try: > > /usr/bin/cc -O -Wall -x c tester.cpp -o tester >