LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 10-29-2008, 02:34 PM   #1
MrUmunhum
Member
 
Registered: May 2006
Location: Mt Umunhum, CA, USA, Earth
Distribution: Debian/ Fedora/ Ubuntu/ Raspbian
Posts: 549

Rep: Reputation: 40
Program runs on developement PC but not others


Hi group,
I have this little misunderstanding. I have may programs developed
on my laptop that run just fine but when I try them on my other PCs,
they don't run. They all get 'Floating point exception' when started.
I don't understand why?? The laptop is running FC8 and the others are
running FC5. The makefile looks like this:
Code:
clear

CMD="gcc -g -I. -lpthread sema.c -o sema"
echo $CMD
$CMD
One source file is here:
http://64.124.13.3/_Examples_/Sema/sema.c

Thanks for your time.
 
Old 10-29-2008, 02:43 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,635

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by MrUmunhum View Post
Hi group,
I have this little misunderstanding. I have may programs developed
on my laptop that run just fine but when I try them on my other PCs,
they don't run. They all get 'Floating point exception' when started.
I don't understand why?? The laptop is running FC8 and the others are
running FC5. The makefile looks like this:
Code:
clear

CMD="gcc -g -I. -lpthread sema.c -o sema"
echo $CMD
$CMD
One source file is here:
http://64.124.13.3/_Examples_/Sema/sema.c

Thanks for your time.
Well, you're running two different versions of Linux, which also probably have two different versions of GCC, and all of the associated libraries. Your code is probably written to take advantage of the newer stuff on FC8, which isn't present on FC5.
 
Old 10-29-2008, 02:48 PM   #3
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Good practice is to enable all possible compiler diagnostics - it starts with -Wall with gcc.

I do not even start debugging my own programs until I eliminate all warnings, i.e. I consider all warnings to be errors.
 
Old 10-29-2008, 03:39 PM   #4
normscherer
Member
 
Registered: Sep 2005
Location: Prescott, AZ
Distribution: Ubuntu Mate 18 LTS
Posts: 50

Rep: Reputation: 15
Not real experienced with Linux programmming but on Solaris etc. we used static linking to avoid this type of problem. As long as the system calls did not change (I don't know if that is true) a staticly linked program should work because it will take all of its libraries with it.
 
Old 10-29-2008, 05:18 PM   #5
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
As I sidenote, valgrind says:
Code:
=3545== Memcheck, a memory error detector.
==3545== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
==3545== Using LibVEX rev 1804, a library for dynamic binary translation.
==3545== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
==3545== Using valgrind-3.3.0-Debian, a dynamic binary instrumentation framework.
==3545== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.
==3545== For more details, rerun with: -v
==3545==
# sema: Version 1.1, Copyright: Mt-Umunhum-Wireless.net
#       Oct 30 2008 00:35:23
==3545== Syscall param semctl(arg) points to uninitialised byte(s)
==3545==    at 0x41245A9: semctl (in /lib/libc-2.7.so)
==3545==    by 0x8048B1C: main (sema.c:55)
==3545==  Address 0xbeaa4998 is on thread 1's stack
00:35:44.3869 Main thread
00:35:44.9326 Starting sub1 at +10+0
00:35:45.1047 Starting sub2 at +20+0
00:35:45.4658 Starting sub3 at +30+0
sh: xterm: command not found
00:35:45.5133 Sub3 Lock: 4
00:35:45.7692 Starting sub2 at +40+0
sh: xterm: command not found
00:35:45.7759 Sub3 Lock: 4
sh: xterm: command not found
00:35:45.8950 Sub3 Lock: 4
00:35:45.8968 Main exit
sh: xterm: command not found
00:35:45.9759 Sub3 Lock: 4
00:35:45.9780 Thread 1 exit
00:35:45.9849 Thread 2 exit
00:35:45.9940 Thread 3 exit
00:35:46.0819 SemCTL RMID: 0
00:35:46.1005 Exiting sema
==3545==
==3545== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 13 from 1)
==3545== malloc/free: in use at exit: 413 bytes in 4 blocks.
==3545== malloc/free: 14 allocs, 10 frees, 1,953 bytes allocated.
==3545== For counts of detected errors, rerun with: -v
==3545== searching for pointers to 4 not-freed blocks.
==3545== checked 25,193,232 bytes.
==3545==
==3545== LEAK SUMMARY:
==3545==    definitely lost: 0 bytes in 0 blocks.
==3545==      possibly lost: 408 bytes in 3 blocks.
==3545==    still reachable: 5 bytes in 1 blocks.
==3545==         suppressed: 0 bytes in 0 blocks.
==3545== Rerun with --leak-check=full to see details of leaked memory.
The problem doesn't seem relevant to the problem, but may be worth checking.

