LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-13-2009, 12:33 PM   #1
mallas
LQ Newbie
 
Registered: Jan 2009
Posts: 3

Rep: Reputation: 0
trying to add fPIC as a flag for gcc


Hi,

I am installing a program which needs to be compiled as a 64bit package.
I got the following info from http://cblfs.cross-lfs.org/index.php/FFTW

CC="gcc ${BUILD64} -fPIC" CXX="g++ ${BUILD64} -fPIC" \
./configure --prefix=/usr --libdir=/usr/lib64 --enable-shared --enable-threads &&
make

So I want to add -fPIC to the gcc path. I don't know how though. And in the information above, what is ${BUILD64}?

Also, is CC= and CXX= supposed to be 2 separate command lines?

Only thing I know is when I type exactly that line:
CC="gcc ${BUILD64} -fPIC" CXX="g++ ${BUILD64} -fPIC" \

I get the following:
?
BUILD64: Undefined variable.

This might be super-easy? Haven't handled linux systems before...

Thanks /

Magnus
 
Old 01-13-2009, 02:41 PM   #2
weibullguy
ReliaFree Maintainer
 
Registered: Aug 2004
Location: Kalamazoo, Michigan
Distribution: Slackware 14.2
Posts: 2,815
Blog Entries: 1

Rep: Reputation: 261Reputation: 261Reputation: 261
BUILD64 is a set of CFLAGS and CXXFLAGS that are defined by the user. At a minimum on an x86_64 CLFS system, this will be the -m64 flag. You can define BUILD64 as an environment variable and use the CBLFS commands as written. For example,
Code:
export BUILD64="-m64 -pipe -mtune=athlon64 -O2 &&
CC="gcc ${BUILD64} -fPIC" CXX="g++ ${BUILD64} -fPIC" \
./configure --prefix=/usr --libdir=/usr/lib64 --enable-shared --enable-threads &&
make
The other option is to replace the BUILD64 with your desired flags. For example,
Code:
CC="gcc -m64 -pipe -mtune=athlon64 -O2 -fPIC" CXX="g++ -m64 -pipe -mtune=athlon64 -O2 -fPIC" \
./configure --prefix=/usr --libdir=/usr/lib64 --enable-shared --enable-threads &&
make
If the distro you're using is standards compliant, the --libdir=/usr/lib64 is correct. If you're not using a standards compliant distro, you may want to change or eliminate this configure option.

Last edited by weibullguy; 01-13-2009 at 02:44 PM.
 
Old 01-14-2009, 03:28 AM   #3
mallas
LQ Newbie
 
Registered: Jan 2009
Posts: 3

Original Poster
Rep: Reputation: 0
Invalid null command

Thanks, I think I understand how to launch it.

When I use those exakt lines:

CC="gcc -m64 -pipe -mtune=athlon64 -O2 -fPIC" CXX="g++ -m64 -pipe -mtune=athlon64 -O2 -fPIC" \
? ./configure --prefix=/usr --libdir=/usr/lib64 --enable-shared --enable-threads &&

I get:

Invalid null command & the configuration never starts!

And I don't know what's wrong?

Best regards /

Magnus

Last edited by mallas; 01-14-2009 at 03:59 AM.
 
Old 01-14-2009, 04:18 AM   #4
mallas
LQ Newbie
 
Registered: Jan 2009
Posts: 3

Original Poster
Rep: Reputation: 0
more info

Thanks,

I am using an Intel Core 2, can I use 'native' for the -mtune flag?

What are the -m64, -pipe & -02 flags doing?

If I launch the CC= command I get a question mark at the prompt & nothing happens.

If I launch as root, I get a > at the prompt and nothing happens.

Somehow this command is not triggering anything... or does it?

BTW, my makefile looks like this for the cc flags:

CC = cc
CCDEPMODE = depmode=gcc3
CFLAGS = -O3 -fomit-frame-pointer -fno-schedule-insns -fschedule-insns2 -fstrict-aliasing
CPP = cc -E
CPPFLAGS =

ie no CPPFLAGS...

Should these be the same as the CFLAGS?

Magnus

Last edited by mallas; 01-14-2009 at 04:25 AM.
 
Old 01-14-2009, 02:36 PM   #5
weibullguy
ReliaFree Maintainer
 
Registered: Aug 2004
Location: Kalamazoo, Michigan
Distribution: Slackware 14.2
Posts: 2,815
Blog Entries: 1

Rep: Reputation: 261Reputation: 261Reputation: 261
It is all one command. The backslash (\) is a line continuation character.

Yes you can use native for -mtune. Read the manual if you want to know what the options do.

When you get the >, it means you haven't completed the command. In this case, it is probably a missing " at the beginning or end of the CC or CXX part.

No, just leave the CPPFLAGS alone. Those are for the preprocessor and shouldn't need changed. If they do, you would likely already know what needs to be added.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Error recompile with fPIC, but fPIC is already as a compilation option eolmsan Linux - Software 4 12-03-2008 11:05 AM
How to add flag to inode i_flags and how to set it devkpict Linux - Kernel 3 12-06-2007 11:41 PM
about -fpic/-fPIC option for gcc George2 Programming 2 09-04-2006 01:38 AM
How to add C-Flag to configure script merlin23 Linux - Newbie 1 01-13-2005 08:03 AM
gcc -lGLU Flag Gives An Error Chryzmo Slackware 2 09-30-2004 09:22 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:24 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration