From owner-freebsd-questions@freebsd.org Tue Jul 14 23:52:48 2015 Return-Path: Delivered-To: freebsd-questions@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 0C04B9A1944 for ; Tue, 14 Jul 2015 23:52:48 +0000 (UTC) (envelope-from freebsd@pki2.com) Received: from btw.pki2.com (btw.pki2.com [IPv6:2001:470:a:6fd::2]) (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 CC8851925; Tue, 14 Jul 2015 23:52:47 +0000 (UTC) (envelope-from freebsd@pki2.com) Received: from localhost (localhost [IPv6:::1]) by btw.pki2.com (8.14.9/8.14.9) with ESMTP id t6ENqZMA018964; Tue, 14 Jul 2015 16:52:35 -0700 (PDT) (envelope-from freebsd@pki2.com) DMARC-Filter: OpenDMARC Filter v1.3.1 btw.pki2.com t6ENqZMA018964 Authentication-Results: btw.pki2.com; dmarc=none header.from=pki2.com DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=pki2.com; s=pki2; t=1436917955; bh=11gLMzwZr/9pbYIwFHhj3FN0mRgVkcLls1WZ9kSiJ+o=; h=Subject:From:To:Cc:Date:In-Reply-To:References; z=Subject:=20Re:=20What's=20the=20magic=20of=20linking=20against=20 iconv=20(clang/gcc5)?|From:=20Dennis=20Glatting=20|To:=20Tijl=20Coosemans=20|Cc:=20freebsd-quest ions@freebsd.org|Date:=20Tue,=2014=20Jul=202015=2016:52:35=20-0700 |In-Reply-To:=20<20150714200345.04354c5b@kalimero.tijl.coosemans.o rg>|References:=20<1436892029.68808.8.camel@pki2.com>=0D=0A=09=20< 20150714200345.04354c5b@kalimero.tijl.coosemans.org>; b=HWxyewqdSszImx/BktfqBcZ9R5WM+rGDDFJzU0OYpIu6Zpmad2+LbJs4pRJFPy0Cq zPnECqwkld59WrXfjYkwfPDqU8dFnZ+DKtXRUY3f/XmFt8BkCIIb7CU0WVfQ1Al+EI aT06pynj04cZQaXqM7y8pG2HZN1Y4IoWOY8efCRPyzMzDTQpskgt+NrB7NcKMvX2zX 23J14JSD0gpRQibuIGrHjE4MlaDMjane51kkpEMQqsRC9uX31mZZdkPBEPIzkW3iOP ADG9cy9Mhe3VnIwJ+A2jQdLDMZxZmBcW+/zC7lO4+YsgjrlWaeANbwKz8YWBnDzPFT 12+3Ae8KhD3Hg== Message-ID: <1436917955.52012.0.camel@pki2.com> Subject: Re: What's the magic of linking against iconv (clang/gcc5)? From: Dennis Glatting To: Tijl Coosemans Cc: freebsd-questions@freebsd.org Date: Tue, 14 Jul 2015 16:52:35 -0700 In-Reply-To: <20150714200345.04354c5b@kalimero.tijl.coosemans.org> References: <1436892029.68808.8.camel@pki2.com> <20150714200345.04354c5b@kalimero.tijl.coosemans.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.11 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-SoftwareMunitions-MailScanner-Information: Dennis Glatting X-SoftwareMunitions-MailScanner-ID: t6ENqZMA018964 X-SoftwareMunitions-MailScanner: Found to be clean X-MailScanner-From: freebsd@pki2.com X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Jul 2015 23:52:48 -0000 Thanks. I'll give it a shot. On Tue, 2015-07-14 at 20:03 +0200, Tijl Coosemans wrote: > On Tue, 14 Jul 2015 09:40:29 -0700 Dennis Glatting wrote: > > My system: > > > > root@Tasha# uname -a > > FreeBSD Tasha 10.2-BETA1 FreeBSD 10.2-BETA1 #0 r285434: Sun Jul 12 > > 16:57:18 PDT 2015 > > root@Tasha:/disk-2/obj/disk-1/src/sys/SMUNI-FreeBSD10-amd64 amd64 > > > > > > I have a very simple program: > > > > #include > > #include > > > > int > > main( void ) { > > > > iconv_t fd = 0; > > > > iconv_close( fd ); > > > > return 0; > > } > > > > > > If I compile with clang, I have no trouble: > > > > root@Tasha# cc foo.c > > root@Tasha# > > > > However, if I compiler with gcc5: > > > > root@Tasha# gcc5 foo.c > > /tmp//ccDHDghd.o: In function `main': > > foo.c:(.text+0x18): undefined reference to `libiconv_close' > > collect2: error: ld returned 1 exit status > > > > According to iconv(3), I should link against c yet I get the same error: > > > > root@Tasha# gcc5 foo.c -lc > > /tmp//ccsKwlf3.o: In function `main': > > foo.c:(.text+0x18): undefined reference to `libiconv_close' > > collect2: error: ld returned 1 exit status > > > > I'm confused why this doesn't work and have searched through the system > > libraries. (I have verbose output below). I /only/ have a problem with > > iconv. There is some difference between these compilers that I do not > > understand. > > > > Clue please. > > The lang/gcc* ports always compile with -I/usr/local/include, so they > end up including /usr/local/include/iconv.h which belongs to libiconv > while clang includes /usr/include/iconv.h. So with gcc you either > have to link with -liconv or compile with -DLIBICONV_PLUG which makes > /usr/local/include/iconv.h behave like /usr/include/iconv.h. > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"