Author Topic: Scriptbasic Build Linux  (Read 5738 times)

Offline AIR

  • BASIC Developer
  • Posts: 660
Re: Scriptbasic Build Linux
« Reply #135 on: December 20, 2018, 09:48:41 AM »
Code: [Select]
ld -lmysqlclient
What does that show?

Your PLESK system appears to be using MariaDB to provide sql support and is aliasing mysql-server.

Try installing libmariadbclient-dev-compat



« Last Edit: December 20, 2018, 09:59:49 AM by AIR »

Offline John

  • Forum Support / SB Dev
  • Posts: 2685
    • ScriptBasic Open Source Project
Re: Scriptbasic Build Linux
« Reply #136 on: December 20, 2018, 04:25:26 PM »
Code: Bash
  1. [centos@ip-172-30-0-53 ~]$ sudo ld -lmysqlclient
  2. ld: cannot find -lmysqlclient
  3. [centos@ip-172-30-0-53 ~]$
  4.  


[centos@ip-172-30-0-53 ~]$ sudo yum install libmariadbclient-dev-compat
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: sjc.edge.kernel.org
 * extras: mirror.keystealth.org
 * updates: sjc.edge.kernel.org
No package libmariadbclient-dev-compat available.
Error: Nothing to do
[centos@ip-172-30-0-53 ~]$

« Last Edit: December 20, 2018, 04:31:13 PM by John »

Offline AIR

  • BASIC Developer
  • Posts: 660
Re: Scriptbasic Build Linux
« Reply #137 on: December 20, 2018, 05:29:12 PM »
Look for the dev version of the mariaclient.  RH/Centos/Fedora probably named it differently than Ubuntu/Debian.

Offline John

  • Forum Support / SB Dev
  • Posts: 2685
    • ScriptBasic Open Source Project
Re: Scriptbasic Build Linux
« Reply #138 on: December 20, 2018, 06:43:59 PM »
I was able to get it work by adding the MariaDB repo to the yum set.

Code: Bash
  1. [root@ip-172-30-0-53 yum.repos.d]# vi MariaDB.repo
  2. [root@ip-172-30-0-53 yum.repos.d]# yum install MariaDB-server MariaDB-client
  3. Loaded plugins: fastestmirror
  4. Loading mirror speeds from cached hostfile
  5.  * base: sjc.edge.kernel.org
  6.  * extras: mirror.keystealth.org
  7.  * updates: sjc.edge.kernel.org
  8. gitlab_gitlab-ce/x86_64/signature                                                                                                                                                    |  836 B  00:00:00    
  9. gitlab_gitlab-ce/x86_64/signature                                                                                                                                                    | 1.0 kB  00:00:00 !!!
  10. gitlab_gitlab-ce-source/signature                                                                                                                                                    |  836 B  00:00:00    
  11. gitlab_gitlab-ce-source/signature                                                                                                                                                    |  951 B  00:00:00 !!!
  12. mariadb                                                                                                                                                                              | 2.9 kB  00:00:00    
  13. mariadb/primary_db                                                                                                                                                                   |  50 kB  00:00:00    
  14. Resolving Dependencies
  15. --> Running transaction check
  16. ---> Package MariaDB-client.x86_64 0:10.3.11-1.el7.centos will be obsoleting
  17. --> Processing Dependency: MariaDB-common for package: MariaDB-client-10.3.11-1.el7.centos.x86_64
  18. ---> Package MariaDB-server.x86_64 0:10.3.11-1.el7.centos will be obsoleting
  19. --> Processing Dependency: galera for package: MariaDB-server-10.3.11-1.el7.centos.x86_64
  20. ---> Package mariadb.x86_64 1:5.5.60-1.el7_5 will be obsoleted
  21. ---> Package mariadb-server.x86_64 1:5.5.60-1.el7_5 will be obsoleted
  22. --> Running transaction check
  23. ---> Package MariaDB-common.x86_64 0:10.3.11-1.el7.centos will be installed
  24. --> Processing Dependency: MariaDB-compat for package: MariaDB-common-10.3.11-1.el7.centos.x86_64
  25. ---> Package galera.x86_64 0:25.3.24-1.rhel7.el7.centos will be installed
  26. --> Processing Dependency: libboost_program_options.so.1.53.0()(64bit) for package: galera-25.3.24-1.rhel7.el7.centos.x86_64
  27. --> Running transaction check
  28. ---> Package MariaDB-compat.x86_64 0:10.3.11-1.el7.centos will be obsoleting
  29. ---> Package boost-program-options.x86_64 0:1.53.0-27.el7 will be installed
  30. ---> Package mariadb-libs.x86_64 1:5.5.60-1.el7_5 will be obsoleted
  31. --> Processing Dependency: mariadb-libs(x86-64) = 1:5.5.60-1.el7_5 for package: 1:mariadb-devel-5.5.60-1.el7_5.x86_64
  32. --> Running transaction check
  33. ---> Package MariaDB-devel.x86_64 0:10.3.11-1.el7.centos will be obsoleting
  34. ---> Package mariadb-devel.x86_64 1:5.5.60-1.el7_5 will be obsoleted
  35. --> Finished Dependency Resolution
  36.  
  37. Dependencies Resolved
  38.  
  39. ============================================================================================================================================================================================================
  40.  Package                                                Arch                                    Version                                                      Repository                                Size
  41. ============================================================================================================================================================================================================
  42. Installing:
  43.  MariaDB-client                                         x86_64                                  10.3.11-1.el7.centos                                         mariadb                                   53 M
  44.      replacing  mariadb.x86_64 1:5.5.60-1.el7_5
  45.  MariaDB-compat                                         x86_64                                  10.3.11-1.el7.centos                                         mariadb                                  2.8 M
  46.      replacing  mariadb-libs.x86_64 1:5.5.60-1.el7_5
  47.  MariaDB-devel                                          x86_64                                  10.3.11-1.el7.centos                                         mariadb                                  7.0 M
  48.      replacing  mariadb-devel.x86_64 1:5.5.60-1.el7_5
  49.  MariaDB-server                                         x86_64                                  10.3.11-1.el7.centos                                         mariadb                                  123 M
  50.      replacing  mariadb-server.x86_64 1:5.5.60-1.el7_5
  51. Installing for dependencies:
  52.  MariaDB-common                                         x86_64                                  10.3.11-1.el7.centos                                         mariadb                                  157 k
  53.  boost-program-options                                  x86_64                                  1.53.0-27.el7                                                base                                     156 k
  54.  galera                                                 x86_64                                  25.3.24-1.rhel7.el7.centos                                   mariadb                                  8.1 M
  55.  
  56. Transaction Summary
  57. ============================================================================================================================================================================================================
  58. Install  4 Packages (+3 Dependent packages)
  59.  
  60. Total download size: 195 M
  61. Is this ok [y/d/N]: y
  62. Downloading packages:
  63. warning: /var/cache/yum/x86_64/7/mariadb/packages/MariaDB-10.3.11-centos73-x86_64-common.rpm: Header V4 DSA/SHA1 Signature, key ID 1bb943db: NOKEY
  64. Public key for MariaDB-10.3.11-centos73-x86_64-common.rpm is not installed
  65. (1/7): MariaDB-10.3.11-centos73-x86_64-common.rpm                                                                                                                                    | 157 kB  00:00:00    
  66. (2/7): MariaDB-10.3.11-centos73-x86_64-compat.rpm                                                                                                                                    | 2.8 MB  00:00:00    
  67. (3/7): MariaDB-10.3.11-centos73-x86_64-devel.rpm                                                                                                                                     | 7.0 MB  00:00:00    
  68. (4/7): boost-program-options-1.53.0-27.el7.x86_64.rpm                                                                                                                                | 156 kB  00:00:00    
  69. (5/7): MariaDB-10.3.11-centos73-x86_64-server.rpm                                                                                                                                    | 123 MB  00:00:06    
  70. (6/7): galera-25.3.24-1.rhel7.el7.centos.x86_64.rpm                                                                                                                                  | 8.1 MB  00:00:00    
  71. (7/7): MariaDB-10.3.11-centos73-x86_64-client.rpm                                                                                                                                    |  53 MB  00:00:16    
  72. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  73. Total                                                                                                                                                                        12 MB/s | 195 MB  00:00:16    
  74. Retrieving key from https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
  75. Importing GPG key 0x1BB943DB:
  76.  Userid     : "MariaDB Package Signing Key <package-signing-key@mariadb.org>"#
  77.  
  78.  
  79. [root@ip-172-30-0-53 yum.repos.d]# cat MariaDB.repo
  80. # MariaDB 10.3 CentOS repository list - created 2018-12-21 02:06 UTC
  81. # http://downloads.mariadb.org/mariadb/repositories/
  82. [mariadb]
  83. name = MariaDB
  84. baseurl = http://yum.mariadb.org/10.3/centos7-amd64
  85. gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
  86. gpgcheck=1
  87.  
  88. [root@ip-172-30-0-53 yum.repos.d]# pwd
  89. /etc/yum.repos.d
  90. [root@ip-172-30-0-53 yum.repos.d]#
  91.  
  92. [root@ip-172-30-0-53 sb-dev]# ./setup --module=mysql
  93. This is unix cwd=/var/www/vhosts/opensage.org/httpdocs/sb-dev/
  94. executing headerer for the C files
  95.  extracting header from interface.c
  96. creating the module object directory
  97. Processing jamal files creating makefile
  98. ld: cannot find -lmysqlclient
  99. make: *** [/var/www/vhosts/opensage.org/httpdocs/sb-dev/bin/mod/dll/mysql.so] Error 1
  100. ERROR: SO was not created for some reason.
  101. [root@ip-172-30-0-53 sb-dev]#
  102.  

Using the existing mysql I had built under CentOS 6, I was able to get my test script and DB to work.

Code: Script BASIC
  1. ' MySQL Test Program
  2.  
  3. INCLUDE mysql.bas
  4.  
  5. dbh = mysql::RealConnect("localhost","sbadmin","northstar","sbtest")
  6.  
  7. mysql::query(dbh,"SELECT * FROM products WHERE productLine = 'Planes'")
  8.  
  9. WHILE mysql::FetchHash(dbh,column)
  10.   PRINT column{"productCode"}," - ",column{"productName"},"\n"
  11. WEND
  12.  
  13. PRINTNL
  14. PRINT "The database handle is: ",dbh,"\n"
  15. PRINT "Affected rows by SELECT: ",mysql::AffectedRows(dbh),"\n"
  16. PRINT "Character set name is: ",mysql::CharacterSetName(dbh),"\n"
  17. PRINT "Last error is: ",mysql::ErrorMessage(dbh),"\n"
  18. PRINT "Client info is: ",mysql::GetClientInfo(),"\n"
  19. PRINT "Host info is: ",mysql::GetHostInfo(dbh),"\n"
  20. PRINT "Proto info is: ",mysql::GetProtoInfo(dbh),"\n"
  21. PRINT "Server info is: ",mysql::GetServerInfo(dbh),"\n"
  22. PRINT "PING result: ",mysql::Ping(dbh),"\n"
  23. PRINT "Thread ID: ",mysql::ThreadId(dbh),"\n"
  24. PRINT "Status is: ",mysql::Stat(dbh),"\n"
  25.  
  26. mysql::Close(dbh)
  27.  


[root@ip-172-30-0-53 test]# scriba testmysql.sb
S18_1662 - 1980s Black Hawk Helicopter
S18_2581 - P-51-D Mustang
S24_1785 - 1928 British Royal Navy Airplane
S24_2841 - 1900s Vintage Bi-Plane
S24_3949 - Corsair F4U ( Bird Cage)
S24_4278 - 1900s Vintage Tri-Plane
S700_1691 - American Airlines: B767-300
S700_2466 - America West Airlines B757-200
S700_2834 - ATA: B757-300
S700_3167 - F/A 18 Hornet 1/72
S700_4002 - American Airlines: MD-11S
S72_1253 - Boeing X-32A JSF

The database handle is: 1
Affected rows by SELECT: 12
Character set name is: latin1
Last error is:
Client info is: 5.3.12-MariaDB
Host info is: Localhost via UNIX socket
Proto info is: 10
Server info is: 5.5.5-10.3.11-MariaDB
PING result: -1
Thread ID: 0
Status is: Uptime: 826  Threads: 11  Questions: 31742  Slow queries: 0  Opens: 390  Flush tables: 1  Open tables: 383  Queries per second avg: 38.428
[root@ip-172-30-0-53 test]#

 

Offline John

  • Forum Support / SB Dev
  • Posts: 2685
    • ScriptBasic Open Source Project
Re: Scriptbasic Build Linux
« Reply #139 on: January 10, 2019, 05:15:33 PM »
AIR,

While looking at Dave's repo, I notice that the LIKE fix Peter made for a bug I found didn't get into your string.c source. I updated the Linux SB-DEV in the sandbox.

Start at line 2331.
« Last Edit: January 10, 2019, 05:19:27 PM by John »

Offline John

  • Forum Support / SB Dev
  • Posts: 2685
    • ScriptBasic Open Source Project
