Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 5 Sep 2015 09:21:32 -0453.75
From:      "William A. Mahaffey III" <wam@hiwaay.net>
To:        FreeBSD Questions !!!! <freebsd-questions@freebsd.org>
Subject:   Re: GCC question
Message-ID:  <55EAF922.2020906@hiwaay.net>
In-Reply-To: <55EAEE19.2060807@hiwaay.net>
References:  <55EAEE19.2060807@hiwaay.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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 <iostream>

#endif                  // __cplusplus

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#ifdef  __linux__
#include <malloc.h>
#else
#include <unistd.h>     // typedef uint :-) ....
#endif
#include <math.h>
#include <limits.h>
#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 <math.h>, 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.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?55EAF922.2020906>