Re: OT: C programs and architectures (use on Fedora)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Mihai T. Lazarescu <mtlagm <at> gmail.com> writes:

> 
> On Sat, Nov 02, 2013 at 05:55:37PM -0500, Ranjan Maitra wrote:
> 
> > Hi,
> > 
> > I have obtained a set of open-source programs from 
> > 
> > http://petertoft.dk/PhD/Recon2D.tar.gz
> > 
> > uncompressed, etc, and it all goes through fine. 
> > 
> > When I compile, the programs work fine on my old 32-bit machine
> > (results make sense), however there is a segmentation fault on my
> > 64-bit laptop.
> > 
> > I compile using:
> > 
> > gcc -c -I../include -O3 -finline-functions -Winline -Wall
> > -falign-loops=2 -falign-jumps=2 -falign-functions=2
> > -Wstrict-prototypes .....
> > 
> > (Note that I had to fix the makefiles in there.) 
> > 
> > Btw, I don't know if this could have anything to do with it, but this
> > set of programs were written in 1996 (when 64-bit probably did not even
> > exist at all). Also, all the code uses single-precision (floats) rather
> > than my preferred doubles. (Which makes me ask: is it possible to go
> > into all the many files and convert all the floats into doubles using
> > some command? )
> 
> You can add -m32 to gcc arguments.
> 
> Mihai
I have to second Mihai's advice.  I'm currently doing some contract work
porting a rather large and very crufty C application from Solaris to Linux
for a national telecom.  The program actually was running under OS/2 at one
time and had it's roots on PrimOS.

We initially started out also going to 64 bit and had to backtrack.  See how
your program runs on the 64 bit box when compiled as a 32 bit application. 
Then decide whether to change the floats to longs first or to port it to 64
bit.  

The other advice on debugging is spot on.  Compile with -g and run it under
the debugger of your choice.  gdb works fine for this.

Cheers,
Dave



-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org




[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux