March 20, 2019, 03:54:16 AM

Author Topic: Problem compiling OpenB3D  (Read 2013 times)

Offline Krischan

  • Full Member
  • ***
  • Posts: 192
    • Krischan's Homepage
Problem compiling OpenB3D
« on: October 22, 2017, 04:15:51 PM »
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]
My Blitzbasic Archive | Extrasolar Project

Offline Henri

  • Full Member
  • ***
  • Posts: 185
Re: Problem compiling OpenB3D
« Reply #1 on: October 22, 2017, 05:04:41 PM »
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

Offline Krischan

  • Full Member
  • ***
  • Posts: 192
    • Krischan's Homepage
Re: Problem compiling OpenB3D
« Reply #2 on: October 22, 2017, 06:20:39 PM »
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]
My Blitzbasic Archive | Extrasolar Project

Offline col

  • Sr. Member
  • ****
  • Posts: 408
Re: Problem compiling OpenB3D
« Reply #3 on: October 22, 2017, 06:55:42 PM »
@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.
Any bugs in my code are proof of its hand-coded nature.
https://github.com/davecamp

Offline Krischan

  • Full Member
  • ***
  • Posts: 192
    • Krischan's Homepage
Re: Problem compiling OpenB3D
« Reply #4 on: October 22, 2017, 09:27:05 PM »
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]
My Blitzbasic Archive | Extrasolar Project

Offline Derron

  • Hero Member
  • *****
  • Posts: 1668
Re: Problem compiling OpenB3D
« Reply #5 on: October 22, 2017, 09:33:36 PM »
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

Offline Krischan

  • Full Member
  • ***
  • Posts: 192
    • Krischan's Homepage
Re: Problem compiling OpenB3D
« Reply #6 on: October 22, 2017, 09:49:34 PM »
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]
My Blitzbasic Archive | Extrasolar Project

Offline Henri

  • Full Member
  • ***
  • Posts: 185
Re: Problem compiling OpenB3D
« Reply #7 on: October 22, 2017, 10:16:50 PM »
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
  1.  
  2. SuperStrict
  3.  
  4. Rem
  5. bbdoc: System/Execute Processes
  6. End Rem
  7.  
  8. 'Rem
  9. Module PUB.FreeProcess
  10.  
  11. ModuleInfo "Version: 1.04"
  12. ModuleInfo "Framework: FreeProcess multi platform external process control"
  13. ModuleInfo "License: zlib/libpng"
  14. ModuleInfo "Copyright: Blitz Research Ltd"
  15. ModuleInfo "Author: Simon Armstrong"
  16. ModuleInfo "Modserver: BRL"
  17.  
  18. ModuleInfo "History: 1.04 Release"
  19. ModuleInfo "History: Added Documentation, Added Detach and Attach Process Functions"
  20. ModuleInfo "History: 1.03 Release"
  21. ModuleInfo "History: Changed fork() to vfork() and exit() to _exit() to fix more hangs."
  22. ModuleInfo "History: 1.02 Release"
  23. ModuleInfo "History: Fixed a Linux hang when fork() is called."
  24. ModuleInfo "History: Added SIGCHLD handling and fdReapZombies function."
  25. ModuleInfo "History: 1.01 Release"
  26. ModuleInfo "History: Inserts /Contents/MacOS/ into process path for Apple app packages"
  27. 'EndRem
  28.  
  29. 'Strict
  30.  
  31. ' createproc - to launch external executable
  32. ' TPipeStream - nonblocking readlines with fd file handles
  33.  
  34. Import brl.stream
  35. Import brl.linkedlist
  36. Import brl.filesystem
  37.  
  38. Import "freeprocess.c"
  39.  
  40. 'note: Once fdProcessStatus() returns 0 OR fdTerminateProcess() is called,
  41. 'processhandle should be assumed to be invalid, and neither function should be called
  42. 'again.
  43. Extern
  44. Function fdClose(fd:Int)
  45. Function fdRead:Long(fd:Int,buffer:Byte Ptr,count:Long)
  46. Function fdWrite:Long(fd:Int,buffer:Byte Ptr,count:Long)
  47. Function fdFlush(fd:Int)
  48. Function fdAvail:Int(fd:Int)
  49. Function fdProcess:Int(exe$,in_fd:Int Ptr,out_fd:Int Ptr,err_fd:Int Ptr,flags:Int)="fdProcess"
  50. Function fdProcessStatus:Int(processhandle:Int)
  51. Function fdTerminateProcess:Int(processhandle:Int)
  52. End Extern
  53.  
  54. Const HIDECONSOLE:Int=1
  55.  
  56. Type TPipeStream Extends TStream
  57.  
  58.         Field   readbuffer:Byte[4096]
  59.         Field   bufferpos:Long
  60.         Field   readhandle:Int,writehandle:Int
  61.  
  62.         Method Close()
  63.                 If readhandle
  64.                         fdClose(readhandle)
  65.                         readhandle=0
  66.                 EndIf
  67.                 If writehandle
  68.                         fdClose(writehandle)
  69.                         writehandle=0
  70.                 EndIf
  71.         End Method
  72.  
  73.         Method Read:Long( buf:Byte Ptr,count:Long )
  74.                 Return fdRead(readhandle,buf,count)
  75.         End Method
  76.  
  77.         Method Write:Long( buf:Byte Ptr,count:Long )
  78.                 Return fdWrite(writehandle,buf,count)
  79.         End Method
  80.        
  81.         Method Flush()
  82.                 fdFlush(writehandle)
  83.         End Method
  84.                
  85.         Method ReadAvail:Int()
  86.                 Return fdAvail(readhandle)
  87.         End Method
  88.        
  89.         Method ReadPipe:Byte[]()
  90.                 Local   bytes:Byte[],n:Int
  91.                 n=ReadAvail()
  92.                 If n
  93.                         bytes=New Byte[n]
  94.                         Read(bytes,n)
  95.                         Return bytes
  96.                 EndIf  
  97.         End Method
  98.        
  99.         Method ReadLine$()      'nonblocking - returns empty string if no data available
  100.                 Local   n:Long,r:Long,p0:Int,p1:Int,line$
  101.                 n=ReadAvail()
  102.                 If n
  103.                         If bufferpos+n>4096 n=4096-bufferpos
  104.                         If n<=0 RuntimeError "PipeStream ReadBuffer Overflow"
  105.                         r=Read(Varptr readbuffer[bufferpos],n)
  106.                         bufferpos:+r
  107.                 EndIf
  108.                 For n=0 To bufferpos
  109.                         If readbuffer[n]=10
  110.                                 p1=n
  111.                                 If (n>0)
  112.                                         If readbuffer[n-1]=13 p1=n-1
  113.                                 EndIf
  114.                                 p0=0
  115.                                 If readbuffer[0]=13 p0=1
  116.                                 If p1>p0 line$=String.FromBytes(Varptr readbuffer[p0],p1-p0)
  117.                                 n:+1
  118.                                 bufferpos:-n
  119.                                 If bufferpos MemMove(readbuffer,Varptr readbuffer[n],Size_T(bufferpos))
  120.                                 Return line$
  121.                         EndIf
  122.                 Next                   
  123.         End Method
  124.  
  125.         Function Create:TPipeStream( in:Int,out:Int )
  126.                 Local stream:TPipeStream=New TPipeStream
  127.                 stream.readhandle=in
  128.                 stream.writehandle=out
  129.                 Return stream
  130.         End Function
  131.  
  132. End Type
  133.  
  134. Type TProcess
  135.         Global ProcessList:TList
  136.         Field   name$
  137.         Field   handle:Int
  138.         Field   pipe:TPipeStream
  139.         Field   err:TPipeStream
  140.         Field   detached:Int
  141.  
  142.         Method Detach:Int()
  143.                 detached = True
  144.                 Return 1
  145.         End Method
  146.        
  147.         Method Attach:Int()
  148.                 detached = False
  149.                 Return 1
  150.         End Method
  151.         Method Status:Int()
  152.                 If handle
  153.                         If fdProcessStatus(handle) Return 1
  154.                         handle=0
  155.                 EndIf
  156.                 Return 0
  157.         End Method
  158.        
  159.         Method Close()
  160.                 If pipe pipe.Close;pipe=Null
  161.                 If err err.Close;err=Null
  162.         End Method
  163.        
  164.         Method Terminate:Int()
  165.                 Local res:Int
  166.                 If handle
  167.                         res=fdTerminateProcess( handle )
  168.                         handle=0
  169.                 EndIf
  170.                 Return res
  171.         End Method
  172.  
  173.         Function Create:TProcess(name$,flags:Int)
  174.                 Local   p:TProcess
  175.                 Local   infd:Int,outfd:Int,errfd:Int   
  176. ?MacOS
  177.                 If FileType(name)=2
  178.                         Local a$=StripExt(StripDir(name))
  179.                         name:+"/Contents/MacOS/"+a$
  180.                 EndIf
  181. ?
  182.                 FlushZombies
  183.                 p=New TProcess
  184.                 p.name=name
  185.                 p.handle=fdProcess(p.name,Varptr infd,Varptr outfd,Varptr errfd,flags)
  186.                 If Not p.handle Return Null
  187.                 p.pipe=TPipeStream.Create(infd,outfd)
  188.                 p.err=TPipeStream.Create(errfd,0)
  189.                 p.detached = False
  190.                 If Not ProcessList ProcessList=New TList
  191.                 ProcessList.AddLast p
  192.                 Return p
  193.         End Function
  194.        
  195.         Function FlushZombies()
  196.                 If Not ProcessList Return
  197.                 Local live:TList=New TList
  198.                 For Local p:TProcess=EachIn ProcessList
  199.                         If p.Status() live.AddLast p
  200.                 Next
  201.                 ProcessList=live
  202.         End Function
  203.        
  204.         Function TerminateAll() NoDebug
  205.                 If Not ProcessList Return
  206.                 For Local p:TProcess=EachIn ProcessList
  207.                         If p.detached = False Then
  208.                                 p.Terminate
  209.                         EndIf
  210.                 Next
  211.                 ProcessList=Null
  212.         End Function
  213.        
  214. End Type
  215.  
  216. Rem
  217. bbdoc: Creates a process
  218. returns: TProcess object that is linked to the process you have started
  219. End Rem
  220. Function CreateProcess:TProcess(cmd$,flags:Int=0)
  221.         Return TProcess.Create(cmd,flags)
  222. End Function
  223.  
  224. Rem
  225. bbdoc: Checks status of program
  226. returns: 1 if program is still running and 0 otherwise.
  227. End Rem
  228. Function ProcessStatus:Int(process:TProcess)
  229.         Return process.Status()
  230. End Function
  231.  
  232. Rem
  233. bbdoc: Detaches a process from program
  234. End Rem
  235. Function DetachProcess:Int(process:TProcess)
  236.         Return process.Detach()
  237. End Function
  238.  
  239. Rem
  240. bbdoc: Reattaches a process from program
  241. End Rem
  242. Function AttachProcess:Int(process:TProcess)
  243.         Return process.Attach()
  244. End Function
  245.  
  246. Rem
  247. bbdoc: End Process
  248. returns: 1 if termination of program was successful and 0 otherwise.
  249. End Rem
  250. Function TerminateProcess:Int(process:TProcess)
  251.         Return process.Terminate()
  252. End Function
  253.  
  254. OnEnd TProcess.TerminateAll
  255.  
  256.  


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

Offline Krischan

  • Full Member
  • ***
  • Posts: 192
    • Krischan's Homepage
Re: Problem compiling OpenB3D
« Reply #8 on: October 22, 2017, 10:51:17 PM »
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]
My Blitzbasic Archive | Extrasolar Project

Offline Henri

  • Full Member
  • ***
  • Posts: 185
Re: Problem compiling OpenB3D
« Reply #9 on: October 22, 2017, 11:39:37 PM »
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

Offline Krischan

  • Full Member
  • ***
  • Posts: 192
    • Krischan's Homepage
Re: Problem compiling OpenB3D
« Reply #10 on: October 23, 2017, 07:04:54 AM »
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]
My Blitzbasic Archive | Extrasolar Project

Offline Henri

  • Full Member
  • ***
  • Posts: 185
Re: Problem compiling OpenB3D
« Reply #11 on: October 23, 2017, 08:39:02 AM »
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

Offline Derron

  • Hero Member
  • *****
  • Posts: 1668
Re: Problem compiling OpenB3D
« Reply #12 on: October 23, 2017, 08:42:25 AM »
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

Offline TomToad

  • Sr. Member
  • ****
  • Posts: 363
Re: Problem compiling OpenB3D
« Reply #13 on: October 23, 2017, 01:05:39 PM »
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.

Offline RonTek

  • Sr. Member
  • ****
  • Posts: 357
Re: Problem compiling OpenB3D
« Reply #14 on: October 23, 2017, 01:22:41 PM »
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.