LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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 05-28-2015, 04:23 PM   #1
444ghost
LQ Newbie
 
Registered: May 2015
Posts: 13

Rep: Reputation: Disabled
What is the difference between 32bit library and 64 library?


Hello guys.

I'm using this library (downloaded at http://wavelet2d.sourceforge.net/). I found out that this library is only working on 32bit systems (http://www.linuxquestions.org/questi...ol-4175543660/).

Now I need to work with the library on a 64 system. I thought libraries are just a group of pure object codes so I honestly didn't expect to face this kind of problems.

If you could help me understand why this is and how I can make 64bit libraries from the same source codes that made the 32bit library (perhaps where I should more look into or something, I'm NOT asking you for 100% answers if I'm annoying you by any means), then that would be great.

I'd appreciate your help.

Thank you.
 
Old 05-28-2015, 04:53 PM   #2
yooy
Senior Member
 
Registered: Dec 2009
Posts: 1,387

Rep: Reputation: 173Reputation: 173
you run into compatility issue.. in future perhaps 64bit systems will have similar functionality as 32 bit sistems.

hope you are using latest packages.

if you can afford you can make 32bit installation to usb flash or disk, or if you are on ubuntu make usb key with unetbootin and leave some space for saved data..
 
1 members found this post helpful.
Old 05-28-2015, 05:01 PM   #3
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,561

Rep: Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127
The pre-compiled libraries in that download were compiled for 32-bit. If you want 64-bit libraries, you'll have to recompile the provided source code with a 64-bit compiler. See here:
http://www.adp-gmbh.ch/cpp/gcc/create_lib.html
 
1 members found this post helpful.
Old 05-28-2015, 05:19 PM   #4
444ghost
LQ Newbie
 
Registered: May 2015
Posts: 13

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by yooy View Post
you run into compatility issue.. in future perhaps 64bit systems will have similar functionality as 32 bit sistems.

hope you are using latest packages.

if you can afford you can make 32bit installation to usb flash or disk, or if you are on ubuntu make usb key with unetbootin and leave some space for saved data..
I'm also working on other VMs that are based on 64 bit. I'm trying to make one combined VM so working on 32 bit system won't really work for me. But just for the sake of its stability, I tried this out on a 32 bit system and it worked well. Thank you for the reply
 
Old 05-28-2015, 05:27 PM   #5
444ghost
LQ Newbie
 
Registered: May 2015
Posts: 13

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by suicidaleggroll View Post
The pre-compiled libraries in that download were compiled for 32-bit. If you want 64-bit libraries, you'll have to recompile the provided source code with a 64-bit compiler. See here:
http://www.adp-gmbh.ch/cpp/gcc/create_lib.html
Code:
g++ -Wall -c wavelet2s.cpp // compiling

ar rcs libwavelet2s.a wavelet2s.o // linking the wavelet object with the library

g++ -static wavedemo1.cpp -L. -lwavelet2s -o wavedemo1 // compiling
This is what I tried on my 64 bit system. I checked out your link but there is not much difference between that and my approach (correct me if I'm wrong). You said I need to recompile using 64 compiler and I found this link (http://stackoverflow.com/questions/1...64-bit-machine), I might try a couple of things in that link and see if I have more questions, thank you for the reply
 
Old 05-28-2015, 05:31 PM   #6
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,561

Rep: Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127
Quote:
Originally Posted by 444ghost View Post
Code:
g++ -Wall -c wavelet2s.cpp // compiling

ar rcs libwavelet2s.a wavelet2s.o // linking the wavelet object with the library

g++ -static wavedemo1.cpp -L. -lwavelet2s -o wavedemo1 // compiling
This is what I tried on my 64 bit system. I checked out your link but there is not much difference between that and my approach (correct me if I'm wrong).
Yes that seems fine

Quote:
Originally Posted by 444ghost View Post
You said I need to recompile using 64 compiler and I found this link (http://stackoverflow.com/questions/1...64-bit-machine), I might try a couple of things in that link and see if I have more questions, thank you for the reply
Since you're on a 64-bit system, gcc is your 64-bit compiler. No flags are needed to force it to build a 64-bit binary, that's the default.

On a 32-bit system, "gcc file.c" will build a 32-bit binary
On a 64-bit system, "gcc file.c" will build a 64-bit binary, while "gcc -m32 file.c" will build a 32-bit binary

32-bit systems can only run 32-bit code, 64-bit systems can run both 32 and 64-bit code (usually, there are a few exceptions but they're rare).

Last edited by suicidaleggroll; 05-28-2015 at 05:32 PM.
 
1 members found this post helpful.
Old 05-28-2015, 05:34 PM   #7
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,561

Rep: Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127
Quote:
Originally Posted by yooy View Post
you run into compatility issue.. in future perhaps 64bit systems will have similar functionality as 32 bit sistems.
Future? What future? If this was a necro-post from 2002 then maybe I'd agree with you. 64-bit Linux systems have had as much or more functionality than 32-bit Linux systems for nearly a decade.

Quote:
Originally Posted by yooy View Post
if you can afford you can make 32bit installation to usb flash or disk, or if you are on ubuntu make usb key with unetbootin and leave some space for saved data..
There is absolutely no need to set up a standalone 32-bit system on an external USB drive to build or run 32-bit code...especially not something that he can just recompile for his architecture.

Last edited by suicidaleggroll; 05-28-2015 at 05:35 PM.
 
1 members found this post helpful.
Old 05-28-2015, 05:42 PM   #8
444ghost
LQ Newbie
 
Registered: May 2015
Posts: 13

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by suicidaleggroll View Post
Yes that seems fine


Since you're on a 64-bit system, gcc is your 64-bit compiler. No flags are needed to force it to build a 64-bit binary, that's the default.

On a 32-bit system, "gcc file.c" will build a 32-bit binary
On a 64-bit system, "gcc file.c" will build a 64-bit binary, while "gcc -m32 file.c" will build a 32-bit binary

32-bit systems can only run 32-bit code, 64-bit systems can run both 32 and 64-bit code (usually, there are a few exceptions but they're rare).
It's weird that I ran the same g++/gcc compiler on a 64 system and gives me some errors, that wavelet library also needs to work with fftw library (http://www.fftw.org/), perhaps I also need to take a second look at that library (fftw) as well for being 32 bit or 64 bit compatible. I'm not at school right now but I'll try a few things more first in the morning tomorrow and see if I have more questions. Again, I'd appreciate your help/comments.
 
Old 05-28-2015, 05:46 PM   #9
SCSIraidGURU
Member
 
Registered: Oct 2014
Posts: 69

Rep: Reputation: Disabled
From a programming standpoint, I try to use only 32-bit libraries and 32-bit coding practices. I found 64-bit causes nothing but headaches. You can run 32-bit apps in 64-bit OS just fine. Most apps don't require more than 2 GB of RAM to run. My most complex C# code don't usually hit 200 MB of RAM. So the 2GB 32-bit limit for single apps never comes into play. I program in Microsoft Visual Studio for Windows and the Linux version. Both have x86 and 64bit modes for C# and VB. CAD and A/V apps like Photoshop can use more than 2GB of RAM for processing. Most games are 32-bit because they run on the GPU not the local RAM and CPU. I have seen more of my 64-bit code crash than the 32-bit code.
 
1 members found this post helpful.
Old 05-28-2015, 05:52 PM   #10
444ghost
LQ Newbie
 
Registered: May 2015
Posts: 13

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by SCSIraidGURU View Post
From a programming standpoint, I try to use only 32-bit libraries and 32-bit coding practices. I found 64-bit causes nothing but headaches. You can run 32-bit apps in 64-bit OS just fine. Most apps don't require more than 2 GB of RAM to run. My most complex C# code don't usually hit 200 MB of RAM. So the 2GB 32-bit limit for single apps never comes into play. I program in Microsoft Visual Studio for Windows and the Linux version. Both have x86 and 64bit modes for C# and VB. CAD and A/V apps like Photoshop can use more than 2GB of RAM for processing. Most games are 32-bit because they run on the GPU not the local RAM and CPU. I have seen more of my 64-bit code crash than the 32-bit code.
I suppose I can just make 32 bit executable files and copy those on 64 bit systems and run. I thought of this before and now you are reminding me again, I'll definitely try this out tomorrow. Thank you for the reply.
 
Old 05-28-2015, 05:57 PM   #11
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,561

Rep: Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127
Quote:
Originally Posted by SCSIraidGURU View Post
From a programming standpoint, I try to use only 32-bit libraries and 32-bit coding practices. I found 64-bit causes nothing but headaches. You can run 32-bit apps in 64-bit OS just fine. Most apps don't require more than 2 GB of RAM to run. My most complex C# code don't usually hit 200 MB of RAM. So the 2GB 32-bit limit for single apps never comes into play. I program in Microsoft Visual Studio for Windows and the Linux version. Both have x86 and 64bit modes for C# and VB. CAD and A/V apps like Photoshop can use more than 2GB of RAM for processing. Most games are 32-bit because they run on the GPU not the local RAM and CPU. I have seen more of my 64-bit code crash than the 32-bit code.
If your 64-bit code is crashing, then you're doing something wrong. I've seen people just assume that pointers are always 32-bits and they bounce back and forth between pointer and 32-bit ints like they're equivalent. This will work on 32-bit, it'll fail catastrophically on 64-bit.

32-bit code also runs slower on a 64-bit machine, sometimes significantly so. If you need to stick with 32-bit for compatibility with 32-bit systems that's fine, but doing it because your programs are crashing in 64-bit means you're really screwing up somewhere.

It's not always about RAM usage either. The standard 32-bit I/O libraries can't read or write files larger than 4 GB for example, even if you're never loading that much data into RAM at once.

Last edited by suicidaleggroll; 05-28-2015 at 06:02 PM.
 
1 members found this post helpful.
Old 05-28-2015, 06:00 PM   #12
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,561

Rep: Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127
Quote:
Originally Posted by 444ghost View Post
It's weird that I ran the same g++/gcc compiler on a 64 system and gives me some errors, that wavelet library also needs to work with fftw library (http://www.fftw.org/), perhaps I also need to take a second look at that library (fftw) as well for being 32 bit or 64 bit compatible. I'm not at school right now but I'll try a few things more first in the morning tomorrow and see if I have more questions. Again, I'd appreciate your help/comments.
It would help if you posted the errors. If you're referring to your previous thread, you were trying to build the example code in 64-bit while using the 32-bit wavelet library. That will clearly fail. If you recompile the library in 64-bit, and then build the example code in 64-bit, it should be fine.

It's not about "supporting" one architecture or another, you just need to match it up. If you want to build the example code in 64-bit, then you need to have the 64-bit version of all of the required libraries. If you want to build the example code in 32-bit, then you need to have the 32-bit version of all of the required libraries. That's all.

You should have the option to install the 32 or 64-bit (or both) version of fftw on your system. For example, here are the fftw package options on CentOS 7 (trimmed a bit for simplicity):
Code:
# yum list | grep fftw
fftw.i686                             3.3.3-8.el7              @base            
fftw.x86_64                           3.3.3-8.el7              @base            
fftw-devel.i686                       3.3.3-8.el7              @base            
fftw-devel.x86_64                     3.3.3-8.el7              @base            
fftw-static.i686                      3.3.3-8.el7              @base            
fftw-static.x86_64                    3.3.3-8.el7              @base
i686 is the 32-bit version, x86_64 is the 64-bit version, you just install the one(s) you need.

Last edited by suicidaleggroll; 05-28-2015 at 06:07 PM.
 
1 members found this post helpful.
Old 05-28-2015, 06:06 PM   #13
444ghost
LQ Newbie
 
Registered: May 2015
Posts: 13

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by suicidaleggroll View Post
It would help if you posted the errors. If you're referring to your previous thread, you were trying to build the example code in 64-bit while using the 32-bit wavelet library. That will clearly fail. If you recompile the library in 64-bit, and then build the example code in 64-bit, it should be fine. You should have the option to install the 32 or 64-bit (or both) version of fftw on your system, provided you're running a system that supports multilib (most do, some don't, at least not well).
I believe I tried to recompile the library on a 64 system (not referring to my previous thread), but I'll double-check and try to troubleshoot by myself a little bit more tomorrow and ask more questions if I seem to have one.
 
Old 05-28-2015, 06:27 PM   #14
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,561

Rep: Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127
Quote:
Originally Posted by 444ghost View Post
I believe I tried to recompile the library on a 64 system (not referring to my previous thread), but I'll double-check and try to troubleshoot by myself a little bit more tomorrow and ask more questions if I seem to have one.
Working fine for me. Here's what I did:

1) Change wavedemo1.cpp to use wavelet2s.h instead of wavelet2d.h

2) Go to the src/static directory

3) Rebuild the library in 64-bit:
g++ -static -c wavelet2s.cpp
ar rcs libwavelet2s64.a wavelet2s.o
cp libwavelet2s64.a ../../linuxstatic/

4) Go to the examples directory

5) 32-bit build command:
g++ -m32 -static -L../linuxstatic -I../linuxstatic wavedemo1.cpp -lwavelet2s -lfftw3 -o wavedemo1-32

6) 64-bit build command:
g++ -static -L../linuxstatic -I../linuxstatic wavedemo1.cpp -lwavelet2s64 -lfftw3 -o wavedemo1-64

Both wavedemo1-32 and wavedemo1-64 run without error. I'm not sure what the outputs mean, but recon.txt and diff.txt are identical between the 32 and 64-bit versions. dwtout.txt does differ, not sure if that's significant.
 
1 members found this post helpful.
Old 05-29-2015, 10:52 AM   #15
444ghost
LQ Newbie
 
Registered: May 2015
Posts: 13

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by suicidaleggroll View Post
Working fine for me. Here's what I did:

1) Change wavedemo1.cpp to use wavelet2s.h instead of wavelet2d.h

2) Go to the src/static directory

3) Rebuild the library in 64-bit:
g++ -static -c wavelet2s.cpp
ar rcs libwavelet2s64.a wavelet2s.o
cp libwavelet2s64.a ../../linuxstatic/

4) Go to the examples directory

5) 32-bit build command:
g++ -m32 -static -L../linuxstatic -I../linuxstatic wavedemo1.cpp -lwavelet2s -lfftw3 -o wavedemo1-32

6) 64-bit build command:
g++ -static -L../linuxstatic -I../linuxstatic wavedemo1.cpp -lwavelet2s64 -lfftw3 -o wavedemo1-64

Both wavedemo1-32 and wavedemo1-64 run without error. I'm not sure what the outputs mean, but recon.txt and diff.txt are identical between the 32 and 64-bit versions. dwtout.txt does differ, not sure if that's significant.
It worked really great! Thank you so much for helping me get a better understanding in this!
 
  


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
What's the difference between static and dynamically linked library... trist007 Linux - Newbie 5 09-19-2010 09:40 PM
How to force required 32bit library on spec file dimasfs Linux - Software 1 04-08-2010 06:54 PM
nvidia runs fine, now what about 32bit library? mlai023 Slackware 5 09-12-2009 06:35 AM
The difference between .a and .so library files Harry Seldon Linux - General 5 12-14-2007 10:11 PM
Using a 32bit library on a 64bit computer sniff Programming 1 07-04-2006 04:47 AM

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

All times are GMT -5. The time now is 01:41 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration