Announcement

Collapse
No announcement yet.

Need Help With Makefile - Force 32Bit Compilation?

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Need Help With Makefile - Force 32Bit Compilation?

    Hi,

    I have a makefile to build my game on Linux.
    How would I modify the following makefile to force 32Bit compilation on 64Bit computers?

    Here is the makefile:
    Code:
    # LettersFall[TM] 4 - MAKEFILE by JeZ+Lee & mattmatteh...
    # (C)opyright 2012 By www.16BitSoft.com
    
    TARGET = lf4
    
    VERSION = 4.0
    
    DEL_FILE = rm -f
    
    CC      = g++
    CFLAGS = -pipe -Wall -g #-"ggdb"
    SDL_CFLAGS = $(shell sdl-config --cflags)
    SDL_LIBS = $(shell sdl-config --libs) 
    
    OPENGL_LIBS	= -lGL
    SDL_TTF_LIBS	= -lSDL_ttf
    SDL_IMAGE_LIBS	= -lSDL_image
    SDL_MIXER_LIBS  = -lSDL_mixer
    
    OBJECTS = src/main.o \
              src/audio.o \
              src/data.o \
              src/initialize.o \
              src/input.o \
              src/interface.o \
              src/logic.o \
              src/screens.o \
              src/settings.o \
              src/visuals.o
    
    SOURCES = src/main.cpp \
              src/audio.cpp \
              src/data.cpp \
              src/initialize.cpp \
              src/input.cpp \
              src/interface.cpp \
              src/logic.cpp \
              src/screens.cpp \
              src/settings.cpp \
              src/visuals.cpp
    
    HEADERS = src/audio.h \
              src/data.h \
              src/initialize.h \
              src/input.h \
              src/interface.h \
              src/logic.h \
              src/screens.h \
              src/settings.h \
              src/visuals.h
    
    $(TARGET): $(OBJECTS)
    	$(CC) $(OBJECTS) $(SDL_LIBS) $(OPENGL_LIBS) $(SDL_TTF_LIBS) $(SDL_IMAGE_LIBS) $(SDL_MIXER_LIBS) -o $@
    
    .cpp.o:
    	$(CC) $(CFLAGS) $(SDL_CFLAGS) -c $< -o $@
    
    clean:
    	rm $(OBJECTS) $(TARGET)
    Thanks!

    Jesse

    #2
    Hi,

    I did some research on compiling 32Bit application on 64Bit Kubuntu 14,04 LTS.
    I just needed to add: "-m32"(no quotes) to the "CFLAGS" line in the above makefile.

    Only problem now is the application won't compile in 32Bits and has errors below?

    Thanks!

    JeZxLee

    Code:
    jezxlee@jezxlee-B85M-HD3:~/Desktop/LF4_Linux_Beta4/LettersFall4-DEB$ make
    g++ -m32 -pipe -Wall -g  -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -c src/main.cpp -o src/main.o
    g++ -m32 -pipe -Wall -g  -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -c src/audio.cpp -o src/audio.o
    g++ -m32 -pipe -Wall -g  -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -c src/data.cpp -o src/data.o
    g++ -m32 -pipe -Wall -g  -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -c src/initialize.cpp -o src/initialize.o
    g++ -m32 -pipe -Wall -g  -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -c src/input.cpp -o src/input.o
    g++ -m32 -pipe -Wall -g  -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -c src/interface.cpp -o src/interface.o
    g++ -m32 -pipe -Wall -g  -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -c src/logic.cpp -o src/logic.o
    g++ -m32 -pipe -Wall -g  -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -c src/screens.cpp -o src/screens.o
    g++ -m32 -pipe -Wall -g  -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -c src/settings.cpp -o src/settings.o
    g++ -m32 -pipe -Wall -g  -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -c src/visuals.cpp -o src/visuals.o
    g++ src/main.o src/audio.o src/data.o src/initialize.o src/input.o src/interface.o src/logic.o src/screens.o src/settings.o src/visuals.o -L/usr/lib/x86_64-linux-gnu -lSDL  -lGL -lSDL_ttf -lSDL_image -lSDL_mixer -o lettersfall4
    /usr/bin/ld: i386 architecture of input file `src/main.o' is incompatible with i386:x86-64 output
    /usr/bin/ld: i386 architecture of input file `src/audio.o' is incompatible with i386:x86-64 output
    /usr/bin/ld: i386 architecture of input file `src/data.o' is incompatible with i386:x86-64 output
    /usr/bin/ld: i386 architecture of input file `src/initialize.o' is incompatible with i386:x86-64 output
    /usr/bin/ld: i386 architecture of input file `src/input.o' is incompatible with i386:x86-64 output
    /usr/bin/ld: i386 architecture of input file `src/interface.o' is incompatible with i386:x86-64 output
    /usr/bin/ld: i386 architecture of input file `src/logic.o' is incompatible with i386:x86-64 output
    /usr/bin/ld: i386 architecture of input file `src/screens.o' is incompatible with i386:x86-64 output
    /usr/bin/ld: i386 architecture of input file `src/settings.o' is incompatible with i386:x86-64 output
    /usr/bin/ld: i386 architecture of input file `src/visuals.o' is incompatible with i386:x86-64 output
    src/main.o: In function `main':
    /home/jezxlee/Desktop/LF4_Linux_Beta4/LettersFall4-DEB/src/main.cpp:57: undefined reference to `operator new(unsigned int)'
    /home/jezxlee/Desktop/LF4_Linux_Beta4/LettersFall4-DEB/src/main.cpp:60: undefined reference to `operator new(unsigned int)'
    /home/jezxlee/Desktop/LF4_Linux_Beta4/LettersFall4-DEB/src/main.cpp:62: undefined reference to `operator new(unsigned int)'
    /home/jezxlee/Desktop/LF4_Linux_Beta4/LettersFall4-DEB/src/main.cpp:67: undefined reference to `operator new(unsigned int)'
    /home/jezxlee/Desktop/LF4_Linux_Beta4/LettersFall4-DEB/src/main.cpp:69: undefined reference to `operator new(unsigned int)'
    src/main.o:/home/jezxlee/Desktop/LF4_Linux_Beta4/LettersFall4-DEB/src/main.cpp:71: more undefined references to `operator new(unsigned int)' follow                                                                             
    src/data.o: In function `Data::LoadHighScoresAndOptions()':                                                     
    /home/jezxlee/Desktop/LF4_Linux_Beta4/LettersFall4-DEB/src/data.cpp:203: undefined reference to `std::istream::getline(char*, int)'                                                                                             
    /home/jezxlee/Desktop/LF4_Linux_Beta4/LettersFall4-DEB/src/data.cpp:206: undefined reference to `std::istream::getline(char*, int)'                                                                                             
    /home/jezxlee/Desktop/LF4_Linux_Beta4/LettersFall4-DEB/src/data.cpp:209: undefined reference to `std::istream::getline(char*, int)'                                                                                             
    /home/jezxlee/Desktop/LF4_Linux_Beta4/LettersFall4-DEB/src/data.cpp:214: undefined reference to `std::istream::getline(char*, int)'
    /home/jezxlee/Desktop/LF4_Linux_Beta4/LettersFall4-DEB/src/data.cpp:217: undefined reference to `std::istream::getline(char*, int)'
    src/data.o:/home/jezxlee/Desktop/LF4_Linux_Beta4/LettersFall4-DEB/src/data.cpp:220: more undefined references to `std::istream::getline(char*, int)' follow
    src/screens.o: In function `Screens::DisplayTitleScreen()':
    /home/jezxlee/Desktop/LF4_Linux_Beta4/LettersFall4-DEB/src/screens.cpp:271: undefined reference to `operator new[](unsigned int)'
    src/settings.o: In function `Settings::Settings(int, char**)':
    /home/jezxlee/Desktop/LF4_Linux_Beta4/LettersFall4-DEB/src/settings.cpp:64: undefined reference to `operator new[](unsigned int)'
    /home/jezxlee/Desktop/LF4_Linux_Beta4/LettersFall4-DEB/src/settings.cpp:257: undefined reference to `operator new[](unsigned int)'
    /home/jezxlee/Desktop/LF4_Linux_Beta4/LettersFall4-DEB/src/settings.cpp:262: undefined reference to `operator new[](unsigned int)'
    /home/jezxlee/Desktop/LF4_Linux_Beta4/LettersFall4-DEB/src/settings.cpp:294: undefined reference to `operator new[](unsigned int)'
    src/settings.o:/home/jezxlee/Desktop/LF4_Linux_Beta4/LettersFall4-DEB/src/settings.cpp:300: more undefined references to `operator new[](unsigned int)' follow
    collect2: error: ld returned 1 exit status
    make: *** [lettersfall4] Error 1

    Comment

    Working...
    X