Page 1 of 1
Build 32 bit app from 64 bit development system
Posted: Fri Feb 06, 2015 6:18 pm
by BowCatShot
Howdy. Running codelite 6.1 on my 64 bit linux wheezy system. Need to create the app to run on a 32 bit system but cannot find anywhere in the ide how to set the -m32 g++ compiler switch. Any suggestions?
Re: Build 32 bit app from 64 bit development system
Posted: Fri Feb 06, 2015 6:43 pm
by eranif
Hi,
There are number of ways of achieving this, I will name some:
1. Open the project settings dialog -> common settings-> compiler and simply add "-m32" to the "compiler options" field
2. You can create a new compiler with this flag enabled:
* settings->build settings->compilers->add compilers->clone an existing compiler
* give the compiler a name + select the compiler to clone
* after the new compilers is added to the list of compilers, click it and select the "Tools" tab (the first tab on the left)
* in the "C compiler" and "C++ compilers" field simply append -m32 to the tool path
Eran
Re: Build 32 bit app from 64 bit development system
Posted: Fri Feb 06, 2015 8:26 pm
by BowCatShot
Outstanding, eranif, your method #1 worked great. Thank you.
Re: Build 32 bit app from 64 bit development system
Posted: Sat Feb 07, 2015 4:08 pm
by BowCatShot
This is a simple console application.
When I build from the command line using
g++ main.cpp -Wall -m32 -o interleave
everything works fine.
When I just compile the source from within codelite with the -m32 flag there are no errors.
However when I try to build with codelite I get a ton of errors.
My build window is:
/bin/sh -c '/usr/bin/make -j2 -e -f Makefile'
----------Building project:[ Interleave - Debug ]----------
make[1]: Entering directory `/home/nick/CODELITEProjects/Interleave'
/usr/bin/g++-4.7 -c "/home/nick/CODELITEProjects/Interleave/main.cpp" -g -O0 -Wall -m32 -o ./Debug/main.cpp.o -I //usr/include/glib-2.0/ -I /.
/usr/bin/g++-4.7 -o ./Debug/Interleave @"Interleave.txt" -L.
/usr/bin/ld: i386 architecture of input file `./Debug/main.cpp.o' is incompatible with i386:x86-64 output
./Debug/main.cpp.o: In function `loadmusicfolders()':
/home/nick/CODELITEProjects/Interleave/main.cpp:107: undefined reference to `std::string::find(char const*, unsigned int) const'
/home/nick/CODELITEProjects/Interleave/main.cpp:114: undefined reference to `std::string::assign(std::string const&, unsigned int, unsigned int)'
/home/nick/CODELITEProjects/Interleave/main.cpp:122: undefined reference to `operator new(unsigned int)'
/home/nick/CODELITEProjects/Interleave/main.cpp:161: undefined reference to `operator new(unsigned int)'
./Debug/main.cpp.o: In function `CreateInterleavedList()':
/home/nick/CODELITEProjects/Interleave/main.cpp:246: undefined reference to `operator new(unsigned int)'
./Debug/main.cpp.o: In function `__gnu_cxx::new_allocator<std::string>::allocate(unsigned int, void const*)':
/usr/include/c++/4.7/ext/new_allocator.h:94: undefined reference to `operator new(unsigned int)'
./Debug/main.cpp.o: In function `__gnu_cxx::new_allocator<ThisMusicFolder*>::allocate(unsigned int, void const*)':
/usr/include/c++/4.7/ext/new_allocator.h:94: undefined reference to `operator new(unsigned int)'
./Debug/main.cpp.o:/usr/include/c++/4.7/ext/new_allocator.h:94: more undefined references to `operator new(unsigned int)' follow
collect2: error: ld returned 1 exit status
make[1]: *** [Debug/Interleave] Error 1
make[1]: Leaving directory `/home/nick/CODELITEProjects/Interleave'
make: *** [All] Error 2
9 errors, 0 warnings
It builds just fine without the -m32 flag.
Here's some of the code:
typedef struct {
string FolderName;
vector<string> FilesInThisFolder;
} ThisMusicFolder;
string AMusicFile;
vector<string> AllMusicFiles;
string FolderName;
vector<ThisMusicFolder *> AllMusicFolders;
vector<ThisMusicFolder *>::iterator PointerToLargestFolderInAllMusicFolders;
vector<ThisMusicFolder *>::iterator Pos;
vector<ThisMusicFolder *>::iterator allPos;
vector<string>::iterator strPos;
vector<string>::iterator filesPos;
int endoffoldername;
endoffoldername = AMusicFile.find("/",0); //main.cpp:107
if (endoffoldername == -1) {
continue;
}
My codelite, now version 7.0, came from the debian linux repository.
Any ideas?
Re: Build 32 bit app from 64 bit development system
Posted: Sat Feb 07, 2015 5:05 pm
by eranif
Its not really related to codelite. You need to search your linker man page to see if you are missing some flags
Eran
Re: Build 32 bit app from 64 bit development system
Posted: Sat Feb 07, 2015 5:53 pm
by DavidGH
Hi,
Don't you need to pass -m32 to the linker too?
Regards,
David
Re: Build 32 bit app from 64 bit development system
Posted: Sat Feb 07, 2015 8:07 pm
by BowCatShot
Thank you DaviGH, you were exactly right. I was thrown off by the fact that the cli build worked without having to say anything to the linker, just g++ ... -m32.