1. edbi on 64 bit machines?
- Posted by egis Apr 23, 2012
- 4437 views
Does edbi using mysql drivers work on a linux 64 bit machine? What I have tied so far is:
- Modified /usr/share/euphoria/edbi/drivers/mysql/edbi_mysql.e and changed line 64 to "/usr/lib64/libmysqlclient.so.15.0.0", -- stupid hack for openeuphoria.org
- Ran the command: /usr/share/euphoria/edbi/drivers/mysql/ euc -dll edbi_mysql.e
- The compile appears to have worked with out any errors.
- Ran ldconfig
However upon runnning a known working test program on a 32 bit platform I get:
Fatal run-time error: Could not find a suitable MySQL shared library
Any advice?
2. Re: edbi on 64 bit machines?
- Posted by mattlewis (admin) Apr 23, 2012
- 4396 views
Does edbi using mysql drivers work on a linux 64 bit machine?
If all you have are 64-bit libraries, then 32-bit euphoria will not work. You'll either need to install (or build) 32-bit mysql libraries, or use a 64-bit version of euphoria.
It looks like it's been some time since a 64-bit eubin of 4.1 has been posted. I'll try to get fresh 4.1 eubins up later.
Matt
3. Re: edbi on 64 bit machines?
- Posted by egis Apr 23, 2012
- 4386 views
I installed Debian Package for 64-bit systems (32-bit euphoria binaries).
The following three files ended up in lib64 not lib or lib32 (a result of euc -dll edbi_mysql.e ?).
/usr/lib64/libmysqlclient_r.so.15.0.0
/usr/lib64/libmysqlclient.so.15.0.0
/usr/lib64/libmysqlclient.so.15
4. Re: edbi on 64 bit machines?
- Posted by mattlewis (admin) Apr 23, 2012
- 4404 views
I installed Debian Package for 64-bit systems (32-bit euphoria binaries).
Yes, that's still a 32-bit binary. It's just an installer that will run on a 64-bit system.
Matt
5. Re: edbi on 64 bit machines?
- Posted by mattlewis (admin) Apr 23, 2012
- 4349 views
Does edbi using mysql drivers work on a linux 64 bit machine?
If all you have are 64-bit libraries, then 32-bit euphoria will not work. You'll either need to install (or build) 32-bit mysql libraries, or use a 64-bit version of euphoria.
It looks like it's been some time since a 64-bit eubin of 4.1 has been posted. I'll try to get fresh 4.1 eubins up later.
I uploaded a new eubin (plus include files, etc) here. I only did the 64-bit version.
Matt
7. Re: edbi on 64 bit machines?
- Posted by egis Apr 24, 2012
- 4291 views
I installed the 64 bit euphoria. Upon comiling the edbi driver using euc -dll I get some errors.
The line gcc: /usr/share/euphoria/bin/eudbgso.a: No such file or directory indicates a problem. Can someone please make a suggestion as to what is wrong?
/usr/share/euphoria/edbi/drivers/mysql # euc -dll edbi_mysql.e Build directory: build-827921/ Translating code, pass: 1 2 3 4 generating Compiling with GCC Compiling 1% init-.c Compiling 6% edbi_mysql.c Compiling 9% main-.c Compiling 13% datetime.c Compiling 16% dll.c Compiling 19% error.c Compiling 22% machine.c Compiling 26% memconst.c Compiling 29% memory.c Compiling 32% types.c Compiling 36% get.c Compiling 39% io.c Compiling 42% text.c Compiling 45% convert.c Compiling 49% search.c Compiling 52% filesys.c Compiling 55% math.c Compiling 59% rand.c Compiling 62% sequence.c Compiling 65% sort.c Compiling 68% wildcard.c Compiling 72% pretty.c Compiling 75% serialize.c Compiling 78% scinot.c Compiling 81% map.c Compiling 85% eumem.c Compiling 88% primes.c Compiling 91% stats.c Compiling 95% info.c Compiling 98% url.c Linking 100% ../edbi_mysql.so gcc: /usr/share/euphoria/bin/eudbgso.a: No such file or directory Unable to link /usr/share/euphoria/edbi/drivers/mysql/edbi_mysql.so Status: 256 Command: gcc -o /usr/share/euphoria/edbi/drivers/mysql/edbi_mysql.so init-.o edbi_mysql.o main-.o datetime.o dll.o error.o machine.o memconst.o memory.o types.o get.o io.o text.o convert.o search.o filesys.o math.o rand.o sequence.o sort.o wildcard.o pretty.o serialize.o scinot.o map.o eumem.o primes.o stats.o info.o url.o /usr/share/euphoria/bin/eudbgso.a -m64 -shared -ldl -lm -lpthread
Thanks.
8. Re: edbi on 64 bit machines?
- Posted by mattlewis (admin) Apr 24, 2012
- 4258 views
I installed the 64 bit euphoria. Upon comiling the edbi driver using euc -dll I get some errors.
The line gcc: /usr/share/euphoria/bin/eudbgso.a: No such file or directory indicates a problem. Can someone please make a suggestion as to what is wrong?
Oops...I need to update the build process to include those files. There are some additional translator runtime libraries for 64-bits. I'll try to post a new version, but that probably won't happen until tomorrow.
Matt
10. Re: edbi on 64 bit machines?
- Posted by mattlewis (admin) Apr 25, 2012
- 4215 views
I installed the 64 bit euphoria. Upon comiling the edbi driver using euc -dll I get some errors.
The line gcc: /usr/share/euphoria/bin/eudbgso.a: No such file or directory indicates a problem. Can someone please make a suggestion as to what is wrong?
Oops...I need to update the build process to include those files. There are some additional translator runtime libraries for 64-bits. I'll try to post a new version, but that probably won't happen until tomorrow.
OK, new eubins.
Matt
11. Re: edbi on 64 bit machines?
- Posted by egis Apr 25, 2012
- 4175 views
So it looks as if I could compile but there are some problems. Here is the compile listing:
tm22:/usr/share/euphoria/edbi/drivers/mysql # ../../../bin/euc -dll edbi_mysql.e Build directory: build-887075/ Translating code, pass: 1 2 3 4 generating Compiling with GCC Compiling 1% init-.c Compiling 6% edbi_mysql.c Compiling 9% main-.c Compiling 13% datetime.c Compiling 16% dll.c Compiling 19% error.c Compiling 22% machine.c Compiling 26% memconst.c Compiling 29% memory.c Compiling 32% types.c Compiling 36% get.c Compiling 39% io.c Compiling 42% text.c Compiling 45% convert.c Compiling 49% search.c Compiling 52% filesys.c Compiling 55% math.c Compiling 59% rand.c Compiling 62% sequence.c Compiling 65% sort.c Compiling 68% wildcard.c Compiling 72% pretty.c Compiling 75% serialize.c Compiling 78% scinot.c Compiling 81% map.c Compiling 85% eumem.c Compiling 88% primes.c Compiling 91% stats.c Compiling 95% info.c Compiling 98% url.c Linking 100% ../edbi_mysql.so
I then made a copy edbi_mysql.so to /usr/share/lib (it still exists in /usr/share/euphora/edbi/drivers/mysql/)
I then ran ldconfig
My edbi_mysql.e: constant lib_mysql file points to:
constant lib_mysql = open_dll({ "/usr/lib64/libmysqlclient.so.15.0.0",
Upon running my program I get:
tm22:/srv/www/htdocs/cgi # eui svgmap_test.ex /usr/share/euphoria/include/std/error.e:50 in procedure crash() Could not open driver as: /usr/share/euphoria/edbi/drivers/mysql/edbi_mysql.so /usr/share/euphoria/edbi/drivers/edbi_mysql.so edbi_mysql.so ... called from /usr/share/euphoria/include/std/../../edbi/edbi/edbi.e:334 in function open() ... called from /srv/www/htdocs/cgi/./db.e:7 in function open_db() ... called from /srv/www/htdocs/cgi/./svg.e:29 --> See ex.err
The permissions on edbi_mysql.so are open. I know the program works on 32 bit.
Any clues?
Thanks for all of your help!
12. Re: edbi on 64 bit machines?
- Posted by jimcbrown (admin) Apr 25, 2012
- 4181 views
(it still exists in /usr/share/euphora/edbi/drivers/mysql/)
This most likely is the case, but ...
Is this a typo for /usr/share/euphoria/edbi/drivers/mysql/ ?
That is, euphoria with an i ?
If not, then that might be part of the problem.
I then made a copy edbi_mysql.so to /usr/share/lib
This most likely is the case, but ...
Are you sure /usr/share/lib is in the library path? That is, is it in /etc/ld.so.conf ?
Also, are you sure this is in the right lib directory? That is, the library is visible in /usr/share/lib64 ?
Upon running my program I get:
tm22:/srv/www/htdocs/cgi # eui svgmap_test.ex /usr/share/euphoria/include/std/error.e:50 in procedure crash() Could not open driver as: /usr/share/euphoria/edbi/drivers/mysql/edbi_mysql.so /usr/share/euphoria/edbi/drivers/edbi_mysql.so edbi_mysql.so ... called from /usr/share/euphoria/include/std/../../edbi/edbi/edbi.e:334 in function open() ... called from /srv/www/htdocs/cgi/./db.e:7 in function open_db() ... called from /srv/www/htdocs/cgi/./svg.e:29 --> See ex.err
The permissions on edbi_mysql.so are open. I know the program works on 32 bit.
Any clues?
Thanks for all of your help!
So you built the driver twice? Once for 32bit and once for 64bit?
Are you sure that the 64bit library is really 64bit?
You can confirm by using the command-line utility file:
$ file /usr/lib32/libxml.so.1.8.17 /usr/lib32/libxml.so.1.8.17: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), not stripped $ file /usr/lib64/libaaa.so.1.0.4 /usr/lib64/libaa.so.1.0.4: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), stripped $
If it's really 64bit, then it should be identified as an "ELF 64-bit" but if it says that it is an "ELF 32-bit" then it is a 32bit library that can't be loaded by a 64bit euphoria.
If the library really is 64bit and it really is in the right place, then try running ldd on it. That might list some missing dependencies that need to be fixed before you can load the driver.
13. Re: edbi on 64 bit machines?
- Posted by egis Apr 26, 2012
- 4139 views
Is this a typo for /usr/share/euphoria/edbi/drivers/mysql/ ?
That is, euphoria with an i ?
That was a typo, it is in /usr/share/euphoria/edbi/drivers/mysql/
Are you sure /usr/share/lib is in the library path? That is, is it in /etc/ld.so.conf ?
I was wrong here (I did not have access to the machine when I wrote the previous post)
I should have said a copy of edbi_mysql.so was put into /usr/lib64/ not /usr/share/lib. I also tried putting edbi_mysql.so into /usr/lib/ but later removed it and re-ran ldconfig.
/etc/ld.so.conf contains
/usr/X11R6/lib64/Xaw3d /usr/X11R6/lib64 /usr/lib64/Xaw3d /usr/X11R6/lib/Xaw3d /usr/X11R6/lib /usr/lib/Xaw3d /usr/x86_64-suse-linux/lib /opt/kde3/lib /opt/gnome/lib /lib64 /lib /usr/lib64 /usr/lib /usr/local/lib64 /usr/local/lib /opt/kde3/lib64 /opt/gnome/lib64 include /etc/ld.so.conf.d/[astrix].conf
So you built the driver twice? Once for 32bit and once for 64bit?
Yes, although several times.
Are you sure that the 64bit library is really 64bit?
file gives:
file /usr/share/euphoria/edbi/drivers/mysql/edbi_mysql.so edbi_musql.so: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped file /usr/lib64/libmysqlclient.so.15.0.0 libmysqlclient.so.15.0.0: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped
If it's really 64bit, then it should be identified as an "ELF 64-bit" but if it says that it is an "ELF 32-bit" then it is a 32bit library that can't be loaded by a 64bit euphoria.
If the library really is 64bit and it really is in the right place, then try running ldd on it. That might list some missing dependencies that need to be fixed before you can load the driver.
The results from ldd seems to make sense and all of the refrenced files exist.
ldd edbi_mysql.so gives:
/usr/share/euphoria/edbi/drivers/mysql # ldd edbi_mysql.so libdl.so.2 => /lib64/libdl.so.2 (0x00002aafe8c41000) libm.so.6 => /lib64/libm.so.6 (0x00002aafe8e45000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00002aafe909b000) libc.so.6 => /lib64/libc.so.6 (0x00002aafe92b7000) /lib64/ld-linux-x86-64.so.2 (0x0000555555554000)
ldd /usr/lib64/libmysqlclient.so.15.0.0 gives:
libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00002adc2d23b000) libnsl.so.1 => /lib64/libnsl.so.1 (0x00002adc2d474000) libm.so.6 => /lib64/libm.so.6 (0x00002adc2d68b000) libz.so.1 => /lib64/libz.so.1 (0x00002adc2d8e2000) libc.so.6 => /lib64/libc.so.6 (0x00002adc2daf7000) /lib64/ld-linux-x86-64.so.2 (0x0000555555554000)
Would a reboot help? It is on a server so I dont like to do that if I can avoid it.
Any other suggestions?
14. Re: edbi on 64 bit machines?
- Posted by jimcbrown (admin) Apr 26, 2012
- 4074 views
file gives:
file /usr/share/euphoria/edbi/drivers/mysql/edbi_mysql.so edbi_musql.so: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped
This looks strange to me. You appear to have a typo in the file name. Also, file (at least version 4.12) should be displaying the full path, not just the file name.
Would a reboot help? It is on a server so I dont like to do that if I can avoid it.
I doubt it would help.
Any other suggestions?
Can you double check the permissions on /usr/share/euphoria/edbi/drivers/mysql/edbi_mysql.so ? With /bin/ls or stat ?
You could try a "chmod 777" on it to make the permissions as open as possible.
Finally, you could try this:
$ echo 'int main() { return 0; }' > temp.c $ gcc -m64 -o temp temp.c /usr/share/euphoria/edbi/drivers/mysql/edbi_mysql.so $ ./temp
That might provide more insight into why this is failing.
15. Re: edbi on 64 bit machines?
- Posted by egis Apr 26, 2012
- 4109 views
I already did chmod 777.
Finally, you could try this:
$ echo 'int main() { return 0; }' > temp.c $ gcc -m64 -o temp temp.c /usr/share/euphoria/edbi/drivers/mysql/edbi_mysql.so $ ./temp
I tried this. temp was created and there were no errors. What should I expect if something was wrong or right?
Are there any flags that I should use with euc -dll for 64 bit machines?
16. Re: edbi on 64 bit machines?
- Posted by egis Apr 26, 2012
- 4093 views
fyi:
file temp temp: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.6.4, dynamically linked (uses shared libs), for GNU/Linux 2.6.4, not stripped
17. Re: edbi on 64 bit machines?
- Posted by egis Apr 26, 2012
- 4128 views
Is it possible that my libmysqlclient is libmysqlclient.so.15.0.0 instead of libmysqlclient.so.16.0.0?
18. Re: edbi on 64 bit machines?
- Posted by mattlewis (admin) Apr 26, 2012
- 4091 views
Is it possible that my libmysqlclient is libmysqlclient.so.15.0.0 instead of libmysqlclient.so.16.0.0?
Could be. From the thread, I'm not sure if we've established the following:
- Were you able to run ldd on the edbi driver file you translated?
- Does it load properly using open_dll() with an absolute path?
If both of those work, then it sounds like an issue with edbi finding it.
Oh! I remember fighting this before. Basically, IIRC, ldconfig assumes that your dynamically loaded libraries start with "lib" and ignores anything that doesn't start that way. But the edbi file isn't named like that. I think that I changed the name of the file to have lib at the beginning, and modified edbi to look for a driver with that name. Otherwise, you might have to put it into a directory where edbi looks.
Matt
19. Re: edbi on 64 bit machines?
- Posted by jimcbrown (admin) Apr 26, 2012
- 4101 views
I already did chmod 777.
Are you unable to copy and paste the results?
I tried this. temp was created and there were no errors. What should I expect if something was wrong or right?
gcc should have failed with an explaination why it could not link. Or at least temp should have displayed an error when you ran it.
Since nothing happened in either case, it worked. Since it worked, it means your libraries are fine.
That means the problem is with svgmap_test.ex or with eui. Perhaps eui is a 32bit executable - that would explain why it would be unable to load the 64bit library as an edbi driver, but works fine when everything is 32bit.
20. Re: edbi on 64 bit machines?
- Posted by jimcbrown (admin) Apr 26, 2012
- 4099 views
Is it possible that my libmysqlclient is libmysqlclient.so.15.0.0 instead of libmysqlclient.so.16.0.0?
Based on everything else you pasted earlier in this thread, it is definitely 15, not 16. But based on what you pasted earlier in this thread, that is not a problem, since the code is looking for 15 and not 16 anyways.
Even if this was a problem, this is not the immediate problem. edbi doesn't get this far. It dies trying to load edbi_mysql.so, before edbi_mysql.so can try to load libmysqlclient.so.15.0.0
21. Re: edbi on 64 bit machines?
- Posted by Jerome Apr 26, 2012
- 4068 views
Even if this was a problem, this is not the immediate problem. edbi doesn't get this far. It dies trying to load edbi_mysql.so, before edbi_mysql.so can try to load libmysqlclient.so.15.0.0
To add another data point, I downloaded edbi on my 64 bit Ubuntu and did the following:
cd ~/Code/Euphoria/edbi/drivers/mysql euc -so edbi_mysql.e sudo mv edbi_mysql.so /usr/local/lib/. sudo ldconfig
As a quick fix, I changed edbi.e around line 330 to this:
--sequence dll_name3 = sprintf("edbi_%s.%s", { driver, SHARED_LIB_EXT }) sequence dll_name3 = "/usr/local/lib/edbi_mysql.so"
I was able to succesfully run the t_myslq.e in unittest after putting in my mysql information, but had several failures. All of these tests pass on my 32bit system.
eutest -verbose -all t_mysql.e interpreting t_mysql.e: CMD 'eui -d UNITTEST -batch t_mysql.e -all' passed: Open database passed: Drop table TestNum passed: Create table TestNum passed: Insert values into TestNum passed: Checking INTEGER data types with Query Rows... failed: Checking DOUBLE data types with Query Rows..., expected: 76.4 but got: 0 failed: Checking REAL data types with Query Rows..., expected: 3.14159 but got: 76.4 passed: Checking INTEGER data types with Query... failed: Checking DOUBLE data types with Query..., expected: 76.4 but got: 0 failed: Checking REAL data types with Query..., expected: 3.14159 but got: 76.4 passed: Open database passed: Drop table TestString passed: Create table TestString passed: Insert values into string table failed: Checking TEXT data types with Query Rows..., expected: "A Tale of Two Cities" but got: 0 failed: Checking VARCHAR(30) data types with Query Rows..., expected: "Charles Dickens" but got: "" failed: Checking BLOB data types with Query Rows..., expected: "English" but got: 0 failed: Checking DATETIME data types with Query Rows..., expected: {1859,1,1,23,59,0} but got: 0 failed: Checking DATE data types with Query Rows..., expected: {2000,10,13,0,0,0} but got: 0 failed: Checking TEXT data types with Query..., expected: "A Tale of Two Cities" but got: 0 failed: Checking VARCHAR(30) data types with Query..., expected: "Charles Dickens" but got: "" failed: Checking BLOB data types with Query..., expected: "English" but got: 0 failed: Checking DATETIME data types with Query..., expected: {1859,1,1,23,59,0} but got: 0 failed: Checking DATE data types with Query..., expected: {2000,10,13,0,0,0} but got: 0 24 tests run, 10 passed, 14 failed, 42% success ...
And for reference:
eui --version Euphoria Interpreter v4.1.0 development 64-bit Linux, Using System Memory Revision Date: 2012-04-25 09:43:17, Id: 5545:6b3fc2c6be44
ls -alt libmysqlclient.so lrwxrwxrwx 1 root root 20 2012-03-28 15:46 libmysqlclient.so -> libmysqlclient.so.16
Hope this helps!
- Ira
22. Re: edbi on 64 bit machines?
- Posted by mattlewis (admin) Apr 27, 2012
- 4096 views
I was able to succesfully run the t_myslq.e in unittest after putting in my mysql information, but had several failures. All of these tests pass on my 32bit system.
...
Hope this helps!
Yes! It looks like some of the edbi mysql driver isn't portable. I think edbi_next() is probably causing most (if not all) of this. Try updating it (untested):
function peek_longu( object ptr ) ifdef LONG32 then return peek4u( ptr ) elsedef return peek8u( ptr ) end ifdef end function public function edbi_next(atom dbr, atom row) atom p_lengths, p_row = c_func(h_mysql_fetch_row, {dbr}) integer field_count object data = {}, tmp row = row -- not used if p_row = 0 then return 0 end if p_lengths = mysql_fetch_lengths(dbr) field_count = mysql_num_fields(dbr) integer row_offset = 0 integer len_offset = 0 for i = 0 to (field_count - 1) * sizeof( C_POINTER ) by sizeof( C_POINTER ) do data &= {peek({peek_pointer(p_row + row_offset), peek_longu(p_lengths + len_offset)})} row_offset += sizeof( C_POINTER ) len_offset += sizeof( C_LONG ) end for return data end function
I think that this code has inspired me to add the peek/poke long variants to euphoria (possibly just in the std library).
Matt
23. Re: edbi on 64 bit machines?
- Posted by Jerome Apr 27, 2012
- 4017 views
Yes! It looks like some of the edbi mysql driver isn't portable. I think edbi_next() is probably causing most (if not all) of this. Try updating it (untested):
Matt, thanks for the update! It looks like only sequences are failing now except for VARCHAR.
eutest -verbose -all t_mysql.e interpreting t_mysql.e: CMD 'eui -d UNITTEST -batch t_mysql.e -all' passed: Open database passed: Drop table TestNum passed: Create table TestNum passed: Insert values into TestNum passed: Checking INTEGER data types with Query Rows... passed: Checking DOUBLE data types with Query Rows... passed: Checking REAL data types with Query Rows... passed: Checking INTEGER data types with Query... passed: Checking DOUBLE data types with Query... passed: Checking REAL data types with Query... passed: Open database passed: Drop table TestString passed: Create table TestString passed: Insert values into string table failed: Checking TEXT data types with Query Rows..., expected: "A Tale of Two Cities" but got: 0 passed: Checking VARCHAR(30) data types with Query Rows... failed: Checking BLOB data types with Query Rows..., expected: "English" but got: 0 failed: Checking DATETIME data types with Query Rows..., expected: {1859,1,1,23,59,0} but got: 1859 failed: Checking DATE data types with Query Rows..., expected: {2000,10,13,0,0,0} but got: 2000 failed: Checking TEXT data types with Query..., expected: "A Tale of Two Cities" but got: 0 passed: Checking VARCHAR(30) data types with Query... failed: Checking BLOB data types with Query..., expected: "English" but got: 0 failed: Checking DATETIME data types with Query..., expected: {1859,1,1,23,59,0} but got: 1859 failed: Checking DATE data types with Query..., expected: {2000,10,13,0,0,0} but got: 2000 24 tests run, 16 passed, 8 failed, 67% success
Thanks,
Ira
24. Re: edbi on 64 bit machines?
- Posted by mattlewis (admin) Apr 27, 2012
- 3956 views
Yes! It looks like some of the edbi mysql driver isn't portable. I think edbi_next() is probably causing most (if not all) of this. Try updating it (untested):
Matt, thanks for the update! It looks like only sequences are failing now except for VARCHAR.
Looks like mysql_fetch_direct() is also lacking in portability. Try this (again, untested):
ifdef BITS32 then constant MYSQL_FIELD_type = 76 elsedef constant MYSQL_FIELD_type = 112 end ifdef function mysql_fetch_field_direct(atom dbr, integer idx) atom p_f = c_func(h_mysql_fetch_field_direct, { dbr, idx }) sequence name = peek_string(peek_pointer(p_f)) integer typ = peek4u(p_f + MYSQL_FIELD_type) return { name, typ } end function
Matt
25. Re: edbi on 64 bit machines?
- Posted by Jerome Apr 27, 2012
- 4015 views
Looks like mysql_fetch_direct() is also lacking in portability. Try this (again, untested):
That solved it; thanks again Matt!
eutest -verbose -all t_mysql.e interpreting t_mysql.e: CMD 'eui -d UNITTEST -batch t_mysql.e -all' ... ... 24 tests run, 24 passed, 0 failed, 100% success
Thanks,
Ira
26. Re: edbi on 64 bit machines?
- Posted by egis Apr 30, 2012
- 3908 views
I'm still getting some errors (I am looking into them and they are probably mine). However, is the following edbi_mysql.e file correct (based on the previous posts)?
See --vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv for the location of changes.
-- -- Copyright (C) 2009,2010 by Jeremy Cowgar <jeremy@cowgar.com> -- -- This file is part of edbi. -- -- edbi is free software: you can redistribute it and/or modify -- it under the terms of the GNU Lesser General Public License as -- published by the Free Software Foundation, either version 3 of -- the License, or (at your option) any later version. -- -- edbi is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU Lesser General Public -- License along with edbi. If not, see <http://www.gnu.org/licenses/>. -- include std/datetime.e as dt include std/dll.e include std/error.e include std/get.e include std/machine.e include std/map.e include std/search.e include std/text.e include std/net/url.e include std/pretty.e include edbi/defs.e enum MYSQL_TYPE_DECIMAL=0, MYSQL_TYPE_TINY, MYSQL_TYPE_SHORT, MYSQL_TYPE_LONG, MYSQL_TYPE_FLOAT, MYSQL_TYPE_DOUBLE, MYSQL_TYPE_NULL, MYSQL_TYPE_TIMESTAMP, MYSQL_TYPE_LONGLONG, MYSQL_TYPE_INT24, MYSQL_TYPE_DATE, MYSQL_TYPE_TIME, MYSQL_TYPE_DATETIME, MYSQL_TYPE_YEAR, MYSQL_TYPE_NEWDATE, MYSQL_TYPE_VARCHAR, MYSQL_TYPE_BIT, MYSQL_TYPE_NEWDECIMAL=246, MYSQL_TYPE_ENUM=247, MYSQL_TYPE_SET=248, MYSQL_TYPE_TINY_BLOB=249, MYSQL_TYPE_MEDIUM_BLOB=250, MYSQL_TYPE_LONG_BLOB=251, MYSQL_TYPE_BLOB=252, MYSQL_TYPE_VAR_STRING=253, MYSQL_TYPE_STRING=254, MYSQL_TYPE_GEOMETRY=255 --vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv constant lib_mysql = open_dll({ "/usr/lib64/libmysqlclient.so.15", -- stupid hack for openeuphoria.org "libmysqlclient.so", "libmysqlclient.dylib", "libmysql.dll" }) --vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv ifdef BITS32 then constant MYSQL_FIELD_type = 76 elsedef constant MYSQL_FIELD_type = 112 end ifdef if lib_mysql = 0 then crash("Could not find a suitable MySQL shared library") end if constant h_mysql_init = define_c_func(lib_mysql, "mysql_init", {C_POINTER}, C_POINTER), h_mysql_real_connect = define_c_func(lib_mysql, "mysql_real_connect", { C_POINTER, C_POINTER, C_POINTER, C_POINTER, C_POINTER, C_UINT, C_POINTER, C_ULONG}, C_POINTER), h_mysql_close = define_c_proc(lib_mysql, "mysql_close", {C_POINTER}), h_mysql_error = define_c_func(lib_mysql, "mysql_error", {C_POINTER}, C_POINTER), h_mysql_errno = define_c_func(lib_mysql, "mysql_errno", {C_POINTER}, C_INT), h_mysql_real_query = define_c_func(lib_mysql, "mysql_real_query", {C_POINTER, C_POINTER, C_ULONG}, C_INT), h_mysql_field_count = define_c_func(lib_mysql, "mysql_field_count", {C_POINTER}, C_UINT), h_mysql_use_result = define_c_func(lib_mysql, "mysql_use_result", {C_POINTER}, C_POINTER), h_mysql_free_result = define_c_proc(lib_mysql, "mysql_free_result", {C_POINTER}), h_mysql_fetch_row = define_c_func(lib_mysql, "mysql_fetch_row", {C_POINTER}, C_POINTER), h_mysql_num_fields = define_c_func(lib_mysql, "mysql_num_fields", {C_POINTER}, C_UINT), h_mysql_fetch_lengths = define_c_func(lib_mysql, "mysql_fetch_lengths", {C_POINTER}, C_POINTER), h_mysql_insert_id = define_c_func(lib_mysql, "mysql_insert_id", {C_POINTER}, C_ULONG), h_mysql_fetch_field_direct = define_c_func(lib_mysql, "mysql_fetch_field_direct", {C_POINTER, C_INT}, C_POINTER), h_mysql_affected_rows = define_c_func(lib_mysql, "mysql_affected_rows", {C_POINTER}, C_INT) integer did_initialize = 0 function mysql_init(atom dbh=0) return c_func(h_mysql_init, {dbh}) end function include std/pretty.e public function edbi_open(sequence conn_str) object host, user, passwd, db, port, socket, flags conn_str = "mysql://" & conn_str object params = url:parse(conn_str, 0) host = params[URL_HOSTNAME] port = defaulted_value(params[URL_PORT], 0) db = params[URL_PATH][2..$] user = params[URL_USER] passwd = params[URL_PASSWORD] --socket = map:get(params[URL_QUERY_STRING], "socket", 0) --flags = map:get(params[URL_QUERY_STRING], "flags", 0) socket = 0 flags = 0 if port = 0 then port = 3306 end if if sequence(host) then host = allocate_string(host) end if if sequence(user) then user = allocate_string(user) end if if sequence(passwd) then passwd = allocate_string(passwd) end if if sequence(db) then db = allocate_string(db) end if if sequence(socket) then socket = allocate_string(socket) end if atom dbh = mysql_init() atom p_mysql = c_func(h_mysql_real_connect, {dbh, host, user, passwd, db, port, socket, flags}) free({ host, user, passwd, db }) if socket != 0 then free(socket) end if return p_mysql end function public procedure edbi_close(atom dbh) c_proc(h_mysql_close, {dbh}) end procedure public function edbi_error_code(atom dbh) return c_func(h_mysql_errno, {dbh}) end function public function edbi_error_message(atom dbh) sequence message = "" atom p_error = c_func(h_mysql_error, {dbh}) if p_error != NULL then -- Memory is free'd by MySQL when connection is closed message = peek_string(p_error) end if return message end function public function edbi_last_insert_id(atom dbh, sequence seq_name) seq_name = seq_name -- not used return c_func(h_mysql_insert_id, {dbh}) end function function mysql_field_count(atom dbh) return c_func(h_mysql_field_count, {dbh}) end function function mysql_use_result(atom dbh) return c_func(h_mysql_use_result, {dbh}) end function --vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv function mysql_fetch_field_direct(atom dbr, integer idx) atom p_f = c_func(h_mysql_fetch_field_direct, { dbr, idx }) sequence name = peek_string(peek_pointer(p_f)) integer typ = peek4u(p_f + MYSQL_FIELD_type) return { name, typ } end function public procedure edbi_closeq(atom dbr) c_proc(h_mysql_free_result, {dbr}) end procedure function mysql_num_fields(atom dbr) return c_func(h_mysql_num_fields, {dbr}) end function function mysql_fetch_lengths(atom dbr) return c_func(h_mysql_fetch_lengths, {dbr}) end function --vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv function peek_longu( object ptr ) ifdef LONG32 then return peek4u( ptr ) elsedef return peek8u( ptr ) end ifdef end function --vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv public function edbi_next(atom dbr, atom row) atom p_lengths, p_row = c_func(h_mysql_fetch_row, {dbr}) integer field_count object data = {}, tmp row = row -- not used if p_row = 0 then return 0 end if p_lengths = mysql_fetch_lengths(dbr) field_count = mysql_num_fields(dbr) integer row_offset = 0 integer len_offset = 0 for i = 0 to (field_count - 1) * sizeof( C_POINTER ) by sizeof( C_POINTER ) do data &= {peek({peek_pointer(p_row + row_offset), peek_longu(p_lengths + len_offset)})} row_offset += sizeof( C_POINTER ) len_offset += sizeof( C_LONG ) end for return data end function public function edbi_execute(atom dbh, sequence sql) atom p_sql = allocate_string(sql) integer result = c_func(h_mysql_real_query, {dbh, p_sql, length(sql)}) free(p_sql) return result end function public function edbi_total_changes(atom dbh) return c_func(h_mysql_affected_rows, { dbh }) end function public function edbi_query(atom dbh, sequence sql) integer q_result = edbi_execute(dbh, sql) if not q_result = 0 then return 0 end if atom dbr = mysql_use_result(dbh) sequence fdata = repeat(0, mysql_num_fields(dbr)) for i = 1 to length(fdata) do object f = mysql_fetch_field_direct(dbr, i - 1) integer ftype = EU_SEQUENCE -- Default is a SEQUENCE switch f[2] do case MYSQL_TYPE_DECIMAL, MYSQL_TYPE_FLOAT, MYSQL_TYPE_DOUBLE, MYSQL_TYPE_NEWDECIMAL then ftype = EU_ATOM case MYSQL_TYPE_TINY, MYSQL_TYPE_SHORT, MYSQL_TYPE_LONG, MYSQL_TYPE_LONGLONG, MYSQL_TYPE_INT24 then ftype = EU_INTEGER case MYSQL_TYPE_TIMESTAMP, MYSQL_TYPE_DATE, MYSQL_TYPE_TIME, MYSQL_TYPE_DATETIME then ftype = EU_DATETIME end switch fdata[i] = { f[1], ftype } end for return { dbr, fdata } end function
27. Re: edbi on 64 bit machines?
- Posted by Jerome May 01, 2012
- 3829 views
I'm still getting some errors (I am looking into them and they are probably mine). However, is the following edbi_mysql.e file correct (based on the previous posts)?
I updated the edbi mercurial repository with Matt's changes for compatability with 64 bit euphoria; check it out here: https://bitbucket.org/jcowgar/edbi/downloads. Let me know if these changes don't work on your system!
Thanks,
Ira
28. Re: edbi on 64 bit machines?
- Posted by egis May 04, 2012
- 3699 views
I've tried running a script that uses edbi on two diffrent 64 bit machines (suse and unbutu 12.04). The script does work on a 32 bit machine. I was able to compile edbi_mysql.so driver without errors. Euphoria does work on the 64 bit machine.
I get the same error on both 64 bit machines.
I know that edbi_mysql.so is in: /usr/share/euphoria/edbi/drivers/mysql/edbi_mysql.so and /usr/lib/edbi_mysql.so
I ran ldconfig.
file /usr/lib/edbi_mysql.so outputs:
/usr/lib/edbi_mysql.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=0x06b9fc2549df19b598cb8b42b73548deb9646751, not stripped
When running my test program with edbi I get:
eui test.ex /usr/share/euphoria/include/std/error.e:50 in procedure crash() Could not open driver as: /usr/share/euphoria/edbi/drivers/mysql/edbi_mysql.so /usr/share/euphoria/edbi/drivers/edbi_mysql.so edbi_mysql.so ... called from /usr/share/euphoria/include/std/../../edbi/edbi/edbi.e:336 in function open() ... called from /var/www/cgi/./db.e:7 in function open_db() ... called from /var/www/cgi/./svg.e:29 --> See ex.err
Permissions on edbi_mysql.so are:
ls -all /usr/share/euphoria/edbi/drivers/mysql/edbi_mysql.so -rwxr-xr-x 1 root root 1097862 May 3 23:27 /usr/share/euphoria/edbi/drivers/mysql/edbi_mysql.so ls -all /usr/lib/edbi_mysql.so -rwxr-xr-x 1 root root 1097862 May 3 23:51 /usr/lib/edbi_mysql.so
Please help...
29. Re: edbi on 64 bit machines?
- Posted by jimcbrown (admin) May 04, 2012
- 3757 views
I've tried running a script that uses edbi on two diffrent 64 bit machines (suse and unbutu 12.04). The script does work on a 32 bit machine. I was able to compile edbi_mysql.so driver without errors. Euphoria does work on the 64 bit machine.
I get the same error on both 64 bit machines.
I know that edbi_mysql.so is in: /usr/share/euphoria/edbi/drivers/mysql/edbi_mysql.so and /usr/lib/edbi_mysql.so
I ran ldconfig.
file /usr/lib/edbi_mysql.so outputs:
/usr/lib/edbi_mysql.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=0x06b9fc2549df19b598cb8b42b73548deb9646751, not stripped
When running my test program with edbi I get:
eui test.ex /usr/share/euphoria/include/std/error.e:50 in procedure crash() Could not open driver as: /usr/share/euphoria/edbi/drivers/mysql/edbi_mysql.so /usr/share/euphoria/edbi/drivers/edbi_mysql.so edbi_mysql.so ... called from /usr/share/euphoria/include/std/../../edbi/edbi/edbi.e:336 in function open() ... called from /var/www/cgi/./db.e:7 in function open_db() ... called from /var/www/cgi/./svg.e:29 --> See ex.err
Permissions on edbi_mysql.so are:
ls -all /usr/share/euphoria/edbi/drivers/mysql/edbi_mysql.so -rwxr-xr-x 1 root root 1097862 May 3 23:27 /usr/share/euphoria/edbi/drivers/mysql/edbi_mysql.so ls -all /usr/lib/edbi_mysql.so -rwxr-xr-x 1 root root 1097862 May 3 23:51 /usr/lib/edbi_mysql.so
Please help...
Seeing that the file sizes are the same, I'm going to guess that /usr/share/euphoria/edbi/drivers/mysql/edbi_mysql.so is a 64bit LSB even though you didn't explicitly say so this time.
You haven't actually given any new information since your last post.
Try this:
gcc -m64 -c -o /tmp/ju.o /tmp/ju.c gcc -m64 -o /tmp/ju.so -shared /tmp/ju.o eui /tmp/ju.e
With these:
-- ju.e include dll.e atom a a = open_dll("/tmp/ju.so") atom c c = define_c_proc(a, "testme", {}) c_proc(c, {})
/* ju.c */ #include <stdio.h> void testme() { printf("testme\n"); }
And let me know what the output is.
Also, try this:
which eui file `which eui`
30. Re: edbi on 64 bit machines?
- Posted by mattlewis (admin) May 04, 2012
- 3718 views
When running my test program with edbi I get:
eui test.ex /usr/share/euphoria/include/std/error.e:50 in procedure crash() Could not open driver as: /usr/share/euphoria/edbi/drivers/mysql/edbi_mysql.so /usr/share/euphoria/edbi/drivers/edbi_mysql.so edbi_mysql.so ... called from /usr/share/euphoria/include/std/../../edbi/edbi/edbi.e:336 in function open() ... called from /var/www/cgi/./db.e:7 in function open_db() ... called from /var/www/cgi/./svg.e:29 --> See ex.err
Try putting edbi_mysql.so in one of those places where it's trying to look:
/usr/share/euphoria/edbi/drivers/mysql/edbi_mysql.so /usr/share/euphoria/edbi/drivers/edbi_mysql.so
I don't think that ldconfig even considers anything that doesn't start with "lib," at least not normally. I can only get "normal" behavior if I rename edbi_mysql.so to libedbi_mysql.so (but edbi doesn't look for that). If I use a hard coded path (which appears to be what edbi does) then I can use open_dll() to successfully link to the library.
Matt
31. Re: edbi on 64 bit machines?
- Posted by Jerome May 04, 2012
- 3670 views
Try putting edbi_mysql.so in one of those places where it's trying to look:
/usr/share/euphoria/edbi/drivers/mysql/edbi_mysql.so /usr/share/euphoria/edbi/drivers/edbi_mysql.so
Sorry, this is my fault! I updated edbi to check /usr/lib and /usr/local/lib but did not update the corresponding crash report. I believe the OP is using the new edbi.e now, so eui should be able to find it. The new edbi.e has this starting at line 325:
325: sequence dll_name4 = sprintf("/usr/local/lib/edbi_%s.%s", { driver, SHARED_LIB_EXT } ) 326: sequence dll_name5 = sprintf("/usr/lib/edbi_%s.%s", { driver, SHARED_LIB_EXT } ) ... 334: atom hDll = open_dll({ dll_name1, dll_name2, dll_name3, dll_name4, dll_name5 })
If this is the case, then maybe jimcbrown's example can shed some light on why the shared library isn't opening.
Thanks,
Ira
32. Re: edbi on 64 bit machines?
- Posted by jimcbrown (admin) May 04, 2012
- 3630 views
Permissions on edbi_mysql.so are:
ls -all /usr/share/euphoria/edbi/drivers/mysql/edbi_mysql.so -rwxr-xr-x 1 root root 1097862 May 3 23:27 /usr/share/euphoria/edbi/drivers/mysql/edbi_mysql.so
Try putting edbi_mysql.so in one of those places where it's trying to look:
/usr/share/euphoria/edbi/drivers/mysql/edbi_mysql.so
Matt, are you reading egis's posts before you reply?
33. Re: edbi on 64 bit machines?
- Posted by mattlewis (admin) May 04, 2012
- 3650 views
Permissions on edbi_mysql.so are:
ls -all /usr/share/euphoria/edbi/drivers/mysql/edbi_mysql.so -rwxr-xr-x 1 root root 1097862 May 3 23:27 /usr/share/euphoria/edbi/drivers/mysql/edbi_mysql.so
Try putting edbi_mysql.so in one of those places where it's trying to look:
/usr/share/euphoria/edbi/drivers/mysql/edbi_mysql.so
Matt, are you reading egis's posts before you reply?
Oops. I did, but I guess my comprehension was less than perfect.
Matt
34. Re: edbi on 64 bit machines?
- Posted by egis May 04, 2012
- 3750 views
In order for me to complie edbi_mysql.so I needed to set any includes of edbi to something relatively explicit such as
--include edbi/defs.e include std/../../edbi/edbi/defs.e
I dont know where edbi gets set explicitly.
In example.ex I needed to explicitly set include /usr/share/euphoria/edbi/edbi/edbi.e instead of include edbi/edbi.e
I put edbi_mysql.so in all of the places that are refrenced in edbi.e
public function open(sequence connection, object routines = 0 ) sequence _ = split(connection, "://") sequence driver = _[1], conn_str = _[2] sequence dll_name1 = sprintf("%s/%s/edbi_%s.%s", { driver_path, driver, driver, SHARED_LIB_EXT }) sequence dll_name2 = sprintf("%s/edbi_%s.%s", { driver_path, driver, SHARED_LIB_EXT }) sequence dll_name3 = sprintf("edbi_%s.%s", { driver, SHARED_LIB_EXT }) sequence dll_name4 = sprintf("/usr/local/lib/edbi_%s.%s", { driver, SHARED_LIB_EXT } ) sequence dll_name5 = sprintf("/usr/lib/edbi_%s.%s", { driver, SHARED_LIB_EXT } ) sequence m_seq = repeat(0, T_END)
dll_name* is:
dll_name1: ../drivers/mysql/edbi_mysql.so dll_name2: ../drivers/edbi_mysql.so dll_name3: edbi_mysql.so dll_name4: /usr/local/lib/edbi_mysql.so dll_name5: /usr/lib/edbi_mysql.so
open_dll would still returns 0.
I then hard coded dll_name1 to = "/usr/share/euphoria/edbi/drivers/mysql/edbi_mysql.so" and open_dll still returns 0.
Upon running edbi/examples/example.ex using my password and user gives the following message:
eui example.ex /usr/share/euphoria/include/std/error.e:50 in procedure crash() Could not open driver as: ../drivers/mysql/edbi_mysql.so ../drivers/edbi_mysql.so edbi_mysql.so ... called from /usr/share/euphoria/edbi/edbi/edbi.e:336 in function open() ... called from /usr/share/euphoria/edbi/examples/example.ex:26 --> See ex.err
Here is a listing of some of my directories:
ls -all /usr/share/euphoria/edbi/drivers/mysql/ total 1152 drwxrwxrwx 7 root root 4096 May 4 01:11 . drwxrwxrwx 6 root root 4096 May 4 11:09 .. drwx------ 2 root root 4096 May 3 22:39 build-045172 drwx------ 2 root root 4096 May 3 22:32 build-354788 drwx------ 2 root root 4096 May 3 22:43 build-412080 drwx-w--w- 2 root root 4096 May 3 22:11 build-555478 drwx-w--w- 2 root root 4096 May 3 22:25 build-781932 -rw-r-xr-x 1 root root 834 May 3 22:39 defs.e -rwxrwxrwx 1 root root 8231 May 4 01:10 edbi_mysql.e -rwxrwxrwx 1 root root 1097862 May 4 01:11 edbi_mysql.so -rw-rw-rw- 1 root root 242 May 1 06:29 eu.cfg -rw-rw-rw- 1 root root 14738 May 4 01:13 ex.err ls -all /usr/share/euphoria/edbi/drivers/ total 1104 drwxrwxrwx 6 root root 4096 May 4 11:09 . drwxrwxrwx 6 root root 4096 May 3 21:34 .. -rw-rw-rw- 1 root root 929 May 1 06:29 edbi.h -rwxr-xr-x 1 root root 1097862 May 4 11:09 edbi_mysql.so drwxrwxrwx 2 root root 4096 May 3 21:34 eusql drwxrwxrwx 7 root root 4096 May 4 01:11 mysql drwxrwxrwx 2 root root 4096 May 3 21:34 pgsql drwxrwxrwx 2 root root 4096 May 3 21:34 sqlite3 ls -all /usr/local/lib/edbi* -rwxr-xr-x 1 root root 1097862 May 4 11:07 /usr/local/lib/edbi_mysql.so ls -all /usr/lib/edbi* -rwxrwxrwx 1 root root 1097862 May 4 11:10 /usr/lib/edbi_mysql.so
I also wanted to say that I built a new 64 bit os from scratch just for this. I did not previously have easy access to a 64 bit machine and was relying on other people to run various tests. So I can now finaly run 64 bit programs on my local machine. That is why it took me some extra time between posts.
So since it was a fresh install I used:
euphoria: http://openeuphoria.org/eubins/linux/4.1.0/64-bit/euphoria-4.1.0-Linux-ix86_64-6b3fc2c6be44.tar.gz
and
edbi: http://bitbucket.org/jcowgar/edbi/get/default.tar.gz
Is there anything else that would be useful to know?
Thanks.
35. Re: edbi on 64 bit machines?
- Posted by jimcbrown (admin) May 04, 2012
- 3698 views
In order for me to complie edbi_mysql.so I needed to set any includes of edbi to something relatively explicit such as
--include edbi/defs.e include std/../../edbi/edbi/defs.e
I dont know where edbi gets set explicitly.
In example.ex I needed to explicitly set include /usr/share/euphoria/edbi/edbi/edbi.e instead of include edbi/edbi.e
That's done with eu.cfg - but this is something that can be fixed later.
I also wanted to say that I built a new 64 bit os from scratch just for this. I did not previously have easy access to a 64 bit machine and was relying on other people to run various tests. So I can now finaly run 64 bit programs on my local machine. That is why it took me some extra time between posts.
This means that all the previous tests that you ran (e.g. checking permissions and making sure these are really 64bit LSBs, running ldd to check for missing dependencies, etc) need to be run again.
Is there anything else that would be useful to know?
36. Re: edbi on 64 bit machines?
- Posted by egis May 04, 2012
- 3667 views
Ok you may have found something. Here is my output:
gcc -m64 -c -o /tmp/ju.o /tmp/ju.c root@tree:/tmp# gcc -m64 -o /tmp/ju.so -shared /tmp/ju.o /usr/bin/ld: /tmp/ju.o: relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC /tmp/ju.o: could not read symbols: Bad value collect2: ld returned 1 exit status root@tree:/tmp# eui /tmp/ju.e /tmp/ju.e:7 c_proc/c_func: bad routine number (-1) --> See ex.err root@tree:/tmp# which eui /usr/bin/eui root@tree:/tmp# file `which eui` /usr/bin/eui: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, BuildID[sha1]=0xef479ad0380e2d79a699d65d54a036cb804a9d3b, stripped
Most importat, the last command spits out 32-bit! What do I do about that?
37. Re: edbi on 64 bit machines?
- Posted by mattlewis (admin) May 04, 2012
- 3661 views
Most importat, the last command spits out 32-bit! What do I do about that?
When you use the 64-bit translator, by default it should build a 64-bit binary, and when you specify -dll or -so, it should link with euso.a (instead of eu.a). I like to use the -makefile option, because I can easily see exactly what options it will use, and because I can easily change them (or link with a different library). Also, for large programs, I can use make's -j flag (usually -j3 or -j2) to have it compile multiple C files at a time, which speeds up the build.
Matt
38. Re: edbi on 64 bit machines?
- Posted by egis May 06, 2012
- 3644 views
edbi_mysql.so was generated using euc such as
../../../bin/euc -so edbi_mysql.e
not using gcc (at least as far as I know). And file edbi_mysql.so says that it is 64 bit. Perhaps I am not understanding something important here. What else can I do?
39. Re: edbi on 64 bit machines?
- Posted by jimcbrown (admin) May 06, 2012
- 3615 views
edbi_mysql.so was generated using euc such as
../../../bin/euc -so edbi_mysql.e
not using gcc (at least as far as I know). And file edbi_mysql.so says that it is 64 bit. Perhaps I am not understanding something important here. What else can I do?
The problem is that, on your 64bit system, eui is 32bit. A 32bit executable can not load or use a 64bit library.
It can't even open it with open_dll(), hence the error you are getting.
The solution is to replace your eui with a 64bit eui, but I'm not sure why or how you ended up with a 32bit /usr/bin/eui in the first place.
40. Re: edbi on 64 bit machines?
- Posted by egis May 06, 2012
- 3598 views
The solution is to replace your eui with a 64bit eui, but I'm not sure why or how you ended up with a 32bit /usr/bin/eui in the first place.
I got it from:
I installed the 64 bit euphoria. Upon comiling the edbi driver using euc -dll I get some errors.
The line gcc: /usr/share/euphoria/bin/eudbgso.a: No such file or directory indicates a problem. Can someone please make a suggestion as to what is wrong?
Oops...I need to update the build process to include those files. There are some additional translator runtime libraries for 64-bits. I'll try to post a new version, but that probably won't happen until tomorrow.
OK, new eubins.
Matt
Where should I get the correct euc from? Or do I just down load it from DownloadEuphoria (64 bit) and simply replace the euc in that package with the one from Matt's?
41. Re: edbi on 64 bit machines?
- Posted by mattlewis (admin) May 06, 2012
- 3612 views
The solution is to replace your eui with a 64bit eui, but I'm not sure why or how you ended up with a 32bit /usr/bin/eui in the first place.
I got it from:
OK, new eubins.
Where should I get the correct euc from? Or do I just down load it from DownloadEuphoria (64 bit) and simply replace the euc in that package with the one from Matt's?
Are you certain that's what you're using? I just looked at what's in there:
euphoria-4.1.0-Linux-ix86_64-68a44cbcfd15/bin$ ./eui -v Euphoria Interpreter v4.1.0 development 64-bit Linux, Using System Memory Revision Date: 2012-04-12 12:50:06, Id: 5543:68a44cbcfd15 euphoria-4.1.0-Linux-ix86_64-68a44cbcfd15/bin$ ldd ./eui linux-vdso.so.1 => (0x00007fff1e712000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f24cb024000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f24cae20000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f24cac02000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f24ca861000) /lib64/ld-linux-x86-64.so.2 (0x00007f24cb2d4000) euphoria-4.1.0-Linux-ix86_64-68a44cbcfd15/bin$ file eui eui: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, strippedThose are definitely 64-bit binaries. Did you ever install something else on this system?
Matt
42. Re: edbi on 64 bit machines?
- Posted by egis May 06, 2012
- 3596 views
I did a complete reinstall of linux the same day I installed the 64bit euphoria libraries rom DownloadEuphoria. When I first installed it the Ubuntu distribution package manager installed it. After that I needed to reinstall with the new package (Matt's). I 'rm -r /usr/share/euphoria' and un-tared the new tar archive (Matt's) and added back in the edbi code. Perhaps I have done something wrong and will try it again.
43. Re: edbi on 64 bit machines?
- Posted by mattlewis (admin) May 06, 2012
- 3591 views
I did a complete reinstall of linux the same day I installed the 64bit euphoria libraries rom DownloadEuphoria. When I first installed it the Ubuntu distribution package manager installed it. After that I needed to reinstall with the new package (Matt's). I 'rm -r /usr/share/euphoria' and un-tared the new tar archive (Matt's) and added back in the edbi code. Perhaps I have done something wrong and will try it again.
Deleting /usr/share/euphoria would get rid of the std library, but not the binaries. The package manager would put them into /usr/bin. My eubin upload was just a gzipped tarball.
I have my system set up to be able to use multiple versions of euphoria. For the purpose of dog fooding, I generally have the latest 64-bit version of euphoria from the structs branch. I also have all of the 4.0 releases set up in their own directories (in my home dir).
I have a separate directory set up that's in my path where I keep symlinks that go to the actual binaries. The symlinks include the release version, so I have eui404, euc403, etc, which makes it easy to test things with different versions. That's probably more than most people need.
Matt
44. Re: edbi on 64 bit machines?
- Posted by jimcbrown (admin) May 06, 2012
- 3601 views
I did a complete reinstall of linux the same day I installed the 64bit euphoria libraries rom DownloadEuphoria. When I first installed it the Ubuntu distribution package manager installed it. After that I needed to reinstall with the new package (Matt's). I 'rm -r /usr/share/euphoria' and un-tared the new tar archive (Matt's) and added back in the edbi code. Perhaps I have done something wrong and will try it again.
You should have removed the old installation through the package manager... you left the old 32bit eui in /usr/bin
45. Re: edbi on 64 bit machines?
- Posted by egis May 07, 2012
- 3572 views
Ok I seemed to have successfully installed euphoria 64 from source (eui works). I modfied edbi/drivers/mysql/eu.cfg to reflect the euphoria paths. When I try to run euc -so edbi_mysql.e it says
User supplied library does not exist: /usr/local/share/euphoria/bin/euso.als /usr/local/share/euphoria/bin
bugreport.ex buildcpdb.ex ecp.dat ed.ex eucoverage.ex euloc.exHow to I get euso.a or did my euphoria build have problems?
Thanks again!.
46. Re: edbi on 64 bit machines?
- Posted by mattlewis (admin) May 07, 2012
- 3576 views
Ok I seemed to have successfully installed euphoria 64 from source (eui works). I modfied edbi/drivers/mysql/eu.cfg to reflect the euphoria paths. When I try to run euc -so edbi_mysql.e it says
User supplied library does not exist: /usr/local/share/euphoria/bin/euso.als /usr/local/share/euphoria/bin
bugreport.ex buildcpdb.ex ecp.dat ed.ex eucoverage.ex euloc.exHow to I get euso.a or did my euphoria build have problems?
If you used "make install", then the libraries should have gone to /usr/local/lib:
$ ls /usr/local/lib/eu* /usr/local/lib/eu.a /usr/local/lib/eudbg.a /usr/local/lib/euso.a /usr/local/lib/eusodbg.a...and your translator should be using those by default, unless you've specified something different in eu.cfg or on the command line.
Matt
47. Re: edbi on 64 bit machines?
- Posted by egis May 07, 2012
- 3627 views
- Last edited Jun 19, 2012
EDBI works for me on Ubuntu 12.04 64 bit. THANKS FOR ALL OF YOUR HELP!
So here is a summary of my notes. It might not be correct for everyone but it worked for me. You will also need to fiddle with file/directory permissions and ownership as you go along (next time I do this I will add in chmod and chown to my notes here). If I knew more about scripts I would make one to make this easier. I just expect that these problems will eventually be fixed by the great Euphoria team.
- Removed existing euphoria
- Preferablly using the package manager remove euphoria
- Alternatively remove all references to my existing euphoria, and in my case:
- % rm -r /usr/share/euphoria
- % rm /usr/bin/eui
- Downloaded Matt's new eubins: http://openeuphoria.org/eubins/linux/4.1.0/64-bit/euphoria-4.1.0-Linux-ix86_64-6b3fc2c6be44.tar.gz
- % mkdir /euphoria
- using the archive manager decompressed the tarball and put it into /euphoria
- % mv euphoria-4.1.0-Linux-ix86_64-6b3fc2c6be44 euphoria-4.1.0
- Add /euphoria/euphoria-4.1.0/bin to the $PATH. Now this is probably not the correct way to do it but like I said it worked for me, so addjust it to your best knowledge.
- % echo 'pathmunge /euphoria/euphoria-4.1.0/bin' > /etc/profile.d/euphoria.sh
- % chmod +x /etc/profile.d/euphoria.sh
- I then had to log out and log back in to set $PATH.
- test your path: % echo $PATH
- build the new euphoria binaries
- % cd /euphoria/euphoria-4.1.0/source
- % ./configure
- % make (this takes a bit of time)
- % make install
- verify euphoria was installed
- % ls /usr/local/share/euphoria
- % ls /usr/local/lib/eu*
- see listing as per Matt's last comment
- Download edbi from jeremys web site:
- http://bitbucket.org/jcowgar/edbi/get/default.tar.gz
- decompress the files into /usr/local/share/euphoria
- % cd /usr/local/share/euphoria
- % mv jcowgar-edbi-106c52c61e33.tar-1 edbi
- Configure edbi files (since I am using mysql I made the following changes)
- % cd /usr/local/share/euphoria/edbi/drivers/mysql
- edit edbi_mysql.e
- find and modify the line just below constant lib_mysql = open_dll({
- in my case
"/usr/lib/x86_64-linux-gnu/libmysqlclient.so.18", -- stupid hack for openeuphoria.org
- you will need to make sure your libmysqlclient.so.xx file exists. In different versions of linux it is located in diffrent places. To make sure it exists and to match your specific version: % cd /usr; find -name libmysqlclient.so*;
- since I did not know how to set my edbi path in edbi_mysql.e I set it literally. I changed 'include edbi/defs.e' to 'include std/../../edbi/edbi/defs.e'
- edit eu.cfg. Mine looks like:
[all] -eudir /usr/local/share/euphoria -i /usr/local/share/euphoria/include -i ../../edbi [translate] -com /usr/local/lib/source/eu -lib /usr/local/lib/bin/eu.a -lib-pic /usr/local/lib/euso.a [bind] -eub /usr/local/share/euphoria/bin/eub
- build edbi_mysql.so
% euc -so edbi_mysql.e % chmod 755 edbi_mysql.so % cp /usr/local/share/euphoria/edbi/drivers/mysql/edbi_mysql.so /usr/local/lib/.
- FYI, the location of edbi_mysql.so is used in edbi.e. If you get errors verify that edbi_mysql.so is located in one of the places as specified in the variables (dll_name1 ... dll_name5)
- I changed the top of edbi's test example to work with just mysql and with a few minor changes. Here is the top of my modified /usr/local/share/euphoria/edbi/examples/example.ex. Make sure to change the constats: USER, PASSWORD, DB, and DB_ADDRESS.
include std/datetime.e include std/../../edbi/edbi/edbi.e ----------------------------------- -- change the following four constants to match your database configuration ----------------------------------- constant USER="your_user" constant PASSWORD="your_password" constant DB="test" constant DB_ADDRESS="localhost" sequence data = { { "Ronald Mc'Donald", 29382, datetime:subtract(datetime:new(), 32, YEARS) }, { "Super Man", 55555, datetime:new(1944, 5, 18) }, { "Wonder Woman", 21232, datetime:new(1972, 9, 29) } } edbi:set_driver_path("../drivers") edbi:db_handle dbh = edbi:open( "mysql://" & USER & ":" & PASSWORD & "@" & DB_ADDRESS & "/" & DB ) --ifdef sqlite3 then -- edbi:db_handle dbh = edbi:open("sqlite3://example.db") --elsifdef pgsql then -- edbi:db_handle dbh = edbi:open( sprintf("pgsql://%s:%s@localhost/pgtest",{USER,PASSWORD}) ) --elsedef --end ifdef
- finaly run example.ex: % eui example.ex
Please modify these notes to help others fumbling around in the dark.
If you like you can remove /euphoria.
48. Re: edbi on 64 bit machines?
- Posted by egis May 07, 2013
- 2311 views
I am trying to install on Linux Centos with 64 bit on a virtual machine.
When using make on version 4.1 I get the following output with errors:
make interpreter translator library debug-library backend shared-library debug-shared-library make[1]: Entering directory `/euphoria/euphoria-4.1.0/source' make euisource OBJDIR=intobj EBSD= CONFIG=config.gnu EDEBUG= EPROFILE= make[2]: Entering directory `/euphoria/euphoria-4.1.0/source' /euphoria/euphoria-4.1.0/source/build/mkver "hg" "/euphoria/euphoria-4.1.0/source/build/ver.cache" "/euphoria/euphoria-4.1.0/source/build/include/be_ver.h" sh: hg: command not found make[2]: Leaving directory `/euphoria/euphoria-4.1.0/source' make /euphoria/euphoria-4.1.0/source/build/eui OBJDIR=intobj EBSD= CONFIG=config.gnu EDEBUG= EPROFILE= make[2]: Entering directory `/euphoria/euphoria-4.1.0/source' /euphoria/euphoria-4.1.0/source/build/mkver "hg" "/euphoria/euphoria-4.1.0/source/build/ver.cache" "/euphoria/euphoria-4.1.0/source/build/include/be_ver.h" sh: hg: command not found gcc -m64 -c -Wall -DEUNIX -DELINUX -fsigned-char -ffast-math -fomit-frame-pointer -DESIMPLE_MALLOC -DARCH=ix86_64 -DELINUX -I /euphoria/euphoria-4.1.0/source/build/intobj/back -I /euphoria/euphoria-4.1.0/source/build/include be_machine.c -o/euphoria/euphoria-4.1.0/source/build/intobj/back/be_machine.o be_machine.c: In function ‘machine’: be_machine.c:3306: error: ‘INFINITY’ undeclared (first use in this function) be_machine.c:3306: error: (Each undeclared identifier is reported only once be_machine.c:3306: error: for each function it appears in.) make[2]: *** [/euphoria/euphoria-4.1.0/source/build/intobj/back/be_machine.o] Error 1 make[2]: Leaving directory `/euphoria/euphoria-4.1.0/source' make[1]: *** [interpreter] Error 2 make[1]: Leaving directory `/euphoria/euphoria-4.1.0/source' make: *** [all] Error 2
The first complaint is with: hg: command not found.
We installed from
http://openeuphoria.org/eubins/linux/4.1.0/64-bit/euphoria-4.1.0-Linux-ix86_64-6b3fc2c6be44.tar.gz
The source was changed to /euphoria/euphoria-4.1.0
Our config.gnu contains:
# File generated from configure CONFIGURE_PARAMS= EBSD= EOPENBSD= ENETBSD= EOSX= ELINUX=1 EMINGW= EUPHORIA=1 TRANSLATE=eui ec.ex ETARGET=LINUX ARCH=ix86_64 MSIZE=-m64 EFLAG=-d E64 CC_SUFFIX=gcc CC_PREFIX= RC_SUFFIX=windres SCP=scp -C SSH=ssh -C HG=hg TRUNKDIR=/euphoria/euphoria-4.1.0 BUILDDIR=/euphoria/euphoria-4.1.0/source/build CYPTRUNKDIR=/euphoria/euphoria-4.1.0 CYPBUILDDIR=/euphoria/euphoria-4.1.0/source/build XLTTARGETCC=gcc NO_CYGWIN= VERSION=4.1.0
Any help would be helpful.
49. Re: edbi on 64 bit machines?
- Posted by jimcbrown (admin) May 07, 2013
- 2305 views
I am trying to install on Linux Centos with 64 bit on a virtual machine.
When using make on version 4.1 I get the following output with errors:
The first complaint is with: hg: command not found.
You can ignore this one.
If you really want to fix it, just install mercurial.
Any help would be helpful.
The real issue is that for some reason, INFINITY is not defined in your math.h
Go to line 65 of be_machine.c - there's an alternative definition of INFINITY there. You can just delete the surrounding ifdefs and that should fix the build.
50. Re: edbi on 64 bit machines?
- Posted by egis May 07, 2013
- 2246 views
Thank you Jim. It looks like it did the trick. You are great!