M-HT / SR

A project to statically recompile following games to create Windows or Linux (x86 or arm) versions of the games - Albion, X-Com: UFO Defense (UFO: Enemy Unknown), X-Com: Terror from the Deep, Warcraft: Orcs & Humans, Septerra Core: Legacy of the Creator, Battle Isle 3: Shadow of the Emperor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

build issue on Pi4

Exarkuniv opened this issue · comments

i was following the post from the other user on how to build Septerra Core.
when i get to the step with
In directory SR/SRW-games/Septerra Core/SRW run command ./build-llasm.sh

i get this
Traceback (most recent call last): File "./compact_source_llasm.py", line 58, in <module> Compact(cPath + "seg01_data.llinc") File "./compact_source_llasm.py", line 8, in Compact fIn = open(cFile, "rt") IOError: [Errno 2] No such file or directory: './seg01_data.llinc' rm: cannot remove 'Septerra.resdump': No such file or directory

so i looked to see what versions i was running and it was the same as his
``
LLVM (http://llvm.org/):
LLVM version 7.0.1

Optimized build.
Default target: armv6k-unknown-linux-gnueabihf
Host CPU: cortex-a72
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)" NAME="Raspbian GNU/Linux" VERSION_ID="10" VERSION="10 (buster)" VERSION_CODENAME=buster ID=raspbian ID_LIKE=debian HOME_URL="http://www.raspbian.org/" SUPPORT_URL="http://www.raspbian.org/RaspbianForums" BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

so i did the update for LLVM but i get this

pi@retropie:~/SR/games/Septerra Core/SR-Septerra $ PATH=home/pi/clang+llvm-9.0.1-armv7a-linux-gnueabihf/bin:$PATH:../../../llasm scons
scons: Reading SConscript files ...

You didn't set any target device (parameter 'device').
'arm-linux-llasm' will be used for compiling.

scons: done reading SConscript files.
scons: Building targets ...
gcc -o SR-Septerra -Wl,-z,noexecstack -no-pie -s CLIB.o Game-Config.o Game-DataFiles.o Game-Main.o Game-Registry.o Game-SoundEngine.o MSS.o QTML.o WinApi-ddraw.o WinApi-dsound.o WinApi-gdi32.o WinApi-kernel32.o WinApi-user32.o WinApi-winmm.o WinApi.o X86_FS_mem.o llasm/CLIB-asm-llasm.o llasm/asm-cpu.o llasm/asm-llasm.o llasm/llasm_divide.o llasm/llasm_float.o llasm/llasm_fs_mem.o llasm/llasm_movs.o llasm/llasm_pushx.o llasm/llasm_scas.o llasm/llasm_stos.o llasm/printf_x86.o llasm/CLIB-asm.o llasm/Game-DataFiles-asm.o llasm/Game-Registry-asm.o llasm/Game-SoundEngine-asm.o llasm/MSS-asm.o llasm/QTML-asm.o llasm/WinApi-ddraw-asm.o llasm/WinApi-dsound-asm.o llasm/WinApi-gdi32-asm.o llasm/WinApi-kernel32-asm.o llasm/WinApi-user32-asm.o llasm/WinApi-winmm-asm.o -lSDL2 -lpthread -lm -lmpg123 -lquicktime
/usr/bin/ld: Game-Main.o: in function init_security_cookie': Game-Main.c:(.text+0x48): undefined reference to security_cookie_'
/usr/bin/ld: Game-SoundEngine.o: in function SE_timer_CB': Game-SoundEngine.c:(.text+0xec): undefined reference to hWritePipe'
/usr/bin/ld: WinApi-ddraw.o: in function DirectDrawCreate_c': WinApi-ddraw.c:(.text+0x84): undefined reference to IDirectDrawVtbl_asm2c'
/usr/bin/ld: WinApi-ddraw.o: in function IDirectDraw_CreateSurface_c': WinApi-ddraw.c:(.text+0x4e0): undefined reference to IDirectDrawSurfaceVtbl_asm2c'
/usr/bin/ld: WinApi-dsound.o: in function DirectSoundCreate_c': WinApi-dsound.c:(.text+0x1e6c): undefined reference to IDirectSoundVtbl_asm2c'
/usr/bin/ld: WinApi-dsound.o: in function IDirectSound_CreateSoundBuffer_c': WinApi-dsound.c:(.text+0x2384): undefined reference to IDirectSoundBufferVtbl_asm2c'
/usr/bin/ld: llasm/asm-llasm.o: in function GetRecordName_asm': asm-llasm.c:(.text+0x20): undefined reference to c_GetRecordName_'
/usr/bin/ld: llasm/asm-llasm.o: in function MessageProc_asm': asm-llasm.c:(.text+0x94): undefined reference to c_MessageProc_c2asm'
/usr/bin/ld: llasm/asm-llasm.o: in function WinMain_asm': asm-llasm.c:(.text+0x108): undefined reference to c_WinMain_'
/usr/bin/ld: llasm/asm-llasm.o: in function RunWndProc_asm': asm-llasm.c:(.text+0x18c): undefined reference to c_RunWndProc_c2asm'
/usr/bin/ld: llasm/asm-llasm.o: in function run_thread_asm': asm-llasm.c:(.text+0x1d4): undefined reference to c_run_thread_c2asm'
collect2: error: ld returned 1 exit status
scons: *** [SR-Septerra] Error 1
scons: building terminated because of errors.