Re: Scriptbasic Build Linux
« Reply #140 on: January 11, 2019, 08:10:00 PM »
This is what Script BASIC returns. The HEX function seems broken for 64 bits.  :(

Code: Script BASIC
  1. numhex =  0x1D4A9EBC4E94E60
  2. PRINT numhex,"\n"
  3. PRINT HEX(numhex),"\n"
  4.  


$ scriba phex.sb
131917119186620000
       C4E94E60
$


Offline AIR

  • BASIC Developer
  • Posts: 660
Re: Scriptbasic Build Linux
« Reply #141 on: January 11, 2019, 08:23:44 PM »
This is what Script BASIC returns. The HEX function seems broken for 64 bits.  :(

Code: Script BASIC
  1. numhex =  0x1D4A9EBC4E94E60
  2. PRINT numhex,"\n"
  3. PRINT HEX(numhex),"\n"
  4.  


$ scriba phex.sb
131917119186620000
       C4E94E60
$


You get that value when the output of the HEX function is the result of a conversion to an INT (MBC has the same issue)...

The problem is here, in commands/string.c:

Code: Script BASIC
  1. sprintf(STRINGVALUE(RESULT),"%*X",lLength,lStore);

That performs a conversion to an int.

John, in string.c try changing the above (around line 1333) to the following:

Code: Script BASIC
  1.  sprintf(STRINGVALUE(RESULT),"%lX",lStore);

Here's what I get on my Mac with the changed code:

$ ./scriba phex.sb
131917119186620000
1D4A9EBC4E94E60


The issue in the original code is that the format specifier '*' looks for an integer value (the lLength variable) and will do a conversion to INT if it's a larger type, resulting in an incorrect return value with the LONG that you're passing.  Note that both the lLength and lStore are already LONG variables (ULONG, to be exact. Perhaps the format specifier should be "%luX instead...TEST!!!!).

AIR.
« Last Edit: January 11, 2019, 09:02:36 PM by AIR »

Offline John

  • Forum Support / SB Dev
  • Posts: 2685
    • ScriptBasic Open Source Project
Re: Scriptbasic Build Linux
« Reply #142 on: January 11, 2019, 09:03:17 PM »
Is there a way to make this work for both 32 and 64 bit. If not my vote is focus on 64 bit and not touch the Windows branch until 64 bit SB returns to active development.

Offline John

  • Forum Support / SB Dev
  • Posts: 2685
    • ScriptBasic Open Source Project
Re: Scriptbasic Build Linux
« Reply #143 on: January 11, 2019, 09:05:25 PM »
Great job AIR!

I'll do some testing before pushing it to the sandbox.

Offline AIR

  • BASIC Developer
  • Posts: 660
Re: Scriptbasic Build Linux
« Reply #144 on: January 11, 2019, 09:10:38 PM »
Is there a way to make this work for both 32 and 64 bit. If not my vote is focus on 64 bit and not touch the Windows branch until 64 bit SB returns to active development.

Internally, SB has this:

Code: Script BASIC
  1. COMMAND(HEX)
  2. #if NOTIMP_HEX
  3. NOTIMPLEMENTED;
  4. #else
  5.  
  6.  
  7.   unsigned long lCode;
  8.   unsigned long lLength,lStore;
  9.   VARIABLE Op;

And a little further down:

Code: Script BASIC
  1. lCode = LONGVALUE(CONVERT2LONG(Op));
  2.   lStore = lCode;

Under 32bit, a LONG is the same size as an INT, so I believe it will be fine.  Only way to know for sure is to test, but I think it may truncate the value that you're passing in your test file.

AIR.

Offline AIR

  • BASIC Developer
  • Posts: 660
Re: Scriptbasic Build Linux
« Reply #145 on: January 11, 2019, 09:13:45 PM »
Great job AIR!

I'll do some testing before pushing it to the sandbox.

Cool.

This is one of those things that pre-date 64BIT; you'll probably find more as you test further....

Offline John

  • Forum Support / SB Dev
  • Posts: 2685
    • ScriptBasic Open Source Project
Re: Scriptbasic Build Linux
« Reply #146 on: January 11, 2019, 09:23:45 PM »
Correct!

I have a couple more I need to pull out of the TODO drawer.  ;)

Hint: FORMAT

Offline AIR

  • BASIC Developer
  • Posts: 660
Re: Scriptbasic Build Linux
« Reply #147 on: January 11, 2019, 10:00:50 PM »
What about FORMAT?

Offline John

  • Forum Support / SB Dev
  • Posts: 2685
    • ScriptBasic Open Source Project
Re: Scriptbasic Build Linux
« Reply #148 on: January 11, 2019, 10:40:49 PM »
It's only masking to 32 bit for floats. It has the same issue with HEX values.

Offline AIR

  • BASIC Developer
  • Posts: 660
Re: Scriptbasic Build Linux
« Reply #149 on: January 11, 2019, 10:57:57 PM »
Post an example....