code icon indicating copy to clipboard operation
code copied to clipboard

Not able to compile the SQLite example - Compilation Error: undefined symbol: zerofill

Open ajinkyakulkarni opened this issue 8 years ago • 12 comments

I am trying to compile the /Library/SQLite/SQLite3-test.red file and getting this error - "Compilation Error: undefined symbol: zero fill". Any advice?

Here is how I am trying to run the SQLite example and full error output -

$ ../../red-063 -c ../Library/SQLite/SQLite3-test.red

-=== Red Compiler 0.6.3 ===-

Compiling /Users/ajinkya/Downloads/code/Library/SQLite/SQLite3-test.red ...
...using libRedRT built on 12-Sep-2017/19:46:25-5:00
...compilation time : 86 ms

Target: Darwin

Compiling to native code...
*** Compilation Error: undefined symbol: zerofill
*** in file: %/Users/ajinkya/Downloads/code/Library/SQLite/SQLite3.red
*** at line: 9166
*** near: [
    zerofill dbs-head dbs-tail
    close-dbs: func [
        /local
        p [pointer! [integer!]]
    ] [
        p: dbs-head
        while [p < dbs-tail] [
            if p/value <> 0 [
                print-line ["closing db: " as pointer! [integer!] p/value]
                sqlite3_close as pointer! [integer!] p/value
                p/value: 0
            ]
            p: p + 1
        ]
    ]
    get-db-ptr:
]

ajinkyakulkarni avatar Sep 13 '17 01:09 ajinkyakulkarni

@Oldes ^---

dockimbel avatar Sep 13 '17 05:09 dockimbel

Works fine on Windows :-/ zerofill is defined in Red runtime - https://github.com/red/red/blob/master/runtime/allocator.reds#L152

Oldes avatar Sep 13 '17 07:09 Oldes

@dockimbel the reason will be, that @ajinkyakulkarni is using libRedRT and zerofill is probably not included. I wonder how to solve such an issues.

Oldes avatar Sep 13 '17 07:09 Oldes

@ajinkyakulkarni you can add -r into your compile command.

Oldes avatar Sep 13 '17 07:09 Oldes

Or delete libRedRT library (libRedRT.dll) on windows... on mac it should be something like libRedRT.dylib... and compile the script again using your command.. it should rebuild the RT library with missing functions on the first compile and then use it so you will have faster compilation than with using -r switch. @dockimbel is it correct?

Oldes avatar Sep 13 '17 07:09 Oldes

@Oldes I deleted the libRedRT.dylib and then recompiled ./red-063 -c -r code/Library/SQLite/SQLite3-test.red

When I run ./SQLite3-test, I now get following error -

`--> open DB: 0 02811200 --> trace 3 dyld: lazy symbol binding failed: Symbol not found: _sqlite3_trace_v2 Referenced from: /Users/ajinkya/Downloads/./SQLite3-test Expected in: flat namespace

dyld: Symbol not found: _sqlite3_trace_v2 Referenced from: /Users/ajinkya/Downloads/./SQLite3-test Expected in: flat namespace

[1] 91392 trace trap ./SQLite3-test`

Should I log this issue here https://github.com/Oldes/Red-SQLite instead?

ajinkyakulkarni avatar Sep 14 '17 05:09 ajinkyakulkarni

Open a new issue here and provide info about version of SQLite you are using.

Oldes avatar Sep 14 '17 05:09 Oldes

@ajinkyakulkarni I would bet, that your SQLite version is older, because sqlite3_trace_v2 is function which replaced sqlite3_trace function, which is supposed to be deprecated now

I wonder If I should rework the binding to support even some older SQLite versions too... or maybe you could just update:)

Oldes avatar Sep 14 '17 06:09 Oldes

@ajinkyakulkarni if you need to use old library, you can simply ignore the new API functions.. like in this new Red/System basic example

At least I think that this file should be ok (it is using the old trace API call). Unfortunately, making Red version is not on my todo list. It was meant as a startup anyway. Anybody is welcome to improve it.

Oldes avatar Sep 14 '17 09:09 Oldes

I had this same problem. When I downloaded a refreshed version of red

Windows red-063.exe 1.1 MB
sha256: 105d0f7b009a802a35a636c5dbedc69e89477fd62b6ba77690845fd78d436171
This error changed. I am opening new ticket for that. https://github.com/red/code/issues/78

Cybarite avatar Apr 20 '18 09:04 Cybarite

Still hoping to solve this one ... as the build time is noticeable ...

If zerofill in SQLite3.red is replaced by its definition - about line 32 - viz

zerofill dbs-head dbs-tail

is replaced by

until [ dbs-head/value: 0 dbs-head: dbs-head + 1 dbs-head = dbs-tail ]

that problem goes away ... to be replaced by a new one

Compiling to native code... *** Compilation Error: undefined symbol: red/integer/make-in

  • zerofill is defined in %allocator.reds
  • integer/make-in is defined in %datatypes/integer.reds
  • %runtime/red.reds has this include #include %datatypes/integer.reds

Cybarite avatar Apr 25 '18 08:04 Cybarite

zerofill was runtime function... it was removed and replaced with fill so instead of:

zerofill dbs-head dbs-tail

there should be:

fill dbs-head dbs-tail 0

Oldes avatar Dec 07 '20 10:12 Oldes