From owner-freebsd-ports@freebsd.org Mon Oct 16 09:39:59 2017 Return-Path: Delivered-To: freebsd-ports@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2923DE34B42 for ; Mon, 16 Oct 2017 09:39:59 +0000 (UTC) (envelope-from tijl@freebsd.org) Received: from mailrelay111.isp.belgacom.be (mailrelay111.isp.belgacom.be [195.238.20.138]) (using TLSv1.2 with cipher RC4-SHA (128/128 bits)) (Client CN "relay.skynet.be", Issuer "GlobalSign Organization Validation CA - SHA256 - G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9CBF274BDE for ; Mon, 16 Oct 2017 09:39:57 +0000 (UTC) (envelope-from tijl@freebsd.org) X-Belgacom-Dynamic: yes IronPort-PHdr: =?us-ascii?q?9a23=3AFN+CXRUrsIEe6R+pfB8RW+71wWDV8LGtZVwlr6E/?= =?us-ascii?q?grcLSJyIuqrYYx2Bt8tkgFKBZ4jH8fUM07OQ6PGwHzRYqb+681k6OKRWUBEEjc?= =?us-ascii?q?hE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i764jEdAAjwOhRo?= =?us-ascii?q?LerpBIHSk9631+ev8JHPfglEnjSwbLdxIRmssQndqtQdjJd/JKo21hbHuGZDdf?= =?us-ascii?q?5MxWNvK1KTnhL86dm18ZV+7SleuO8v+tBZX6nicKs2UbJXDDI9M2Ao/8LrrgXM?= =?us-ascii?q?TRGO5nQHTGoblAdDDhXf4xH7WpfxtTb6tvZ41SKHM8D6Uaw4VDK/5KpwVhTmlD?= =?us-ascii?q?kIOCI48GHPi8x/kqRboA66pxdix4LYeZyZOOZicq/Ye94RWGhPUdtLVyFZDI2y?= =?us-ascii?q?b5UBAfcCM+laoYnyqEcBoxSlCAmwBu7j1iNEimPq0aEk1ekqDAHI3BYnH9ILqH?= =?us-ascii?q?nastT1NKUWUeuo0qTIyjLDb+hI1jf48ofIdAshquyLULJscMrRy00vGhjFgFWK?= =?us-ascii?q?t4PqIS6Y2PkDvWSB6OpgT+2vhnchpgpsrDavwcIshZPIhoIT0l3E+z95z5grKt?= =?us-ascii?q?KjU050fMSoEJxKtyGVMYZ9X8AsQ3lwtSs51rEKo4C3cDQXxJg9yBPSZeaLfouJ?= =?us-ascii?q?7x/lSe2fOy13hGh/d7K6nxuy9E+gxfDiWcSsy1ZKqzZFksHLtnAQyxzf8siHRe?= =?us-ascii?q?V5/kemwTuP1Brc6uVFIUAxi6XbMZkhzqQslpoSs0TDGjX6l1nxjK+RbUUr5O2o?= =?us-ascii?q?5P7hYrX9vJOcMJV0ig7mPqQvnMywH/g4PxANUmSH4+iwyqHv8VDjTLhFgPA6iK?= =?us-ascii?q?rUvZHCKcQevKG5AgtV0og56xa4CjeryMgYnXgFLFJBYx+HgZLpNE/QL//jFvew?= =?us-ascii?q?nk6gkDBxx/DJJrHhGInCLmDfkLf9erZw809RyQotwt9F/ZJUDbUBL+/oV0/+sd?= =?us-ascii?q?zXFB45Mwiuz+n7D9V909BWZWXaLauUOuvqtkeP+Kp7ffiBbZUSvDrVJP0s5vqo?= =?us-ascii?q?hng8zwwzZ66siKcWanTwNfNhOEicaHz3yoMdEGUOliQkQeHAs3HEViRcMSXhF5?= =?us-ascii?q?kg7y02Xdr1RbzIQZqg1fnYhH+2?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A2DkBgC1feRZ/1YryVBdGwEBAQMBAQEJA?= =?us-ascii?q?QEBFgEBAQMBAQEJAQEBgzRUEG4njw2OOwEBgXUvAYgVj34phRwChFVEFAEBAQE?= =?us-ascii?q?BAQEBAQEBaiiCOCQBgkABAQEDATocIwULCw4KCSUPEhgeBhOKBQMNDAysOIc8D?= =?us-ascii?q?YNoAQEBAQEBAQMBAQEBAQEigy2FQoMqgl6IGwWhDDyHX4gThGx/gX+QJY0DiiU?= =?us-ascii?q?2IYFZVTIIgy0JhFg+NopVAQEB?= X-IPAS-Result: =?us-ascii?q?A2DkBgC1feRZ/1YryVBdGwEBAQMBAQEJAQEBFgEBAQMBAQE?= =?us-ascii?q?JAQEBgzRUEG4njw2OOwEBgXUvAYgVj34phRwChFVEFAEBAQEBAQEBAQEBaiiCO?= =?us-ascii?q?CQBgkABAQEDATocIwULCw4KCSUPEhgeBhOKBQMNDAysOIc8DYNoAQEBAQEBAQM?= =?us-ascii?q?BAQEBAQEigy2FQoMqgl6IGwWhDDyHX4gThGx/gX+QJY0DiiU2IYFZVTIIgy0Jh?= =?us-ascii?q?Fg+NopVAQEB?= Received: from 86.43-201-80.adsl-dyn.isp.belgacom.be (HELO kalimero.tijl.coosemans.org) ([80.201.43.86]) by relay.skynet.be with ESMTP; 16 Oct 2017 11:39:55 +0200 Received: from kalimero.tijl.coosemans.org (kalimero.tijl.coosemans.org [127.0.0.1]) by kalimero.tijl.coosemans.org (8.15.2/8.15.2) with ESMTP id v9G9dseN017798; Mon, 16 Oct 2017 11:39:55 +0200 (CEST) (envelope-from tijl@FreeBSD.org) Date: Mon, 16 Oct 2017 11:39:54 +0200 From: Tijl Coosemans To: Gleb Popov <6yearold@gmail.com> Cc: FreeBSD ports list Subject: Re: Using blaslapack Message-ID: <20171016113954.4a5bb6dd@kalimero.tijl.coosemans.org> In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Oct 2017 09:39:59 -0000 On Mon, 16 Oct 2017 09:20:26 +0300 Gleb Popov <6yearold@gmail.com> wrote: > I'm porting an application (DLib, https://reviews.freebsd.org/D12559) that > uses BLAS and LAPACK, and I have some questions. > > 1. Is there any pure C implementation that does not require Fortran > compiler? Probably not, BLAS and LAPACK are Fortran libraries. Any implementation in C still provides Fortran wrappers. And often these implementations only implement performance critical functions and use the original Fortran for everything else. > 2. My application looks for cblas_ddot function in BLAS library, but the > default library (netlib) doesn't seem to have that. It has ddot, though, so > I'm not sure if it is a wrong check on app's side, or netlib is indeed > doesn't suit there. For now I've used openblas, but I'm also not sure if it > is a right choice. It's part of CBLAS which is also included in OpenBLAS. > 3. How to link properly to any of BLAS libraries? All BLAS implementations > blaslapack.mk features require Fortran. This implies USE_GCC=yes, so these > are compiled with GCC, not Clang. Now when I try to link Clang-compiled > DLib to GCC-compiled openblas, I get undefined references: > > //usr/local/lib/gcc6/libgfortran.so.3: undefined reference to > `__getf2@GCC_4.6.0' > //usr/local/lib/gcc6/libgfortran.so.3: undefined reference to > `__floatunditf@GCC_4.6.0' > //usr/local/lib/gcc6/libgfortran.so.3: undefined reference to > `__subtf3@GCC_4.6.0' > //usr/local/lib/gcc6/libgfortran.so.3: undefined reference to > `__multf3@GCC_4.6.0' > //usr/local/lib/gcc6/libgfortran.so.3: undefined reference to > `__unordtf2@GCC_4.6.0' > //usr/local/lib/gcc6/libgfortran.so.3: undefined reference to > `__lttf2@GCC_4.6.0' > //usr/local/lib/gcc6/libgfortran.so.3: undefined reference to > `__addtf3@GCC_4.6.0' > //usr/local/lib/gcc6/libgfortran.so.3: undefined reference to > `__gttf2@GCC_4.6.0' > //usr/local/lib/gcc6/libgfortran.so.3: undefined reference to > `__divtf3@GCC_4.6.0' > //usr/local/lib/gcc6/libgfortran.so.3: undefined reference to > `__letf2@GCC_4.6.0' > //usr/local/lib/gcc6/libgfortran.so.3: undefined reference to > `__netf2@GCC_4.6.0' > //usr/local/lib/gcc6/libgfortran.so.3: undefined reference to > `__floatditf@GCC_4.6.0' > //usr/local/lib/gcc6/libgfortran.so.3: undefined reference to > `__eqtf2@GCC_4.6.0' > //usr/local/lib/gcc6/libgfortran.so.3: undefined reference to > `__floatsitf@GCC_4.6.0' > > I've tracked these symbols to /usr/local/lib/gcc6/libgcc_s.so. But there is > also /usr/lib/libgcc_s.so and it doesn't have such symbols. I suspect this > is the source of the error, but I wasn't able to fix it. Passing -Wl,-rpath > as advised by lang/gcc6 pkg-message doesn't help. The only workaround I > came up with is USE_GCC=yes to compile DLib itself, but that's pretty > unsatisfactory. This is a known problem. If your port depends on another port that has USES=fortran the easiest is to add USES=fortran to your port as well. C code will still be built with Clang then.