LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-15-2006, 04:00 PM   #1
smallfire
LQ Newbie
 
Registered: Jul 2006
Posts: 17

Rep: Reputation: 0
Warnings treated as errors(help)


Hi!

Compiler version: gcc (GCC) 4.1.0 20060304 (Red Hat 4.1.0-3)

I was trying to build libraries from source given by a module that I will hooked up to my host computer. The build process kept being terminated everytime warnings are being found.

How do I bypass the warnings and continue compiling? I really need to build this library to develope my program.

Thanks.
 
Old 07-15-2006, 04:10 PM   #2
xhi
Senior Member
 
Registered: Mar 2005
Location: USA::Pennsylvania
Distribution: Slackware
Posts: 1,065

Rep: Reputation: 45
the option -Werror makes warnings into errors.. check to see if the makefile your program is using is using this option..

maybe you should look into the errors.. if they have -Werror turned on then they are expecting no warnings..
 
Old 07-15-2006, 11:02 PM   #3
smallfire
LQ Newbie
 
Registered: Jul 2006
Posts: 17

Original Poster
Rep: Reputation: 0
How do I go around checking for the flag. Is there a command that I can use to disable that warning error flag? I typed in the -Wno-error command but it didn't work. Am I missing something here?
I checked the makefile. Nothing indicates that the Werror flag is set or anything of that sort.

I'm new at gcc. If you don't mind, can you please guide me through step by step?

Thank you for your time.
 
Old 07-15-2006, 11:35 PM   #4
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

"-Werror" is a guess on our part.

Please post the actual error message, and the corresponding "gcc" compile command. That will help us determine the actual problem, and the recommended solution.

Thanx in advance .. PSM
 
Old 07-16-2006, 12:00 AM   #5
smallfire
LQ Newbie
 
Registered: Jul 2006
Posts: 17

Original Poster
Rep: Reputation: 0
I managed to bypass each errors by debugging the codes but it gets messier and very troublesome.


Warnings that are treated as errors:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
cc1plus: warnings being treated as errors
aGarciaAgent/acpGarciaAgent.cpp: In member function ‘void acpGarciaAgent::doRead()’:
aGarciaAgent/acpGarciaAgent.cpp:535: warning: dereferencing type-punned pointer will break strict-aliasing rules
make[2]: *** [unix_aGarciaAgent_Data/i686/aRelease/acpGarciaAgent.op] Error 1
make[2]: Leaving directory `/root/Desktop/brainstem/aGarcia'
make[1]: *** [release] Error 2
make[1]: Leaving directory `/root/Desktop/brainstem/aGarcia'
make: *** [release] Error 2
+++++++++++++++++++++++++++++++++++++++++++++++++++++++


Next warning which is similar to previous one.

+++++++++++++++++++++++++++++++++++++++++++++++++++++++
cc1plus: warnings being treated as errors
../aCommon/acpPkgImport.cpp: In member function ‘acpPackageTag* acpPkgImport::getNamedTag(const char*)’:
../aCommon/acpPkgImport.cpp:167: warning: dereferencing type-punned pointer will break strict-aliasing rules
make[2]: *** [unix_aRobotPackager_Data/i686/aRelease/acpPkgImport.op] Error 1
make[2]: Leaving directory `/root/Desktop/brainstem/aRobot'
make[1]: *** [release] Error 2
make[1]: Leaving directory `/root/Desktop/brainstem/aRobot'
make: *** [release] Error 2
+++++++++++++++++++++++++++++++++++++++++++++++++++++++

Next warning:

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
cc1plus: warnings being treated as errors
aCommon/aConsole.c: In function ‘aErr aConsole_Initialize(aConsole*)’:
aCommon/aConsole.c:245: warning: ‘licenseErr’ may be used uninitialized in this function
make[2]: *** [unix_aConsole_Data/i686/aRelease/aConsole.o] Error 1
make[2]: Leaving directory `/root/Desktop/brainstem/aConsole'
make[1]: *** [release] Error 2
make[1]: Leaving directory `/root/Desktop/brainstem/aConsole'
make: *** [release] Error 2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


