kburtch / SparForte

Bourne shell, template engine, scripting language reliable, scalable projects. Based a ISO standard proven effective for large, mission-critical projects, SparForte is designed for fast development while, at the same time, providing easier designing, maintenance and bug removal. About 130.000 lines of code.
https://www.sparforte.com
GNU General Public License v2.0
50 stars 6 forks source link

MySQL does not compile #4

Closed micahwelf closed 8 years ago

micahwelf commented 8 years ago

Concerns with compiling MySQL

Firstly, I think it would be nice if I could just compile without MySQL, since both fundamental functionality and compile-ability are essential to the usefulness and growing popularity of this wonderful idea and scripting kit. The problem I have right now and that is likely very common elsewhere is that MySQL does not compile and it seems that it is a source code issue.

Isn't there a pure Ada implementation of SQL? Ada and MySQL are practically cousins, so why is MySQL being loaded from the modern C libraries? If it is for some general compatibility with library changes over time, I'd rather have pure Ada rudimentary database support. Anyway, the most practical choice I have right now is to get MySQL running. Here is the failure output of the compiler:

---------------------------------------------------------------
  Making APQ (PostgreSQL/MySQL DBI)
    http://home.cogeco.ca/~ve3wwg
---------------------------------------------------------------

gmake -C apq-2.1/
gmake[2]: Entering directory '/home/micah/.devel/ada/sparforte/src/apq-2.1'
chmod u+x mysql_xcr mysql_xcr2 mysql_xcr3 mysql_incl mysql_xty mysql_linker_opti
ons
./mysql_xcr >mysql_errmsg.h
./mysql_xty >mysql_type_codes.h
gcc -Wall  -O1 -I/usr/include/mysql  mysql_generr.c -o mysql_generr
gcc -Wall  -O1 -I/usr/include/mysql  mysql_gentyp.c -o mysql_gentyp
In file included from mysql_gentyp.c:34:0:
mysql_type_codes.h: In function ‘main’:
mysql_type_codes.h:23:8: warning: missing terminating " character
   { "*/", */ },
        ^
mysql_type_codes.h:23:8: error: missing terminating " character
   { "*/", */ },
        ^~~~~~~~
mysql_type_codes.h:24:3: warning: braces around scalar initializer
   { "MYSQL_TYPE_TIMESTAMP2", MYSQL_TYPE_TIMESTAMP2 },
   ^
mysql_type_codes.h:24:3: note: (near initialization for ‘codes[17].code’)
mysql_type_codes.h:24:5: warning: initialization makes integer from pointer with
out a cast [-Wint-conversion]
   { "MYSQL_TYPE_TIMESTAMP2", MYSQL_TYPE_TIMESTAMP2 },
     ^~~~~~~~~~~~~~~~~~~~~~~
mysql_type_codes.h:24:5: note: (near initialization for ‘codes[17].code’)
mysql_type_codes.h:24:5: error: initializer element is not computable at load ti
me
mysql_type_codes.h:24:5: note: (near initialization for ‘codes[17].code’)
mysql_type_codes.h:24:30: warning: excess elements in scalar initializer
   { "MYSQL_TYPE_TIMESTAMP2", MYSQL_TYPE_TIMESTAMP2 },
                              ^~~~~~~~~~~~~~~~~~~~~
mysql_type_codes.h:24:30: note: (near initialization for ‘codes[17].code’)
mysql_type_codes.h:25:3: error: extra brace group at end of initializer
2   { "MYSQL_TYPE_DATETIME2", MYSQL_TYPE_DATETIME2 },    
   ^
mysql_type_codes.h:25:3: note: (near initialization for ‘codes[17]’)
mysql_type_codes.h:25:3: warning: excess elements in struct initializer
mysql_type_codes.h:25:3: note: (near initialization for ‘codes[17]’)
mysql_type_codes.h:26:3: error: extra brace group at end of initializer
   { "MYSQL_TYPE_TIME2", MYSQL_TYPE_TIME2 },
   ^
mysql_type_codes.h:26:3: note: (near initialization for ‘codes[17]’)
mysql_type_codes.h:26:3: warning: excess elements in struct initializer
mysql_type_codes.h:26:3: note: (near initialization for ‘codes[17]’)
mysql_type_codes.h:27:3: error: extra brace group at end of initializer
   { "MYSQL_TYPE_NEWDECIMAL", MYSQL_TYPE_NEWDECIMAL },
   ^
mysql_type_codes.h:27:3: note: (near initialization for ‘codes[17]’)
mysql_type_codes.h:27:3: warning: excess elements in struct initializer
mysql_type_codes.h:27:3: note: (near initialization for ‘codes[17]’)
mysql_type_codes.h:28:3: error: extra brace group at end of initializer
   { "MYSQL_TYPE_ENUM", MYSQL_TYPE_ENUM },
   ^
mysql_type_codes.h:32:3: note: (near initialization for ‘codes[17]’)
mysql_type_codes.h:32:3: warning: excess elements in struct initializer
mysql_type_codes.h:32:3: note: (near initialization for ‘codes[17]’)
mysql_type_codes.h:33:3: error: extra brace group at end of initializer
   { "MYSQL_TYPE_BLOB", MYSQL_TYPE_BLOB },
   ^
