LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-28-2009, 10:20 AM   #1
acute123
LQ Newbie
 
Registered: Dec 2004
Posts: 22

Rep: Reputation: 15
Lightbulb Compilation Error


Hi Everyone

I am trying to compile a program on Debian Linux.
But when i try to do so i get the following error:

gcc -Wall -g -mcmodel=medium -c util.c
util.c:1: error: code model ‘medium’ not supported in the 32 bit mode
make: *** [util.o] Error 1


I changed to a different version of GCC 4.1(initially it was 4.4)
but the error remains the same.

Kindly guide me what to do.
Your help in highly appreciated.

Regards
 
Old 08-28-2009, 10:29 AM   #2
jstephens84
Senior Member
 
Registered: Sep 2004
Location: Nashville
Distribution: Manjaro, RHEL, CentOS
Posts: 2,098

Rep: Reputation: 102Reputation: 102
doesn't look like it is a problem with the gcc but with the option -mcmodel. Can you change it from medium to something else?
 
Old 08-28-2009, 10:36 AM   #3
acute123
LQ Newbie
 
Registered: Dec 2004
Posts: 22

Original Poster
Rep: Reputation: 15
Hi

Thank you for your early reply.

Actually i am compiling a software and when i run the "make all" command i get this error.

Can you pls tell me how to change from "medium" to something else.

Best Regards
 
Old 08-28-2009, 10:41 AM   #4
jstephens84
Senior Member
 
Registered: Sep 2004
Location: Nashville
Distribution: Manjaro, RHEL, CentOS
Posts: 2,098

Rep: Reputation: 102Reputation: 102
Ok look in the directory with the MAKEFILE and using vi

press / then type in mcmodel this should search the make file for the model. Hopefully it will have some instructions. Also when you did the ./configure if you use --help it should give you some options to use. Course you would use a ./configure if there is not makefile. (I believe this is correct, man it has been so long since I have had to compile software)
 
Old 08-28-2009, 12:50 PM   #5
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
*
Any chance, that you can tell,
which application, this is about ?
 
Old 09-02-2009, 06:44 AM   #6
acute123
LQ Newbie
 
Registered: Dec 2004
Posts: 22

Original Poster
Rep: Reputation: 15
Hi Everyone Thank you for all your help but the problem has not been solved completely so let me tell you the problem in detail.

I am trying to compile a program located at:
http://www.cs.princeton.edu/~minlanyu/embed.tar.gz

To compile it i have to execute the following commands:
1. make all (to compile)
2. ./embed (to run)

When i run the first command make all i get the following error:
rm -f *.o *~ embed
gcc -Wall -g -mcmodel=medium -c util.c
util.c:1: error: code model ‘medium’ not supported in the 32 bit mode
make: *** [util.o] Error 1

So what i did was that commented the -mcmodel=medium portion on a new line. After this when i run the command make all my output is as follows:
rm -f *.o *~ embed
gcc -Wall -g -c util.c
gcc -Wall -g -c embed.c
gcc -Wall -g -o embed util.o embed.o -lm

This creates an executable file embed

So now i write ./embed but now i get the following error:
Segmentation Fault


Is this error because i am running Linux in VMWare or there is any other reason?

Pls do reply early.
Your help is highly appreciated.

Best Regards
 
Old 09-02-2009, 09:40 AM   #7
jstephens84
Senior Member
 
Registered: Sep 2004
Location: Nashville
Distribution: Manjaro, RHEL, CentOS
Posts: 2,098

Rep: Reputation: 102Reputation: 102
I am downloading it now. However normally you should run make && make all. I can't recall ever seeing where you would only run make all.
 
Old 09-02-2009, 10:10 AM   #8
jstephens84
Senior Member
 
Registered: Sep 2004
Location: Nashville
Distribution: Manjaro, RHEL, CentOS
Posts: 2,098

Rep: Reputation: 102Reputation: 102
Ok I took a look at that file. Try uncommenting out the line from earlier and running
Code:
make && make all
you don't need ./configure because there is a makefile that exists
 
Old 09-02-2009, 12:28 PM   #9
acute123
LQ Newbie
 
Registered: Dec 2004
Posts: 22

Original Poster
Rep: Reputation: 15
Hi

Thank You for your early reply.

I again tried to compile a fresh version of that software(i mean in a new folder).

Below are the steps i performed and their results:

1. First i run

make && make all

Here is the output:

rm -f *.o *~ embed
gcc -Wall -g -mcmodel=medium -c util.c
util.c:1: error: code model ‘medium’ not supported in the 32 bit mode
make: *** [util.o] Error 1

Again the error is of medium. So i commented MakeFile like this:
// -mcmodel=medium

2. Now i run the command:
make && make all

Here is the output:

rm -f *.o *~ embed
gcc -Wall -g -c util.c
gcc -Wall -g -c embed.c
gcc -Wall -g -o embed util.o embed.o -lm
rm -f *.o *~ embed
gcc -Wall -g -c util.c
gcc -Wall -g -c embed.c
gcc -Wall -g -o embed util.o embed.o -lm

To me it means that program has compiled successfully as it has now generated an executable file "embed"

3. So i run:
./embed

But i get the same error:

Segmentation fault



Please reply early what should i do now.

Best Regards
 
Old 09-02-2009, 03:10 PM   #10
jstephens84
Senior Member
 
Registered: Sep 2004
Location: Nashville
Distribution: Manjaro, RHEL, CentOS
Posts: 2,098

Rep: Reputation: 102Reputation: 102
Quote:
Originally Posted by acute123 View Post
Hi

Thank You for your early reply.

I again tried to compile a fresh version of that software(i mean in a new folder).

Below are the steps i performed and their results:

1. First i run

make && make all

Here is the output:

rm -f *.o *~ embed
gcc -Wall -g -mcmodel=medium -c util.c
util.c:1: error: code model ‘medium’ not supported in the 32 bit mode
make: *** [util.o] Error 1

Again the error is of medium. So i commented MakeFile like this:
// -mcmodel=medium

2. Now i run the command:
make && make all

Here is the output:

rm -f *.o *~ embed
gcc -Wall -g -c util.c
gcc -Wall -g -c embed.c
gcc -Wall -g -o embed util.o embed.o -lm
rm -f *.o *~ embed
gcc -Wall -g -c util.c
gcc -Wall -g -c embed.c
gcc -Wall -g -o embed util.o embed.o -lm

To me it means that program has compiled successfully as it has now generated an executable file "embed"

3. So i run:
./embed

But i get the same error:

Segmentation fault



Please reply early what should i do now.

Best Regards
Do you know of anyone that has compiled and ran this software successfully. A segmentation fault is usually when an application tries to access a portion of memory it is not allowed to accesses or it attempts to write to a read only portion of memory.

Here is a quick example of what I picked off of wikipedia.

Code:
int main(){
     char *s = "hello world";
     *s = 'H';
 }
here you can see that H is trying to be illegally written to the read only section.


So in short you may have to try and find some helpful information by running a stack trace. for more information look here
 
  


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
unable to resolve compilation error;./List.c:5: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ amolgupta Programming 3 01-09-2009 10:09 AM
Inkscape compilation error: *** [extension/internal/pdfinput/pdf-parser.o] Error 1 w1k0 Slackware 12 10-25-2008 09:53 AM
compilation error : /tmp/cczC6Kc3.s:7368: Error: unknown pseudo-op: `.ltorg' nankie Red Hat 0 08-19-2008 10:15 AM
Error during the compilation of Prozilla. How to correct the recursive error? deepumnit Linux - Software 1 01-10-2008 11:02 AM
Kernel compilation error: Error 15: File not found Niceman2005 Linux - General 9 10-04-2007 03:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:30 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