Problem compiling OpenB3D

Started by Krischan, October 22, 2017, 16:15:51

Previous topic - Next topic

Krischan

Hi there,

I want to upgrade my BlitzMax installation (Windows 10 x64) to the current versions of BlitzMaxNG and OpenB3D but I'm totally stuck now. First I tried the complete install described here, and did the following but it didn't work. The install guide there is helpful but can be confusing in some parts, so I wrote every single step I did down:

01. Created a folder C:\Apps\BlitzMax
02. Created a folder C:\Apps\BlitzMax\MinGW
03. Downloaded tdm64-gcc-5.1.0-2.exe
04. installed it to C:\Apps\BlitzMax\MinGW
05. Downloaded blitzmax-master.zip
06. extracted it to C:\Apps\BlitzMax
07. executed install.bat within the C:\Apps\BlitzMax\_src\win32_x86 folder
08. copied the files from C:\Apps\BlitzMax\_src\win32_x86\bin to C:\Apps\BlitzMax\bin
09. renamed the C:\Apps\BlitzMax\mod folder to C:\Apps\BlitzMax\mod.old
10. downloaded brl.mod-master.zip and pub.mod-master.zip
11. created the folder C:\Apps\BlitzMax\mod
12. extracted both modules to C:\Apps\BlitzMax\mod
13. renamed brl.mod-master to brl.mod
14. renamed pub.mod-master to pub.mod
15. executed "bmk makemods -a -r" in C:\Apps\BlitzMax\bin
16. executed "bmk makemods -a -r -h" in C:\Apps\BlitzMax\bin
17. downloaded bmk-master.zip and bcc-master.zip
18. extracted both to C:\Apps\BlitzMax\src folder
19. renamed bmk-master to bmk-ng and bcc-master to bcc-ng in C:\Apps\BlitzMax\src
20. executed "bmk makeapp -a -r -h -t console ..\src\bmk-ng\bmk.bmx" from C:\Apps\BlitzMax\bin
21. executed "bmk makeapp -a -r -t console ..\src\bcc-ng\bcc.bmx" from C:\Apps\BlitzMax\bin
22. bmk -v in C:\Apps\BlitzMax\src\bmk-ng returns "bmk 3.18 mt-win32-x86 / gcc 050100 (cpu x8)"
23. bcc -v in C:\Apps\BlitzMax\src\bcc-ng returns "bcc[ng] Release Version 0.92"
24. downloaded bmx-ng-master.zip
25. created C:\Apps\BlitzMaxNG
26. extracted bmx-ng-master.zip to C:\Apps\BlitzMaxNG
27. copied C:\Apps\BlitzMax\bin to C:\Apps\BlitzMaxNG\bin
28. copied C:\Apps\BlitzMax\src\bcc-ng\bcc.exe to C:\Apps\BlitzMaxNG\bin
29. copied C:\Apps\BlitzMax\src\bmk-ng\bmk.exe to C:\Apps\BlitzMaxNG\bin
30. copied C:\Apps\BlitzMax\src\bmk-ng\core.bmk to C:\Apps\BlitzMaxNG\bin
31. copied C:\Apps\BlitzMax\src\bmk-ng\make.bmk to C:\Apps\BlitzMaxNG\bin
32. created C:\Apps\BlitzMaxNG\lib folder
33. created C:\Apps\BlitzMaxNG\mod folder
34. downloaded brl.mod-master.zip and pub.mod-master.zip
35. extracted both to C:\Apps\BlitzMaxNG\mod
36. renamed brl.mod-master to brl.mod and pub.mod-master to pub.mod
37. executed "bmk makemods -a -w -g x64" in C:\Apps\BlitzMaxNG\bin

Stops at [ 89%] Processing:freeprocess.bmx

Compile Error: Overriding method does not match any overridden method. (Detail: Return type is "Int", expected "Void". You may have Strict type overriding SuperStrict type.)
[c:/Apps/BlitzMaxNG/mod/pub.mod/freeprocess.mod/freeprocess.bmx;56;0]
Build Error: failed to compile (-1) c:/Apps/BlitzMaxNG/mod/pub.mod/freeprocess.mod/freeprocess.bmx




Then I tried the Release version of BlitzMaxNG and mark's latest OpenB3D version from here, but it failed too:

01. Created a folder C:\Apps\BlitzMax
02. downloaded BlitzMax_win32_0.87.3.16.7z
03. extracted to C:\Apps\BlitzMax
04. renamed C:\Apps\BlitzMax\MinGW32 to renamed C:\Apps\BlitzMax\MinGW (to match my system environment settings)
05. executed "bmk makemods -a -w -g x64 openb3d" in C:\Apps\BlitzMax\bin
06. downloaded openb3d.mod-master.zip
07. executed "bmk makemods -a -w -g x64 openb3d" in C:\Apps\BlitzMax\bin

