Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ajinkyakulkarni opened this issue Sep 13, 2017 · 12 comments

Comments

@ajinkyakulkarni
Copy link

ajinkyakulkarni commented Sep 13, 2017

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:
]
@dockimbel
Copy link
Member

@Oldes ^---

@Oldes
Copy link
Contributor

Oldes commented Sep 13, 2017

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

@Oldes
Copy link
Contributor

Oldes commented Sep 13, 2017

@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
Copy link
Contributor

Oldes commented Sep 13, 2017

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

@Oldes
Copy link
Contributor

Oldes commented Sep 13, 2017

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?

@ajinkyakulkarni
Copy link
Author

@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?

@Oldes
Copy link
Contributor

Oldes commented Sep 14, 2017

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

@Oldes
Copy link
Contributor

Oldes commented Sep 14, 2017

@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
Copy link
Contributor

Oldes commented Sep 14, 2017

@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.

@Cybarite
Copy link

Cybarite commented Apr 20, 2018

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. #78

@Cybarite
Copy link

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

@Oldes
Copy link
Contributor

Oldes commented Dec 7, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants