visopsys.org
http://visopsys.org/forums/

Error when compiling Visopsys from source
http://visopsys.org/forums/viewtopic.php?f=3&t=218
Page 1 of 1

Author:  ap0r [ Mon Feb 10, 2014 9:33 pm ]
Post subject:  Error when compiling Visopsys from source

I tought maybe i was missing some components, but i hace everything that i need

Code:
ap0r@ap0r-vm:/bin$ sudo apt-get install nasm
[sudo] password for ap0r:
Reading package lists... Done
Building dependency tree       
Reading state information... Done
nasm is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
ap0r@ap0r-vm:/bin$ sudo apt-get install gcc
Reading package lists... Done
Building dependency tree       
Reading state information... Done
gcc is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
ap0r@ap0r-vm:/bin$ sudo apt-get install make
Reading package lists... Done
Building dependency tree       
Reading state information... Done
make is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
ap0r@ap0r-vm:/bin$


I got a fresh source code from the website, and tried to compile (my install was compiling fine earlier), and i get this error wich i have no idea as to why it happens... Any pointers?

Code:
ap0r@ap0r-vm:~/Desktop/visopsys/source$ make
mkdir -p build/system
cp COPYING.txt build/system/
mkdir -p build/system/locale
make -C dist
make[1]: Entering directory `/home/ap0r/Desktop/visopsys/source/dist'
mkdir -p ../build/
mkdir -p ../build//temp
make -C programs
make[2]: Entering directory `/home/ap0r/Desktop/visopsys/source/dist/programs'
mkdir -p ../../build/programs
make -C helpfiles
make[3]: Entering directory `/home/ap0r/Desktop/visopsys/source/dist/programs/helpfiles'
mkdir -p ../../../build/programs/helpfiles
cp *.txt ../../../build/programs/helpfiles
make[3]: Leaving directory `/home/ap0r/Desktop/visopsys/source/dist/programs/helpfiles'
make -C mines.dir
make[3]: Entering directory `/home/ap0r/Desktop/visopsys/source/dist/programs/mines.dir'
mkdir -p ../../../build/programs/mines.dir
cp *.bmp ../../../build/programs/mines.dir
make[3]: Leaving directory `/home/ap0r/Desktop/visopsys/source/dist/programs/mines.dir'
make -C snake.dir
make[3]: Entering directory `/home/ap0r/Desktop/visopsys/source/dist/programs/snake.dir'
mkdir -p ../../../build/programs/snake.dir
cp *.bmp ../../../build/programs/snake.dir
make[3]: Leaving directory `/home/ap0r/Desktop/visopsys/source/dist/programs/snake.dir'
make[2]: Leaving directory `/home/ap0r/Desktop/visopsys/source/dist/programs'
make -C system
make[2]: Entering directory `/home/ap0r/Desktop/visopsys/source/dist/system'
mkdir -p ../../build/system
cp *.jpg install-files.* password.blank ../../build/system
mkdir -p ../../build/system/config
cp config/*.conf ../../build/system/config
mkdir -p ../../build/system/icons
cp icons/*.bmp icons/*.ico ../../build/system/icons
mkdir -p ../../build/system/fonts
cp fonts/*.vbf ../../build/system/fonts
mkdir -p ../../build/system/keymaps
cp keymaps/*.map ../../build/system/keymaps
mkdir -p ../../build/system/mouse
cp mouse/*.bmp ../../build/system/mouse
mkdir -p ../../build/system/wallpaper
cp wallpaper/*.jpg ../../build/system/wallpaper
make[2]: Leaving directory `/home/ap0r/Desktop/visopsys/source/dist/system'
make[1]: Leaving directory `/home/ap0r/Desktop/visopsys/source/dist'
make -C utils
make[1]: Entering directory `/home/ap0r/Desktop/visopsys/source/utils'
gcc -Os -pipe -Wall -W -Wshadow -Wcast-align -Wsign-compare -Waggregate-return  -Wmissing-format-attribute -Wredundant-decls -Werror ../src/programs/copy-boot.c -o copy-boot
../src/programs/copy-boot.c: In function ‘main’:
../src/programs/copy-boot.c:536:4: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 2 has type ‘long unsigned int’ [-Werror=format=]
    sizeof(fatBSHeader));
    ^
../src/programs/copy-boot.c:543:4: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 2 has type ‘long unsigned int’ [-Werror=format=]
    sizeof(fat32BSHeader));
    ^
../src/programs/copy-boot.c:549:3: error: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Werror=format=]
   printf("fat32FsInfo size is %d instead of 512\n", sizeof(fat32FsInfo));
   ^
cc1: all warnings being treated as errors
make[1]: *** [copy-boot] Error 1
make[1]: Leaving directory `/home/ap0r/Desktop/visopsys/source/utils'
make: *** [all] Error 2
ap0r@ap0r-vm:~/Desktop/visopsys/source$

Author:  andymc [ Tue Feb 11, 2014 2:46 am ]
Post subject:  Re: Error when compiling Visopsys from source

Hmm, usually these new warnings pop up when someone's using a newer version of gcc.

You can prevent them from stopping the build by removing the -Werr option from the makefiles (I prefer not to allow warnings to go unfixed, but I'm fussy).

You can probably solve these particular warnings by changing the %02x ones on lines 536 and 543 to %02lx, and the %d one on line 549 to %lu

Author:  ap0r [ Tue Feb 11, 2014 2:38 pm ]
Post subject:  Re: Error when compiling Visopsys from source

One step forward! (Ti the next error anyways) :P

So, i fixed the source as per instructed above, but Nasm doesn't like these new files? I'm waaay in over my head right now... Learning! yay!

Code:
ap0r@ap0r-vm:~/Desktop/visopsys/source$ make
mkdir -p build/system
cp COPYING.txt build/system/
mkdir -p build/system/locale
make -C dist
make[1]: Entering directory `/home/ap0r/Desktop/visopsys/source/dist'
mkdir -p ../build/
mkdir -p ../build//temp
make -C programs
make[2]: Entering directory `/home/ap0r/Desktop/visopsys/source/dist/programs'
mkdir -p ../../build/programs
make -C helpfiles
make[3]: Entering directory `/home/ap0r/Desktop/visopsys/source/dist/programs/helpfiles'
mkdir -p ../../../build/programs/helpfiles
cp *.txt ../../../build/programs/helpfiles
make[3]: Leaving directory `/home/ap0r/Desktop/visopsys/source/dist/programs/helpfiles'
make -C mines.dir
make[3]: Entering directory `/home/ap0r/Desktop/visopsys/source/dist/programs/mines.dir'
mkdir -p ../../../build/programs/mines.dir
cp *.bmp ../../../build/programs/mines.dir
make[3]: Leaving directory `/home/ap0r/Desktop/visopsys/source/dist/programs/mines.dir'
make -C snake.dir
make[3]: Entering directory `/home/ap0r/Desktop/visopsys/source/dist/programs/snake.dir'
mkdir -p ../../../build/programs/snake.dir
cp *.bmp ../../../build/programs/snake.dir
make[3]: Leaving directory `/home/ap0r/Desktop/visopsys/source/dist/programs/snake.dir'
make[2]: Leaving directory `/home/ap0r/Desktop/visopsys/source/dist/programs'
make -C system
make[2]: Entering directory `/home/ap0r/Desktop/visopsys/source/dist/system'
mkdir -p ../../build/system
cp *.jpg install-files.* password.blank ../../build/system
mkdir -p ../../build/system/config
cp config/*.conf ../../build/system/config
mkdir -p ../../build/system/icons
cp icons/*.bmp icons/*.ico ../../build/system/icons
mkdir -p ../../build/system/fonts
cp fonts/*.vbf ../../build/system/fonts
mkdir -p ../../build/system/keymaps
cp keymaps/*.map ../../build/system/keymaps
mkdir -p ../../build/system/mouse
cp mouse/*.bmp ../../build/system/mouse
mkdir -p ../../build/system/wallpaper
cp wallpaper/*.jpg ../../build/system/wallpaper
make[2]: Leaving directory `/home/ap0r/Desktop/visopsys/source/dist/system'
make[1]: Leaving directory `/home/ap0r/Desktop/visopsys/source/dist'
make -C utils
make[1]: Entering directory `/home/ap0r/Desktop/visopsys/source/utils'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/ap0r/Desktop/visopsys/source/utils'
make -C src
make[1]: Entering directory `/home/ap0r/Desktop/visopsys/source/src'
mkdir -p ../build
make -C osloader
make[2]: Entering directory `/home/ap0r/Desktop/visopsys/source/src/osloader'
mkdir -p obj ../../build/system/boot ../../build
gcc -nodefaultlibs -nostartfiles -Os -Wl,-warn-common,-X,--oformat,binary,-e,loaderMain,-Ttext,0x00000000 obj/loaderMain.o obj/loaderA20.o obj/loaderVideo.o obj/loaderDetectHardware.o obj/loaderLoadFile.o obj/loaderLoadKernel.o obj/loaderDiskError.o obj/loaderPrintRoutines.o -o ../../build/vloader
/usr/bin/ld: i386 architecture of input file `obj/loaderMain.o' is incompatible with i386:x86-64 output
/usr/bin/ld: i386 architecture of input file `obj/loaderA20.o' is incompatible with i386:x86-64 output
/usr/bin/ld: i386 architecture of input file `obj/loaderVideo.o' is incompatible with i386:x86-64 output
/usr/bin/ld: i386 architecture of input file `obj/loaderDetectHardware.o' is incompatible with i386:x86-64 output
/usr/bin/ld: i386 architecture of input file `obj/loaderLoadFile.o' is incompatible with i386:x86-64 output
/usr/bin/ld: i386 architecture of input file `obj/loaderLoadKernel.o' is incompatible with i386:x86-64 output
/usr/bin/ld: i386 architecture of input file `obj/loaderDiskError.o' is incompatible with i386:x86-64 output
/usr/bin/ld: i386 architecture of input file `obj/loaderPrintRoutines.o' is incompatible with i386:x86-64 output
obj/loaderMain.o: In function `loaderMain':
loaderMain.s:(.text+0x1f): relocation truncated to fit: R_386_16 against `.data'
loaderMain.s:(.text+0x24): relocation truncated to fit: R_386_16 against `BOOTSECTSIG'
loaderMain.s:(.text+0x28): relocation truncated to fit: R_386_16 against `.data'
loaderMain.s:(.text+0x36): relocation truncated to fit: R_386_16 against `PARTENTRY'
obj/loaderMain.o: In function `loaderMain.notHDD':
loaderMain.s:(.text+0x45): relocation truncated to fit: R_386_16 against `.data'
loaderMain.s:(.text+0x50): relocation truncated to fit: R_386_16 against `.data'
loaderMain.s:(.text+0x65): relocation truncated to fit: R_386_16 against `.data'
loaderMain.s:(.text+0x6e): relocation truncated to fit: R_386_16 against `.data'
loaderMain.s:(.text+0x72): relocation truncated to fit: R_386_16 against `.data'
obj/loaderMain.o: In function `loaderMain.noPrint1':
loaderMain.s:(.text+0x84): relocation truncated to fit: R_386_16 against `.data'
loaderMain.s:(.text+0x98): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
make[2]: *** [../../build/vloader] Error 1
make[2]: Leaving directory `/home/ap0r/Desktop/visopsys/source/src/osloader'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/ap0r/Desktop/visopsys/source/src'
make: *** [all] Error 2
ap0r@ap0r-vm:~/Desktop/visopsys/source$

Author:  andymc [ Tue Feb 11, 2014 4:57 pm ]
Post subject:  Re: Error when compiling Visopsys from source

Ahh, I considered last night that maybe you were getting those other warnings because you're on a 64-bit system :think:. I don't see those because my dev system is 32-bit.

It looks as though your linker, ld, is expecting to link 64-bit .o files, but NASM is (correctly) producing 32-bit ones. I think you should be able to tell the linker (via gcc) to produce 32-bit output by doing adding the following argument in the makefiles:
Code:
-m,elf_i386
so link arguments passed via gcc - in this case - would look like:
Code:
-Wl,-warn-common,-X,--oformat,binary,-e,loaderMain,-Ttext,0x00000000,-m,elf_i386

Can you let us know whether that helps?

Author:  ap0r [ Tue Feb 11, 2014 8:57 pm ]
Post subject:  Re: Error when compiling Visopsys from source

Yup, it seems i accidentaly downloaded a 64 bit iso for my linux :oops:

Code:
ap0r@ap0r-vm:~$ uname -a
Linux ap0r-vm 3.11.0-15-generic #25-Ubuntu SMP Thu Jan 30 17:22:01 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux


Downloading 32 bit version as we speak :D

Author:  ap0r [ Wed Feb 12, 2014 2:21 am ]
Post subject:  Re: Error when compiling Visopsys from source

32 bit solved it :D

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/