From owner-freebsd-questions@freebsd.org Sat Sep 5 14:16:05 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 EF3B89CAF52 for ; Sat, 5 Sep 2015 14:16:04 +0000 (UTC) (envelope-from wam@hiwaay.net) Received: from fly.hiwaay.net (fly.hiwaay.net [216.180.54.1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C0F839B9 for ; Sat, 5 Sep 2015 14:16:04 +0000 (UTC) (envelope-from wam@hiwaay.net) Received: from kabini1.local (dynamic-216-186-222-143.knology.net [216.186.222.143] (may be forged)) (authenticated bits=0) by fly.hiwaay.net (8.13.8/8.13.8/fly) with ESMTP id t85EG2Wg022780 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO) for ; Sat, 5 Sep 2015 09:16:03 -0500 Subject: Re: GCC question To: FreeBSD Questions !!!! References: <55EAEE19.2060807@hiwaay.net> From: "William A. Mahaffey III" Message-ID: <55EAF922.2020906@hiwaay.net> Date: Sat, 5 Sep 2015 09:21:32 -0453.75 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <55EAEE19.2060807@hiwaay.net> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit 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: Sat, 05 Sep 2015 14:16:05 -0000 On 09/05/15 08:33, William A. Mahaffey III wrote: > > > I have some code which was originally SGI native, then moved to Linux > (FC14 x86_64 & CentOS 5). I am now interested in getting it going > under FreeBSD 9.3R. Due to differences in system header file includes, > I need to tweek some of my app-specific header files. I have poked > around the (*COPIOUS* !!!!) GCC man page & I couldn't find (or missed) > either how to get it to regurgitate its default compiler-defines or a > tabulation of those defines, so I can use them to conditionally > include system headers in my own header files. Where is this info :-) > ? TIA & have a nice (long) weekend. > > To provide a bit of context: [wam@kabini1, TEST, 9:11:44am] 522 % wc -l ../include/stdc.h 724 ../include/stdc.h [wam@kabini1, TEST, 9:11:48am] 523 % head -24 ../include/stdc.h #ifndef _STD_C_H_ #define _STD_C_H_ #ifdef __cplusplus // some useful I/O coding for C++ .... using namespace std; // this is necessary to avoid "error: 'ostream' does not name a type" error :-/ .... #include #endif // __cplusplus #include #include #include #ifdef __linux__ #include #else #include // typedef uint :-) .... #endif #include #include #include "Epsilon.h" // defines *ALL* epsilons (EPS, EPS2, etc.) used by CAD .... #include "bits.h" [wam@kabini1, TEST, 9:11:50am] 524 % wc -l fpbl.c 320 fpbl.c [wam@kabini1, TEST, 9:11:53am] 525 % head -10 fpbl.c #include "stdc.h" #include "Precis.h" #undef SIZE #define SIZE 50 [wam@kabini1, TEST, 9:11:55am] 526 % gcc -o fpbl -I ../include/ fpbl.c /tmp//ccgFw6d7.o: In function `setupGrid': fpbl.c:(.text+0x21b): undefined reference to `pow' /tmp//ccgFw6d7.o: In function `initS': fpbl.c:(.text+0x32f): undefined reference to `log' /tmp//ccgFw6d7.o: In function `initUtau': fpbl.c:(.text+0x4e4): undefined reference to `log' /tmp//ccgFw6d7.o: In function `setupUz': fpbl.c:(.text+0x833): undefined reference to `log' /tmp//ccgFw6d7.o: In function `setupEP1': fpbl.c:(.text+0x95f): undefined reference to `pow' /tmp//ccgFw6d7.o: In function `main': fpbl.c:(.text+0xf8c): undefined reference to `log' fpbl.c:(.text+0xfee): undefined reference to `log' [wam@kabini1, TEST, 9:11:59am] 527 % i.e. my little test program includes 1 of my specific header files, which in turn includes , which defines pow, log, etc. Since gcc apparently only reports some random text location, I am having trouble figuring out WTF is going on here. I normnally compile this code on a CentOS 5 VM on another box using the Intel compiler suite, version: Intel(R) C Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 12.0.3.174 Build 20110309 Copyright (C) 1985-2011 Intel Corporation. All rights reserved. FOR NON-COMMERCIAL USE ONLY I haven't used GCC in years. I determined (some years back) that the Intel compiler produces noticably better code (executes 25 - 50% faster than GCC-compiled code, gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-54)) & is otherwise interoperable w/ GCC, so I have been using it ever since. BTW: [wam@kabini1, TEST, 9:15:45am] 527 % uname -a FreeBSD kabini1.local 9.3-RELEASE-p24 FreeBSD 9.3-RELEASE-p24 #0: Sat Aug 22 01:54:44 UTC 2015 root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64 [wam@kabini1, TEST, 9:17:36am] 528 % grep -i gcc /etc/LIST.installed.txt gcc-4.8.5 GNU Compiler Collection 4.8 gcc-ecj-4.5 Eclipse Java Compiler used to build GCC Java [wam@kabini1, TEST, 9:17:43am] 529 % Any clues appreciated :-). TIA & Have a nice weekend. -- William A. Mahaffey III ---------------------------------------------------------------------- "The M1 Garand is without doubt the finest implement of war ever devised by man." -- Gen. George S. Patton Jr.