Again thank you for your time.
 
Old 07-16-2006, 01:49 AM   #6
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
OK - your output indicates that xhi's hunch about "-Werror" is absolutely correct:
Quote:
cc1plus: warnings being treated as errors
It also indicates that you don't just have *one* makefile: you have a whole bunch of them (one in each subdirectory). And quite probably some kind of "config" file in the root directory.

Soooo ....

I'd suggest the following:
1. See if you can "grep" for "-Werror" in any of your Makefiles, or some config file. Start at the root directory of your source tree.

When you find it, simply modify the file, run "make clean", and re-run "make all" to rebuild everything.

If that doesn't work, then:

2. See if you can grep for a "gcc", "gcc" or "CFLAGS" option in any of these makefiles.

If that still doesn't work:

3. It looks like the main page for the project you're trying to build is here:

http://www.easierrobotics.com/

You might be able to post your question to a discussion group there.

'Hope that helps .. PSM

Last edited by paulsm4; 07-16-2006 at 01:50 AM.
 
Old 07-16-2006, 02:34 AM   #7
smallfire
LQ Newbie
 
Registered: Jul 2006
Posts: 17

Original Poster
Rep: Reputation: 0
This is the only file I found that has CFLAGS

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

# makefile: host/aTEAvm/aCommon

ROOT = ../../

INCLUDES = \
-I. \
-I../aUnix \
-I../../aCommon \
-I ../../aIO/aCommon \
-I ../../aIO/aUnix \
-I ../../aStem/aCommon \
-I ../../aStem/aUnix \
-I ../../aSteep/aCommon \
-I ../../aTEAvm/aCommon

OBJECTDIR = ../unix_aTEAvm_Data

SOURCE = ../../aCommon/aAssert.c \
../../aCommon/aMemPool.c \
../../aCommon/aMemHandleDebug.c \
../../aCommon/aMemLeakDebug.c \
aSteepOpt.c \
aSteepOptInternal.c

CFLAGS = -Wall -DaUNIX -c -fPIC

# include the generic file for all object building
include $(ROOT)object_makefile


+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Do I replace
CFLAGS = -Wall -DaUNIX -c -fPIC
with
CFLAGS = -Wno-error -DaUNIX -c -fPIC
?

Thanks.

Last edited by smallfire; 07-16-2006 at 03:50 AM.
 
Old 07-16-2006, 12:36 PM   #8
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
No, smallfire - you still haven't found the place where "-Werror" is being set. "-Wall" isn't equivalent to "-Werror", and the source in question is for "C" modules, but your compiler errors are occurring on "C++" modules.

Try the forums on http://www.easierrobotics.com/

Or "grep" *everything* in your top-level directories for "Werror"
EXAMPLE:
Quote:
cd <<ROOT DIRECTORY>>
grep Werror * */* */*/* 2> /dev/null
 
Old 07-16-2006, 03:52 PM   #9
smallfire
LQ Newbie
 
Registered: Jul 2006
Posts: 17

Original Poster
Rep: Reputation: 0
Thank you, paulsm4, for being really patient with me.

I ran it. I didn't know Linux well enough to use that grep command line. Sorry about that. I was using the typical search for matching words through the whole directory. FYI, I tried the forum on http://www.easierrobotics.com/ but I haven't gotten any reply so far. I need this up and running asap. That is why I approach linuxquestions.org instead.

Now, these must be all the flags we are looking for.

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
[root@d-15-31 ~]# grep Werror * */* */*/* 2> /dev/null
Desktop/brainstem/make_library.Linux: @$(CC) -gfull -shared -Wall -Werror \
Desktop/brainstem/make_library.Linux: @$(CC) -shared -Wall -Werror \
Desktop/brainstem/make_program_cpp.LinuxBGCFLAGS := -include aUnix/unix_$(PROG NAME)_pfxd.h -Wall -Werror \
Desktop/brainstem/make_program_cpp.Linux:RELCFLAGS := -include aUnix/unix_$(PROG NAME)_pfx.h -Wall -Werror \
Desktop/brainstem/make_program_cpp.Linux: @$(CCP) -gfull -Wall -Werror -Wl ,-rpath ./ \
Desktop/brainstem/make_program_cpp.Linux: @$(CCP) -Wall -Werror -Wl,-rpath ./ \
Desktop/brainstem/make_program.LinuxBGCFLAGS := -include aUnix/unix_$(PROGNAME )_pfxd.h -Wall -Werror \
Desktop/brainstem/make_program.Linux:RELCFLAGS := -include aUnix/unix_$(PROGNAME )_pfx.h -Wall -Werror \
Desktop/brainstem/make_program.Linux: @$(CC) -g -Wall -Werror -Wl,-rpath ./ -L $(DBGOUTDIR) $(LIBRARIES) \
Desktop/brainstem/make_program.Linux: -Wall -Werror -Wl,-rpath ./ -L$(RE LOUTDIR) $(LIBRARIES) \

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
What do I do next? Modify all the @$(CC) to exclude -Werror? -Wno-error?


For example:
@$(CC) -gfull -shared -Wall -Werror
replaced by
@$(CC) -gfull -shared -Wall
?

or
@$(CC) -gfull -shared -Wall -Wno-error
?
++++++

I found some explanation/references regarding gcc commands etc but using the command correctly is another whole new story. Do you know of any good references? Or is it a learn-through-experience type of knowledge?

Again and again, thank you for your time.
 
Old 07-16-2006, 05:06 PM   #10
smallfire
LQ Newbie
 
Registered: Jul 2006
Posts: 17

Original Poster
Rep: Reputation: 0
Finally, it compiled smoothly. Thanks.
 
Old 07-16-2006, 10:58 PM   #11
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi, smallfire -

Sorry I wasn't able to be more help, but different packages often have (very!) different build procedures, so it can be difficult to give you the right advice.

Nevertheless, it sounds like you did exactly the right thing - and I'm glad it worked for you!

Congratulations - and good job!

Sincerely .. PSM
 
Old 07-16-2006, 11:09 PM   #12
xhi
Senior Member
 
Registered: Mar 2005
Location: USA::Pennsylvania
Distribution: Slackware
Posts: 1,065

Rep: Reputation: 45
Quote:
I found some explanation/references regarding gcc commands etc but using the command correctly is another whole new story. Do you know of any good references? Or is it a learn-through-experience type of knowledge?
there are a *lot* of options for gcc. some are used often and others are not. one way to see what are common options is to build as much as possible from source, and while it is building pay attention to the flags that are used to compile. then check out those options in the docs for gcc.. there is alot of docs at the gcc website..

and yes experience is a big part.. but again i would suggest building everything possible from source, not only will it enlighten you as to how things are built, but it will also teach you alot about your system and software in general..
 
Old 07-17-2006, 12:04 AM   #13
smallfire
LQ Newbie
 
Registered: Jul 2006
Posts: 17

Original Poster
Rep: Reputation: 0
Thanks again for all the guidance.
I have a great time learning!

+++++++++++++
I assume I can start developing my program now and compile via gcc -o outputfilename -I"PATH/to/the/include/files" inputfile.c

I need to enable permission for the serial port.
How do I do it?
I found /dev/ttyS0 (ttyS1) in other threads. I tried and it said "permission denied". Is there another flag that I need to set? I'm planning to write a makefile for compiling my programs. Should I be including the serial port permission in the makefile or is it a one time setting? I know that the serial port permission is disabled by default.
+++++++++++++

Last edited by smallfire; 07-17-2006 at 12:33 AM.
 
  


Reply



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
Warnings treated as errors smallfire Fedora 4 07-17-2006 12:08 AM
Turn off "Warnings treated as errors" lucky6969b Programming 2 03-15-2006 08:34 AM
Errors and warnings after logging out of KDE? Slovak Slackware 7 10-17-2005 04:56 AM
log warnings and errors - are these serious? bcal Fedora 3 02-12-2005 04:13 PM
Errors and warnings when I exit X cragwolf Slackware 5 09-01-2004 01:52 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:49 PM.

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