Do you simply move the executable between the machines or compile on every machine? Also, do the architectures differ (for instance amd64 and i586)?
 
Old 10-30-2008, 02:09 PM   #6
MrUmunhum
Member
 
Registered: May 2006
Location: Mt Umunhum, CA, USA, Earth
Distribution: Debian/ Fedora/ Ubuntu/ Raspbian
Posts: 549

Original Poster
Rep: Reputation: 40
Quote:
Originally Posted by Mara View Post
As I sidenote, valgrind says:

Do you simply move the executable between the machines or compile on every machine? Also, do the architectures differ (for instance amd64 and i586)?
The programs are simply SCPed to the other PCs. The other PCs in question are Soekris 4801, 266 Pentium and a brand X 1.2 I686 Pentium.

This happens with every program I compile on my laptop ( Fujitsu Lifebook 1.8 Pentium 4 ). I am using:
$ gcc -v
Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --with-cpu=generic --host=i386-redhat-linux
Thread model: posix
gcc version 4.1.2 20070925 (Red Hat 4.1.2-33)
I tried to use the '-static' option but that produced more errors
at the compile.
I'm sure it is something simple that I am missing.

Thanks for your time.
 
Old 10-30-2008, 02:28 PM   #7
normscherer
Member
 
Registered: Sep 2005
Location: Prescott, AZ
Distribution: Ubuntu Mate 18 LTS
Posts: 50

Rep: Reputation: 15
If the other systems have differernt versions of the libraries (and you indicated that they do) and you do not static link it or otherwise provide the libraries it is very unlikely it will ever work

You can waste as much time as you want but if the libraries are changed in an incompatable manner you are SOL.
 
Old 10-31-2008, 02:23 PM   #8
MrUmunhum
Member
 
Registered: May 2006
Location: Mt Umunhum, CA, USA, Earth
Distribution: Debian/ Fedora/ Ubuntu/ Raspbian
Posts: 549

Original Poster
Rep: Reputation: 40
Quote:
Originally Posted by normscherer View Post
If the other systems have differernt versions of the libraries (and you indicated that they do) and you do not static link it or otherwise provide the libraries it is very unlikely it will ever work

You can waste as much time as you want but if the libraries are changed in an incompatable manner you are SOL.
I have also tried the simple "Hello world" programs with the same effect.
I don't think libstdio change that much?
 
Old 10-31-2008, 07:56 PM   #9
MrUmunhum
Member
 
Registered: May 2006
Location: Mt Umunhum, CA, USA, Earth
Distribution: Debian/ Fedora/ Ubuntu/ Raspbian
Posts: 549

Original Poster
Rep: Reputation: 40
Fixed it!

Well, it was not me!

I spent 6 hours and installed GCC from source. It now works OK.
Just another broken part of Fedora!
 
  


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
How can I tell and change what user runs what program? flycast Linux - Newbie 2 12-12-2006 10:06 PM
Program runs on Win32 platform, but not on Linux. duffmckagan Programming 16 01-03-2006 02:06 PM
program only runs as root mjkramer Linux - Newbie 5 11-22-2004 10:32 AM
Program runs when a user logs in mindstormsguy Linux - Software 2 03-31-2004 05:01 PM
Every OpenGL program runs VERY slow!!! adas Linux - General 6 10-10-2002 06:05 PM

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

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