Stops at [ 97%] Processing:openb3d.bmx

Compile Error: Unable to convert from Int Array to Byte Array.
[c:/Apps/BlitzMax/mod/openb3d.mod/openb3d.mod/inc/T3DS.bmx;570;0]
Build Error: failed to compile (-1) c:/Apps/BlitzMax/mod/openb3d.mod/openb3d.mod/openb3d.bmx




This is very confusing to me (and for beginners, too), what did I do wrong? Does it only compile with BlitzMaxOS or with BlitzMaxNG, too? I want to use the latest versions of both. Or does anybody have a running version and can upload this somewhere?
Kind regards
Krischan

Windows 10 Pro | i7 9700K@ 3.6GHz | RTX 2080 8GB]
Metaverse | Blitzbasic Archive | My Github projects

Henri

Hi Krischan,

can you edit your post as to provide download links that you used to avoid confusion. I can take a look after sauna.

-Henri
- Got 01100011 problems, but the bit ain't 00000001

Krischan

Hi Henri, done. I just followed the links in the instructions but you're right - it is easier for you to follow my steps this way. Thanks!
Kind regards
Krischan

Windows 10 Pro | i7 9700K@ 3.6GHz | RTX 2080 8GB]
Metaverse | Blitzbasic Archive | My Github projects

col

@Krishan, Henri
To get it to compile in 0.87
Change the offending line 570 in openb3d.mod/inc/T3DS.bmx to

Local col:Byte[] = [255:Byte, 255:Byte, 255:Byte]

NG is seeing each 255 as an Int. BlitzMax has never really liked auto-type conversion for array contents ( Float[] = [1,1,1...] eg ), although it would handle Int to Byte quite safely, but NG is a little more fussy with more types available.
https://github.com/davecamp

"When you observe the world through social media, you lose your faith in it."

Krischan

Ok thanks col, that fixed this error and I got it running now with the release version. I'm not experienced yet in NG but I've got a lot of errors in my current project on the first run, very frustrating :-(

I have some additional questions about NG, sorry if some sound stupid but I didn't follow the discussions in the last year and it's hard to notice the changes (except the dozens of errors I'm getting):
- the first compile run of a new source takes ages, but the second run is much faster? why is that?
- Maxgui looks a little bit truncated? is it still in development for NG?
- what about this brl.timer / brl.timerdefault change? what is the reason for that?
- what about the current dev status? how stable is it?
- what do I have to consider at NG, what is completely different to Blitzmax before?
- how can I check if a compiled application is really 64bit?

And does anybody know how to successfully finish the complete installation (my first 37 steps)?
Kind regards
Krischan

Windows 10 Pro | i7 9700K@ 3.6GHz | RTX 2080 8GB]
Metaverse | Blitzbasic Archive | My Github projects

Derron

how to check for 64bit? try to run it on a 32bit windows :)




@ compilation times
You can always use the "quick" flag to skip "need I to compile things" ?


For me it takes really long when in linking stage with a big bunch of files to link against (so many many imports)




@ Brl.timer
To make the SDL.timer possible - needed for the SDL-environment




bye
Ron

Krischan

#6
Quote from: Derron on October 22, 2017, 21:33:36
how to check for 64bit? try to run it on a 32bit windows :)
Hmm ok I don't use pure 32bit systems anymore. So a VM with Windows XP 32bit should do the trick.

Ah and I've turned Quick off in BLIde, had some trouble with it. Good to know.
Kind regards
Krischan

Windows 10 Pro | i7 9700K@ 3.6GHz | RTX 2080 8GB]
Metaverse | Blitzbasic Archive | My Github projects

Henri

Okay,

the problem with pub.freeprocess is that it's 'Strict' which in NG-world is the default, but it's calling brl.Stream, which is 'Superstrict'.

In Strict-mode when you declare function with no return value, it assumed to be int.
In Superstrict-mode the same function would result a void return value.

So consider method Close() in TStream type is declared as void (as it visually looks like), but as TStream type is extended in pub.Freeprocess that is under Strict rules, the Close() method of extended type is interpret as Close:Int()

In my opinion pub.freeprocess would need to be updated to 'Superstrict' as it's part of the main package.

As this requires to declare all the variables, for convenience I've updated the file
Code (Blitzmax) Select


SuperStrict

Rem
bbdoc: System/Execute Processes
End Rem

'Rem
Module PUB.FreeProcess

ModuleInfo "Version: 1.04"
ModuleInfo "Framework: FreeProcess multi platform external process control"
ModuleInfo "License: zlib/libpng"
ModuleInfo "Copyright: Blitz Research Ltd"
ModuleInfo "Author: Simon Armstrong"
ModuleInfo "Modserver: BRL"

ModuleInfo "History: 1.04 Release"
ModuleInfo "History: Added Documentation, Added Detach and Attach Process Functions"
ModuleInfo "History: 1.03 Release"
ModuleInfo "History: Changed fork() to vfork() and exit() to _exit() to fix more hangs."
ModuleInfo "History: 1.02 Release"
ModuleInfo "History: Fixed a Linux hang when fork() is called."
ModuleInfo "History: Added SIGCHLD handling and fdReapZombies function."
ModuleInfo "History: 1.01 Release"
ModuleInfo "History: Inserts /Contents/MacOS/ into process path for Apple app packages"
'EndRem

'Strict

' createproc - to launch external executable
' TPipeStream - nonblocking readlines with fd file handles

Import brl.stream
Import brl.linkedlist
Import brl.filesystem

Import "freeprocess.c"

'note: Once fdProcessStatus() returns 0 OR fdTerminateProcess() is called,
'processhandle should be assumed to be invalid, and neither function should be called
'again.
Extern
Function fdClose(fd:Int)
Function fdRead:Long(fd:Int,buffer:Byte Ptr,count:Long)
Function fdWrite:Long(fd:Int,buffer:Byte Ptr,count:Long)
Function fdFlush(fd:Int)
Function fdAvail:Int(fd:Int)
Function fdProcess:Int(exe$,in_fd:Int Ptr,out_fd:Int Ptr,err_fd:Int Ptr,flags:Int)="fdProcess"
Function fdProcessStatus:Int(processhandle:Int)
Function fdTerminateProcess:Int(processhandle:Int)
End Extern

Const HIDECONSOLE:Int=1

Type TPipeStream Extends TStream

Field readbuffer:Byte[4096]
Field bufferpos:Long
Field readhandle:Int,writehandle:Int

Method Close()
If readhandle
fdClose(readhandle)
readhandle=0
EndIf
If writehandle
fdClose(writehandle)
writehandle=0
EndIf
End Method

Method Read:Long( buf:Byte Ptr,count:Long )
Return fdRead(readhandle,buf,count)
End Method

Method Write:Long( buf:Byte Ptr,count:Long )
Return fdWrite(writehandle,buf,count)
End Method

Method Flush()
fdFlush(writehandle)
End Method

Method ReadAvail:Int()
Return fdAvail(readhandle)
End Method

Method ReadPipe:Byte[]()
Local bytes:Byte[],n:Int
n=ReadAvail()
If n
bytes=New Byte[n]
Read(bytes,n)
Return bytes
EndIf
End Method

Method ReadLine$() 'nonblocking - returns empty string if no data available
Local n:Long,r:Long,p0:Int,p1:Int,line$
n=ReadAvail()
If n
If bufferpos+n>4096 n=4096-bufferpos
If n<=0 RuntimeError "PipeStream ReadBuffer Overflow"
r=Read(Varptr readbuffer[bufferpos],n)
bufferpos:+r
EndIf
For n=0 To bufferpos
If readbuffer[n]=10
p1=n
If (n>0)
If readbuffer[n-1]=13 p1=n-1
EndIf
p0=0
If readbuffer[0]=13 p0=1
If p1>p0 line$=String.FromBytes(Varptr readbuffer[p0],p1-p0)
n:+1
bufferpos:-n
If bufferpos MemMove(readbuffer,Varptr readbuffer[n],Size_T(bufferpos))
Return line$
EndIf
Next
End Method

Function Create:TPipeStream( in:Int,out:Int )
Local stream:TPipeStream=New TPipeStream
stream.readhandle=in
stream.writehandle=out
Return stream
End Function

End Type

Type TProcess
Global ProcessList:TList
Field name$
Field handle:Int
Field pipe:TPipeStream
Field err:TPipeStream
Field   detached:Int

Method Detach:Int()
detached = True
Return 1
End Method

Method Attach:Int()
detached = False
Return 1
End Method
Method Status:Int()
If handle
If fdProcessStatus(handle) Return 1
handle=0
EndIf
Return 0
End Method

Method Close()
If pipe pipe.Close;pipe=Null
If err err.Close;err=Null
End Method

Method Terminate:Int()
Local res:Int
If handle
res=fdTerminateProcess( handle )
handle=0
EndIf
Return res
End Method

Function Create:TProcess(name$,flags:Int)
Local p:TProcess
Local infd:Int,outfd:Int,errfd:Int
?MacOS
If FileType(name)=2
Local a$=StripExt(StripDir(name))
name:+"/Contents/MacOS/"+a$
EndIf
?
FlushZombies
p=New TProcess
p.name=name
p.handle=fdProcess(p.name,Varptr infd,Varptr outfd,Varptr errfd,flags)
If Not p.handle Return Null
p.pipe=TPipeStream.Create(infd,outfd)
p.err=TPipeStream.Create(errfd,0)
p.detached = False
If Not ProcessList ProcessList=New TList
ProcessList.AddLast p
Return p
End Function

Function FlushZombies()
If Not ProcessList Return
Local live:TList=New TList
For Local p:TProcess=EachIn ProcessList
If p.Status() live.AddLast p
Next
ProcessList=live
End Function

Function TerminateAll() NoDebug
If Not ProcessList Return
For Local p:TProcess=EachIn ProcessList
If p.detached = False Then
p.Terminate
EndIf
Next
ProcessList=Null
End Function

End Type

Rem
bbdoc: Creates a process
returns: TProcess object that is linked to the process you have started
End Rem
Function CreateProcess:TProcess(cmd$,flags:Int=0)
Return TProcess.Create(cmd,flags)
End Function

Rem
bbdoc: Checks status of program
returns: 1 if program is still running and 0 otherwise.
End Rem
Function ProcessStatus:Int(process:TProcess)
Return process.Status()
End Function

Rem
bbdoc: Detaches a process from program
End Rem
Function DetachProcess:Int(process:TProcess)
Return process.Detach()
End Function

Rem
bbdoc: Reattaches a process from program
End Rem
Function AttachProcess:Int(process:TProcess)
Return process.Attach()
End Function

Rem
bbdoc: End Process
returns: 1 if termination of program was successful and 0 otherwise.
End Rem
Function TerminateProcess:Int(process:TProcess)
Return process.Terminate()
End Function

OnEnd TProcess.TerminateAll




-Henri
- Got 01100011 problems, but the bit ain't 00000001

Krischan

Hmm I'm still getting this error (used your file now and executed "bmk makemods -a -w -g x64" in C:\Apps\BlitzMaxNG\bin again)

[ 82%] Processing:freeprocess.bmx
Compile Error: Overriding method does not match any overridden method. (Detail: Return type is "Void", expected "Int".)
[c:/Apps/BlitzMaxNG/mod/pub.mod/freeprocess.mod/freeprocess.bmx;61;0]
Build Error: failed to compile (-1) c:/Apps/BlitzMaxNG/mod/pub.mod/freeprocess.mod/freeprocess.bmx
Kind regards
Krischan

Windows 10 Pro | i7 9700K@ 3.6GHz | RTX 2080 8GB]
Metaverse | Blitzbasic Archive | My Github projects

Henri

Hmm...that seems strange.

Can you confirm that both brl.mod/stream.mod/stream.bmx and pub.mod/freeprocess.mod/freeprocess.bmx files start with Superstrict ?

-Henri
- Got 01100011 problems, but the bit ain't 00000001

Krischan

brl.mod/stream.mod/stream.bmx is "Strict" while pub.mod/freeprocess.mod/freeprocess.bmx is "Superstrict". Just changing the Strict in stream.bmx to Superstrict results in an error at 62%.

Build Error: failed to compile (-1) c:/Apps/BlitzMaxNG/mod/brl.mod/stream.mod/stream.bmx[
Kind regards
Krischan

Windows 10 Pro | i7 9700K@ 3.6GHz | RTX 2080 8GB]
Metaverse | Blitzbasic Archive | My Github projects

Henri

Okay,

as I know that Brucey updated stream.bmx to be Superstrict in August, I'm guessing that yours isn't the same version. Use the one in here https://github.com/bmx-ng/brl.mod. Also some issues with 'Internal error' where fixed in August too (see https://github.com/bmx-ng/bcc/commit/cbb7d0412caeb8b6ccd9d9cf5930b8183a1b1cf8)

-Henri
- Got 01100011 problems, but the bit ain't 00000001

Derron

If you (Krischan) are unsure if you use the latest and are having trouble to create a "most current build" you might ask Henry for help. BMX NG is portable, so one could just archive his NG and remove the "private modules" (non brl, non pub, - in this case non-openb3d). That way you also get the MinGW which works with the modules (and NG).


bye
Ron

TomToad

To check if you are running 64 bit in Windows:
Open Task Manager (CTRL+SHFT+ESC)
If needed, click on "more details" on bottom.
Just under the main menu, click on the "Details" tab
Just under the tabs, right-click on one of the column names ("Name","PID","Status", etc...) to open context menu
click "Select Columns"
Make sure "Platform" is checked. Click "OK"
resize window or drag the columns around so the "Platform" column is visible.  There it will say 64 or 32.
------------------------------------------------
8 rabbits equals 1 rabbyte.

RonTek

#14
You can also check for the *32 indicator in task manager if you're running Windows 7 x64.

As shown here, I have launched both 32 and 64 bit version of Blender 2.77a.



As for OpenB3D, I got the latest, but on an older NG version to work. No updates and just for preference as I have pending Android tests that I will get back to.