not sure whats going on there since from what i can see i have the same software are the he did in this post

commented

The first error:
Traceback (most recent call last): File "./compact_source_llasm.py", line 58, in <module> Compact(cPath + "seg01_data.llinc") File "./compact_source_llasm.py", line 8, in Compact fIn = open(cFile, "rt") IOError: [Errno 2] No such file or directory: './seg01_data.llinc' rm: cannot remove 'Septerra.resdump': No such file or directory
wasn't because of llvm, but because you didn't do the following steps:

  • Copy file Septerra104.exe (from Septerra Core) to directory SR/SRW-games/Septerra Core/SRW
  • Or if it doesn't exist copy file septerra.exe (version 1.04 from Septerra Core) to directory SR/SRW-games/Septerra Core/SRW and rename it to Septerra104.exe

and afterward you couldn't do the following step:

  • From directory SR/SRW-games/Septerra Core/SRW copy files Septerra.llasm, seg*.llinc to directory SR/games/Septerra Core/SR-Septerra/llasm

which is where the second error comes from.

I do have the exe in there but it might be the wrong version. I'll check what version. But I have a feeling that is my problem.

commented

If you don't have the correct version, you can download the patch (version 1.04) - just search for it.

im still getting this error.
pi@retropie:~/SR/SRW-games/Septerra Core/SRW $ ./build-llasm.sh Traceback (most recent call last): File "./compact_source_llasm.py", line 58, in <module> Compact(cPath + "seg01_data.llinc") File "./compact_source_llasm.py", line 8, in Compact fIn = open(cFile, "rt") IOError: [Errno 2] No such file or directory: './seg01_data.llinc' rm: cannot remove 'Septerra.resdump': No such file or directory

and that is with me finding the patch exe and using that file

commented

Instead of ./build-llasm.sh, can you run these commands (in the same directory - SR/SRW-games/Septerra Core/SRW) and post the output:

cp llasm/*.sci ./
./SRW.exe Septerra104.exe Septerra.llasm
rm *.sci

The output should be something like this:

Output type: LLasm version
esp dword aligned: yes
ebp dword aligned: no
2020-12-07 17:20:14.032: Loading EXE file...
Import Table (-> .idata Section):
Directory[1].VirtualAddress=0xa08fc
Directory[1].Size=160
Resource Table (-> .rsrc Section):
Directory[2].VirtualAddress=0xf3000
Directory[2].Size=11600
Debug (-> .debug Section):
Directory[6].VirtualAddress=0x95300
Directory[6].Size=28
IAT:
Directory[12].VirtualAddress=0x95000
Directory[12].Size=704

Relocations were stripped from file - need external relocations
name: .text (seg01)
VirtualSize: 603522
SizeOfRawData: 606208
VirtualAddress: 0x1000
PointerToRawData: 0x1000
Characteristics: 0x60000020
name: .rdata (seg02)
VirtualSize: 51252
SizeOfRawData: 53248
VirtualAddress: 0x95000
PointerToRawData: 0x95000
Characteristics: 0x40000040
name: .data (seg03)
VirtualSize: 328556
SizeOfRawData: 53248
VirtualAddress: 0xa2000
PointerToRawData: 0xa2000
Characteristics: 0xc0000040
name: .rsrc (seg04)
VirtualSize: 11600
SizeOfRawData: 12288
VirtualAddress: 0xf3000
PointerToRawData: 0xaf000
Characteristics: 0x40000040
splitting bss section from end of .data (seg03) to .bss (seg05)
	original section changed size from 328556 to 51176
	new section start=0x4ae800 and size=277356 and type=3
splitting section from start of .rdata (seg02) to .rdata (seg06)
	original section changed start from 0x495000 to 0x4952c0 and size from 51252 to 50548
	new section start=0x495000 and size=704 and type=4
splitting section (2) from end of .rdata (seg02) to .rdata (seg07)
	original section changed size from 50548 to 46652
	new section start=0x4a08fc and size=3896 and type=4
		Imported DLL: DDRAW.dll
		Imported DLL: WINMM.dll
		Imported DLL: DSOUND.dll
		Imported DLL: KERNEL32.dll
		Imported DLL: USER32.dll
		Imported DLL: GDI32.dll
		Imported DLL: ADVAPI32.dll
	Sections in file: 7
2020-12-07 17:20:14.051: Loading source code information...
	Loading fixup_interpret_as_code.sci...
	Loading displaced_labels.sci...
	Loading noret_procedures.sci...
	Loading external_procedures.sci...
	Loading global_aliases.sci...
	Loading ignored_areas.sci...
	Loading instruction_replacements.sci...
	Loading instruction_replacements_FPU.sci...
	Loading instruction_flags.sci...
2020-12-07 17:20:14.051: Initial disassembly...
2020-12-07 17:20:14.118: Applying fixup...
2020-12-07 17:20:14.136: Full disassembly...
2020-12-07 17:20:14.348: Writing output...
2020-12-07 17:20:14.386: Finishing...

well i do feel dumb. i needed to change the permissions on the 2 exes i copied. once i did that it worked fine till i get to this point.

That command In directory SR/games/Septerra Core/SR-Septerra run command PATH=$PATH:../../../llasm scons
gives me this error.

Stack dump:
0. Program arguments: llc -O=3 -filetype=obj

  1.  Running pass 'Function Pass Manager' on module '<stdin>'.
    
  2.  Running pass 'ARM Instruction Selection' on function '@loc_4012E2'
    

Segmentation fault
scons: *** [llasm/Septerra.o] Error 139
scons: building terminated because of errors.

so i ran what you told him i tryed to update to llvmorg-8.0.1

and i get this error
Stack dump:
0. Program arguments: llc -O=3 -filetype=obj

  1.  Running pass 'Function Pass Manager' on module '<stdin>'.
    
  2.  Running pass 'ARM Instruction Selection' on function '@loc_4012E2'
    

Segmentation fault
scons: *** [llasm/Septerra.o] Error 139
scons: building terminated because of errors.

which is the same error as before i tryed updating it. i think i might need to delete it all and start fresh but ill wait till you get back to me

commented

That looks like it's still running LLVM 7.0.1.
You must use the correct path to the new LLVM - in your case, the command is probably PATH=home/pi/clang+llvm-8.0.1-armv7a-linux-gnueabihf/bin:$PATH:../../../llasm scons

I just noticed, in the other topic that I said to download LLVM version 8.0.1, but I used version 9.0.1 in the PATH.

i have been trying that, and it keeps giving me the same error.

Stack dump:
0. Program arguments: llc -O=3 -filetype=obj

  1.  Running pass 'Function Pass Manager' on module '<stdin>'.
    
  2.  Running pass 'ARM Instruction Selection' on function '@loc_4012E2'
    

Segmentation fault
scons: *** [llasm/Septerra.o] Error 139
scons: building terminated because of errors.

i pasted what you just said for the path in the /SR/games/Septerra Core/SR-Septerra dir and still errors out

commented

Just to be sure - when you execute the command PATH=home/pi/clang+llvm-8.0.1-armv7a-linux-gnueabihf/bin:$PATH opt --version do you get LLVM version 8.0.1 ?

i get
LLVM (http://llvm.org/):
LLVM version 7.0.1

Optimized build.
Default target: armv6k-unknown-linux-gnueabihf
Host CPU: cortex-a72

even though i just redownloaded that file.
seems my system is stuck on 7.0.1 for some reason.

commented

I just noticed:
PATH=home/pi/... should be PATH=/home/pi/... - slash is missing at the beginning of the path.

ugh....really.
i did not think that the / mattered.
sorry for making such a noob mistake

yes adding the / it now comes up 8.0.1

ill give the update command a try again with the /

thanks for all your help. wish i knew more about linux so i could avoid such silly mistakes

yes that was the problem the whole time. i was not using / in the front.

once i did that everything worked just fine

thanks for all your help on an problem that could of been avoided from the start

hopeful this is the last problem

i have made it all the way to the end where im moving all the files
Copy file SR/games/Septerra Core/SR-Septerra/SR-Septerra to Septerra Core directory.

when i try this it gives me a error cuz the folder in the Septerra Core is named the same
inl ess im moving it into the the wrong dir.

`SR/games/Septerra Core`` is the dir im moving it into correct

commented

No, you're copying the file (SR-Septerra) to the directory where you have the Septerra Core game files.

yep i did figure it out in the end.

im all set now. thanks for all your help. and again im sorry since it was all avoidable