FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

install/compile problem

 
Post new topic   Reply to topic     Forum Index -> DDBI
View previous topic :: View next topic  
Author Message
elgato



Joined: 29 Dec 2007
Posts: 20

PostPosted: Tue Feb 05, 2008 4:12 pm    Post subject: install/compile problem Reply with quote

Hi,
i have downloaded sources from trunk, then made 'dsss build -version=dbi_mysql', then 'dsss install'.
tried to compile example and got errors:
Code:

[root@localhost networking]# dsss build httpserver.d
httpserver.d => httpserver
+ /opt/dmd/bin/rebuild -Idsss_imports/ -I. -S./ -I/opt/dmd/include/d -S/opt/dmd/lib/  -I/opt/dmd/include/d -S/opt/dmd/lib -I/root/d/include/d -S/root/d/lib  -oqdsss_objs/D  httpserver.d -ofhttpserver
WARNING: Module httpserver.d does not have a module declaration. This can cause problems
         with rebuild's -oq option. If an error occurs, fix this first.
httpserver.d(32): Error: identifier 'MysqlDatabase' is not defined
httpserver.d(32): Error: MysqlDatabase is used as a type
httpserver.d(32): variable httpserver.main.Provider.service.db voids have no value
httpserver.d(32): Error: identifier 'MysqlDatabase' is not defined
httpserver.d(32): Error: MysqlDatabase is used as a type
httpserver.d(32): Error: new can only create structs, dynamic arrays or class objects, not void's
httpserver.d(32): Error: cannot implicitly convert expression (new void("dbname=test;host=localhost;port=3306","root","null")) of type void* to int
Command /opt/dmd/bin/rebuild returned with code 256, aborting.
Error: Command failed, aborting.


tried to find answer in forum...

PS: my goal is to make D connectable to mysql/postgres
Back to top
View user's profile Send private message
larsivi
Site Admin


Joined: 27 Mar 2004
Posts: 453
Location: Trondheim, Norway

PostPosted: Wed Feb 06, 2008 2:12 am    Post subject: Reply with quote

It is hard to say exactly without seeing your source, but it looks like you're not actually importing dbi.mysql.MysqlDatabase.
Back to top
View user's profile Send private message
elgato



Joined: 29 Dec 2007
Posts: 20

PostPosted: Wed Feb 06, 2008 7:43 am    Post subject: Reply with quote

everyline from examples, tried also SQLite, had the same errors but with SQLiteDatabase...
Back to top
View user's profile Send private message
larsivi
Site Admin


Joined: 27 Mar 2004
Posts: 453
Location: Trondheim, Norway

PostPosted: Wed Feb 06, 2008 7:48 am    Post subject: Reply with quote

ah, you will need the -version=dbi_mysql when building your app too.
Back to top
View user's profile Send private message
elgato



Joined: 29 Dec 2007
Posts: 20

PostPosted: Wed Feb 06, 2008 9:11 am    Post subject: Reply with quote

you mean i need to do:
dsss build myapp.d -version=dbi_mysql
instead of:
dsss build myapp.d ?
Back to top
View user's profile Send private message
larsivi
Site Admin


Joined: 27 Mar 2004
Posts: 453
Location: Trondheim, Norway

PostPosted: Wed Feb 06, 2008 11:33 am    Post subject: Reply with quote

Yes?
Back to top
View user's profile Send private message
elgato



Joined: 29 Dec 2007
Posts: 20

PostPosted: Wed Feb 06, 2008 2:27 pm    Post subject: Reply with quote

Added -version=dbi_mysql to dmd.conf,
now try to do
dsss build in ddbi trunk and recieve

Code:
[root@localhost ddbi]# dsss build
Creating imports for dbi

dbi => dbi
+ /opt/dmd/bin/rebuild -Idsss_imports/ -I. -S./ -I/opt/dmd/include/d -S/opt/dmd/lib/  -I/opt/dmd/include/d -S/opt/dmd/lib -I/root/d/include/d -S/root/d/lib  -oqdsss_objs/D  -explicit -lib dbi/DBIException.d dbi/ErrorCode.d dbi/Result.d dbi/SqlGen.d dbi/sqlite/SqliteError.d dbi/sqlite/SqliteDatabase.d dbi/sqlite/all.d dbi/sqlite/imp.d dbi/sqlite/SqliteResult.d dbi/all.d dbi/oracle/imp/ociap.d dbi/oracle/imp/orid.d dbi/oracle/imp/ocidef.d dbi/oracle/imp/ociextp.d dbi/oracle/imp/odci.d dbi/oracle/imp/ocidfn.d dbi/oracle/imp/nzt.d dbi/oracle/imp/xa.d dbi/oracle/imp/oratypes.d dbi/oracle/imp/ocikpr.d dbi/oracle/imp/ocidem.d dbi/oracle/imp/oci8dp.d dbi/oracle/imp/oci.d dbi/oracle/imp/oci1.d dbi/oracle/imp/oro.d dbi/oracle/imp/ociapr.d dbi/oracle/imp/orl.d dbi/oracle/imp/nzerror.d dbi/oracle/imp/ort.d dbi/oracle/imp/ori.d dbi/oracle/imp/ocixmldb.d dbi/oracle/all.d dbi/oracle/OracleDatabase.d dbi/oracle/OracleResult.d dbi/msql/MsqlDatabase.d dbi/msql/MsqlResult.d dbi/msql/all.d dbi/msql/imp.d dbi/odbc/OdbcResult.d dbi/odbc/all.d dbi/odbc/OdbcDatabase.d dbi/Database.d dbi/mssql/all.d dbi/mssql/MssqlResult.d dbi/mssql/imp.d dbi/mssql/MssqlDatabase.d dbi/mssql/MssqlDate.d dbi/Metadata.d dbi/Statement.d dbi/PreparedStatement.d dbi/ib/IbResult.d dbi/ib/all.d dbi/ib/IbDatabase.d dbi/ib/imp.d dbi/Registry.d dbi/mysql/MysqlDatabase.d dbi/mysql/MysqlPreparedStatement.d dbi/mysql/MysqlResult.d dbi/mysql/imp_win.d dbi/mysql/all.d dbi/mysql/MysqlError.d dbi/mysql/imp.d dbi/Row.d -oflibdbi.a

testddbi.d => testddbi
+ /opt/dmd/bin/rebuild -Idsss_imports/ -I. -S./ -I/opt/dmd/include/d -S/opt/dmd/lib/  -I/opt/dmd/include/d -S/opt/dmd/lib -I/root/d/include/d -S/root/d/lib  -oqdsss_objs/D  testddbi.d -oftestddbi
gcc dsss_objs/D/_testddbi.o dsss_objs/D/tango.util.log.Log.o dsss_objs/D/tango.util.log.Logger.o dsss_objs/D/tango.time.Time.o dsss_objs/D/tango.util.log.Appender.o dsss_objs/D/tango.util.log.Event.o dsss_objs/D/tango.time.Clock.o dsss_objs/D/tango.sys.Common.o dsss_objs/D/tango.sys.linux.linux.o dsss_objs/D/tango.stdc.time.o dsss_objs/D/tango.stdc.config.o dsss_objs/D/tango.stdc.stddef.o dsss_objs/D/tango.stdc.posix.dlfcn.o dsss_objs/D/tango.stdc.posix.config.o dsss_objs/D/tango.stdc.posix.fcntl.o dsss_objs/D/tango.stdc.stdint.o dsss_objs/D/tango.stdc.posix.sys.types.o dsss_objs/D/tango.stdc.posix.sys.stat.o dsss_objs/D/tango.stdc.posix.time.o dsss_objs/D/tango.stdc.posix.signal.o dsss_objs/D/tango.stdc.signal.o dsss_objs/D/tango.stdc.posix.poll.o dsss_objs/D/tango.stdc.posix.pwd.o dsss_objs/D/tango.stdc.posix.unistd.o dsss_objs/D/tango.stdc.posix.inttypes.o dsss_objs/D/tango.stdc.inttypes.o dsss_objs/D/tango.stdc.posix.sys.select.o dsss_objs/D/tango.stdc.posix.sys.time.o dsss_objs/D/tango.sys.linux.epoll.o dsss_objs/D/tango.stdc.errno.o dsss_objs/D/tango.stdc.string.o dsss_objs/D/tango.util.log.model.ILevel.o dsss_objs/D/tango.util.log.model.IHierarchy.o dsss_objs/D/tango.util.log.EventLayout.o dsss_objs/D/tango.util.log.Hierarchy.o dsss_objs/D/tango.text.convert.Layout.o dsss_objs/D/tango.text.convert.Utf.o dsss_objs/D/tango.text.convert.Float.o dsss_objs/D/tango.text.convert.Integer.o dsss_objs/D/tango.util.log.Configurator.o dsss_objs/D/tango.util.log.ConsoleAppender.o dsss_objs/D/tango.io.Console.o dsss_objs/D/tango.io.Buffer.o dsss_objs/D/tango.io.model.IBuffer.o dsss_objs/D/tango.io.model.IConduit.o dsss_objs/D/tango.io.DeviceConduit.o dsss_objs/D/tango.io.Conduit.o dsss_objs/D/dbi.Registry.o dsss_objs/D/dbi.Database.o dsss_objs/D/tango.text.Util.o dsss_objs/D/tango.io.Stdout.o dsss_objs/D/tango.io.Print.o dsss_objs/D/dbi.DBIException.o dsss_objs/D/tango.core.Vararg.o dsss_objs/D/dbi.ErrorCode.o dsss_objs/D/dbi.Result.o dsss_objs/D/dbi.Row.o dsss_objs/D/dbi.Statement.o dsss_objs/D/tango.text.Regex.o dsss_objs/D/tango.stdc.stdio.o dsss_objs/D/tango.stdc.stdarg.o dsss_objs/D/tango.stdc.ctype.o dsss_objs/D/tango.stdc.stdlib.o dsss_objs/D/tango.core.BitArray.o dsss_objs/D/dbi.SqlGen.o dsss_objs/D/dbi.mysql.MysqlDatabase.o dsss_objs/D/tango.stdc.stringz.o dsss_objs/D/dbi.mysql.imp.o dsss_objs/D/dbi.mysql.MysqlError.o dsss_objs/D/dbi.mysql.MysqlResult.o -o testddbi -m32 -Xlinker --start-group -ltango-base-dmd -Xlinker -L./ -Xlinker -L/opt/dmd/lib/ -Xlinker -L/opt/dmd/lib -Xlinker -L/root/d/lib -ltango-user-dmd -Xlinker -L/opt/dmd/lib -ltango-user-dmd -Xlinker -L/opt/dmd/lib -ltango-base-dmd -lpthread -lm
dsss_objs/D/dbi.mysql.MysqlDatabase.o: In function `_D3dbi5mysql13MysqlDatabase12_staticCtor1FZv':
dbi/mysql/MysqlDatabase.d:(.text._D3dbi5mysql13MysqlDatabase12_staticCtor1FZv+0x7): undefined reference to `mysql_get_client_version'
dsss_objs/D/dbi.mysql.MysqlDatabase.o: In function `_D3dbi5mysql13MysqlDatabase13MysqlDatabase5_ctorMFZC3dbi5mysql13MysqlDatabase13MysqlDatabase':
dbi/mysql/MysqlDatabase.d:(.text._D3dbi5mysql13MysqlDatabase13MysqlDatabase5_ctorMFZC3dbi5mysql13MysqlDatabase13MysqlDatabase+0xc): undefined reference to `mysql_init'
dsss_objs/D/dbi.mysql.MysqlDatabase.o: In function `_D3dbi5mysql13MysqlDatabase13MysqlDatabase7connectMFAaAaAaZv':
dbi/mysql/MysqlDatabase.d:(.text._D3dbi5mysql13MysqlDatabase13MysqlDatabase7connectMFAaAaAaZv+0xb6): undefined reference to `mysql_real_connect'
dbi/mysql/MysqlDatabase.d:(.text._D3dbi5mysql13MysqlDatabase13MysqlDatabase7connectMFAaAaAaZv+0xc4): undefined reference to `mysql_errno'
dbi/mysql/MysqlDatabase.d:(.text._D3dbi5mysql13MysqlDatabase13MysqlDatabase7connectMFAaAaAaZv+0xf3): undefined reference to `mysql_error'
dsss_objs/D/dbi.mysql.MysqlDatabase.o: In function `_D3dbi5mysql13MysqlDatabase13MysqlDatabase5closeMFZv':
dbi/mysql/MysqlDatabase.d:(.text._D3dbi5mysql13MysqlDatabase13MysqlDatabase5closeMFZv+0x28): undefined reference to `mysql_close'
dbi/mysql/MysqlDatabase.d:(.text._D3dbi5mysql13MysqlDatabase13MysqlDatabase5closeMFZv+0x35): undefined reference to `mysql_errno'
dbi/mysql/MysqlDatabase.d:(.text._D3dbi5mysql13MysqlDatabase13MysqlDatabase5closeMFZv+0x64): undefined reference to `mysql_error'
dsss_objs/D/dbi.mysql.MysqlDatabase.o: In function `_D3dbi5mysql13MysqlDatabase13MysqlDatabase7executeMFAaZv':
dbi/mysql/MysqlDatabase.d:(.text._D3dbi5mysql13MysqlDatabase13MysqlDatabase7executeMFAaZv+0x24): undefined reference to `mysql_real_query'
dbi/mysql/MysqlDatabase.d:(.text._D3dbi5mysql13MysqlDatabase13MysqlDatabase7executeMFAaZv+0x53): undefined reference to `mysql_error'
dsss_objs/D/dbi.mysql.MysqlDatabase.o: In function `_D3dbi5mysql13MysqlDatabase13MysqlDatabase5queryMFAaZC3dbi5mysql11MysqlResult11MysqlResult':
dbi/mysql/MysqlDatabase.d:(.text._D3dbi5mysql13MysqlDatabase13MysqlDatabase5queryMFAaZC3dbi5mysql11MysqlResult11MysqlResult+0x2a): undefined reference to `mysql_real_query'
dbi/mysql/MysqlDatabase.d:(.text._D3dbi5mysql13MysqlDatabase13MysqlDatabase5queryMFAaZC3dbi5mysql11MysqlResult11MysqlResult+0x34): undefined reference to `mysql_store_result'
dbi/mysql/MysqlDatabase.d:(.text._D3dbi5mysql13MysqlDatabase13MysqlDatabase5queryMFAaZC3dbi5mysql11MysqlResult11MysqlResult+0x63): undefined reference to `mysql_error'
dsss_objs/D/dbi.mysql.MysqlDatabase.o: In function `_D3dbi5mysql13MysqlDatabase13MysqlDatabase12getErrorCodeMFZi':
dbi/mysql/MysqlDatabase.d:(.text._D3dbi5mysql13MysqlDatabase13MysqlDatabase12getErrorCodeMFZi+0x31): undefined reference to `mysql_error'
dbi/mysql/MysqlDatabase.d:(.text._D3dbi5mysql13MysqlDatabase13MysqlDatabase12getErrorCodeMFZi+0x6a): undefined reference to `mysql_errno'
dsss_objs/D/dbi.mysql.MysqlDatabase.o: In function `_D3dbi5mysql13MysqlDatabase13MysqlDatabase15getErrorMessageMFZAa':
dbi/mysql/MysqlDatabase.d:(.text._D3dbi5mysql13MysqlDatabase13MysqlDatabase15getErrorMessageMFZAa+0x15): undefined reference to `mysql_error'
dsss_objs/D/dbi.mysql.MysqlDatabase.o: In function `_D3dbi5mysql13MysqlDatabase13MysqlDatabase15getLastInsertIDMFZl':
dbi/mysql/MysqlDatabase.d:(.text._D3dbi5mysql13MysqlDatabase13MysqlDatabase15getLastInsertIDMFZl+0x15): undefined reference to `mysql_insert_id'
dsss_objs/D/dbi.mysql.MysqlResult.o: In function `_D3dbi5mysql11MysqlResult11MysqlResult5_ctorMFPS3dbi5mysql3imp12st_mysql_resZC3dbi5mysql11MysqlResult11MysqlResult':
dbi/mysql/MysqlResult.d:(.text._D3dbi5mysql11MysqlResult11MysqlResult5_ctorMFPS3dbi5mysql3imp12st_mysql_resZC3dbi5mysql11MysqlResult11MysqlResult+0x12): undefined reference to `mysql_fetch_fields'
dbi/mysql/MysqlResult.d:(.text._D3dbi5mysql11MysqlResult11MysqlResult5_ctorMFPS3dbi5mysql3imp12st_mysql_resZC3dbi5mysql11MysqlResult11MysqlResult+0x20): undefined reference to `mysql_num_fields'
dsss_objs/D/dbi.mysql.MysqlResult.o: In function `_D3dbi5mysql11MysqlResult11MysqlResult8fetchRowMFZC3dbi3Row3Row':
dbi/mysql/MysqlResult.d:(.text._D3dbi5mysql11MysqlResult11MysqlResult8fetchRowMFZC3dbi3Row3Row+0x1d): undefined reference to `mysql_fetch_row'
dbi/mysql/MysqlResult.d:(.text._D3dbi5mysql11MysqlResult11MysqlResult8fetchRowMFZC3dbi3Row3Row+0x2a): undefined reference to `mysql_fetch_lengths'
dsss_objs/D/dbi.mysql.MysqlResult.o: In function `_D3dbi5mysql11MysqlResult11MysqlResult6finishMFZv':
dbi/mysql/MysqlResult.d:(.text._D3dbi5mysql11MysqlResult11MysqlResult6finishMFZv+0x23): undefined reference to `mysql_free_result'
collect2: ld returned 1 exit status
--- errorlevel 1
Command /opt/dmd/bin/rebuild returned with code 65280, aborting.
Error: Command failed, aborting.
[root@localhost ddbi]#


Sad
Back to top
View user's profile Send private message
elgato



Joined: 29 Dec 2007
Posts: 20

PostPosted: Thu Feb 07, 2008 9:33 am    Post subject: Reply with quote

maybe i need some not D module for mysql? ddbi actually lacks some documentation on installation, because usage is clear for any perl,php,python programmer, but installation is something weird...
tried to install without any "-version=dbi_mysql" at first time and got errors from the first post, then according to your advice added "-version=dbi_mysql" to dmd.conf and got another errors, tried also to make dbi_sqlite and got the same errors but missing sqlite functions... tried search, but found nothing(
Back to top
View user's profile Send private message
larsivi
Site Admin


Joined: 27 Mar 2004
Posts: 453
Location: Trondheim, Norway

PostPosted: Thu Feb 07, 2008 10:43 am    Post subject: Reply with quote

You will need to pass the libs for the database you are building to dsss, however this may different depending on your platform. On linux, I would expect you to need the switch -L-lmysql (or similarly) to use mysql.
Back to top
View user's profile Send private message
elgato



Joined: 29 Dec 2007
Posts: 20

PostPosted: Fri Feb 08, 2008 3:05 am    Post subject: Reply with quote

It works:)
Installation tips for mysql:
1) get ddbi trunk
2) add to dmd.conf '-version=dbi_mysql -L-lmysql -L-lmysqlclient'
3) do 'dsss build'
3a) if you have linux and dsss throws an error with "can't find mysqlclient" then make a symlink from /usr/lib/mysql/libmysqlclient.so.* to /usr/lib/libmysqlclient.so
4) do 'dsss install'
5) have fun Very Happy
Back to top
View user's profile Send private message
elgato



Joined: 29 Dec 2007
Posts: 20

PostPosted: Fri Feb 08, 2008 5:34 am    Post subject: Reply with quote

Code:

import  tango.core.Thread;

import  tango.net.http.HttpConst;

import  tango.util.log.Configurator;

import  mango.net.http.server.HttpServer,
        mango.net.http.server.HttpRequest,
        mango.net.http.server.HttpResponse,
        mango.net.http.server.HttpProvider;

import dbi.mysql.all;
import dbi.Row;

void main ()
{
        // our simple http hander
        class Provider : HttpProvider
        {
                override void service (HttpRequest request, HttpResponse response)
                {
                        MysqlDatabase db = new MysqlDatabase();
                        db.connect("dbname=test;host=localhost;port=3306","root","");
                        db.close();

                        // return an HTML page saying "HTTP Error: 200 OK"
                        response.sendError (HttpResponses.OK);
                }
        }
        // bind server to port 8080 on a local address
        auto addr = new InternetAddress (4667);

        // create a (1 thread) server using the ServiceProvider to service requests
        auto server = new HttpServer (new Provider, addr, 100, 100);

        // start listening for requests (but this thread does not listen)
        server.start;
}



i try this code, just to test dbi connections speed multithreaded. connect for each request. running for example 5 threads it goes ok, but 10 or more gives: segmentation fault, what can it be?
Back to top
View user's profile Send private message
elgato



Joined: 29 Dec 2007
Posts: 20

PostPosted: Mon Mar 24, 2008 2:19 pm    Post subject: Reply with quote

solved by commenting mysql_errno blocks on connect/close
something weird..
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> DDBI All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group