mysql_type_codes.h:33:3: note: (near initialization for ‘codes[17]’)
mysql_type_codes.h:33:3: warning: excess elements in struct initializer
mysql_type_codes.h:33:3: note: (near initialization for ‘codes[17]’)
mysql_type_codes.h:34:3: error: extra brace group at end of initializer
   { "MYSQL_TYPE_VAR_STRING", MYSQL_TYPE_VAR_STRING },
   ^
mysql_type_codes.h:34:3: note: (near initialization for ‘codes[17]’)
mysql_type_codes.h:34:3: warning: excess elements in struct initializer
mysql_type_codes.h:34:3: note: (near initialization for ‘codes[17]’)
mysql_type_codes.h:35:3: error: extra brace group at end of initializer
   { "MYSQL_TYPE_STRING", MYSQL_TYPE_STRING },
   ^
mysql_type_codes.h:35:3: note: (near initialization for ‘codes[17]’)
mysql_type_codes.h:35:3: warning: excess elements in struct initializer
mysql_type_codes.h:35:3: note: (near initialization for ‘codes[17]’)
mysql_type_codes.h:36:3: error: extra brace group at end of initializer
   { "MYSQL_TYPE_GEOMETRY", MYSQL_TYPE_GEOMETRY },
   ^
mysql_type_codes.h:36:3: note: (near initialization for ‘codes[17]’)
mysql_type_codes.h:36:3: warning: excess elements in struct initializer
mysql_type_codes.h:36:3: note: (near initialization for ‘codes[17]’)
mysql_type_codes.h:37:3: error: extra brace group at end of initializer
   { 0, 0 }
   ^
mysql_type_codes.h:37:3: note: (near initialization for ‘codes[17]’)
mysql_type_codes.h:37:3: warning: excess elements in struct initializer
mysql_type_codes.h:37:3: note: (near initialization for ‘codes[17]’)
mysql_gentyp.c:35:3: error: expected ‘}’ before ‘;’ token
   };
   ^
mysql_gentyp.c:41:1: error: expected ‘,’ or ‘;’ at end of input
 }
 ^
mysql_gentyp.c:41:1: error: expected declaration or statement at end of input
mysql_gentyp.c:33:18: warning: unused variable ‘codes’ [-Wunused-variable]
  static TypeCode codes[] = {
                  ^~~~~
At top level:
mysql_gentyp.c:33:18: warning: ‘codes’ defined but not used [-Wunused-variable]
GNUmakefile:46: recipe for target 'apq-mysql.ads' failed
gmake[2]: *** [apq-mysql.ads] Error 1
kburtch commented 8 years ago

You can disable MySQL and/or PostgreSQL with --without-mysql / --without-postgres configure options. SparForte used to require a database but I am pretty certain I removed that issue a few years ago. I will confirm this when I get a chance.

I am not aware of any pure Ada binding for MySQL. The third-party APQ library is the only option I am aware of.

MySQL occasionally updates it C header files. It is possible a recent update has broken the APQ configuration program. What version of Linux are you running so I can duplicate the issue and make sure APQ is corrected?

micahwelf commented 8 years ago

Ah, thank you. It was my mistake that the MySQL needed to be there. I remembered reading that, but that was obviously very old information. I disabled it and most of the compile went well, except something is still hanging in relation to MySQL:

parser_mysql.adb:72:01: no visible subprogram matches the specification for "ParseMySQLPrepare"
parser_mysql.adb:249:01: no visible subprogram matches the specification for "DoMySQLSQLSelect"
parser_mysql.adb:252:01: no visible subprogram matches the specification for "DoMySQLSQLStatement"
gnatmake: "parser_mysql.adb" compilation error
GNUmakefile:51: recipe for target 'all' failed
gmake[1]: *** [all] Error 4
gmake[1]: Leaving directory '/home/micah/.devel/ada/sparforte/src'
GNUmakefile:12: recipe for target 'all' failed

Do you suggest anything in particular, or should I just go in and modify parser_mysql.adb to do some null action?

I admit I am a student programmer in Ada, and I don't want to be a bother to one who has done such a great service. It is my hope that SparForte will become a foundation of Ada usefulness in my work. If it is as I imagine and hope it may compete with zsh for being my primary shell and mini-program writing. As a part-time personal assistant I write lot's of mini-programs from time to time to automate otherwise long and tedious tasks. Most are Perl (for Mac or other portability) or Zsh (functionality), but better still I enjoy writing my beginner Ada programs. If I can harness Ada's power directly into results instead of fussing over design and compile stages, I can accomplish much more -- and possible in less time. This is my hope and I would gladly contribute bit by bit to the SpareForte project when I can. :)

kburtch commented 8 years ago

Thanks for your kind words. I've had requests to add some zsh features.

I've pushed out a bug fix.

micahwelf commented 8 years ago

Thank you! I feel like rejoicing for how easily it compiled and now runs. It may take a while before I fully feel out the differences between Ada and SparForte enough to harness it, but if I can duplicate these results anywhere that I work that will be satisfaction enough in the moment. I look forward to other happy days with you. If you want me to test any new changes, I am sending you an email so you can contact me in the future.