View mode: basic / threaded / horizontal-split · Log in · Help
October 23, 2012
msgpack unresolved question
I got msgpack and was trying out an example (compare_json.d) and 
I get an unresolved error.
Not sure what I'm doing wrong...
https://github.com/msgpack/msgpack-d/blob/master/src/msgpack.d

I think length is built in for associative arrays?

Thanks
Dan

The error and lines of code is:
-----

/tmp/.rd.../objs/compare_json.o: In function `const(@trusted void 
function(ref 
msgpack.Packer!(std.array.Appender!(ubyte[]).Appender).Packer)) 
msgpack.Value.toMsgpack!(msgpack.Packer!(std.array.Appender!(ubyte[]).Appender).Packer).toMsgpack':
/home/dbdavidson/stage/msgpack-d/src/msgpack.d:2967: undefined 
reference to `@property ulong 
object.AssociativeArray!(msgpack.Value, 
const(msgpack.Value)).AssociativeArray.length()'


        case Type.array:
            packer.beginArray(via.array.length);
            foreach (elem; via.array)
                elem.toMsgpack(packer);
            break;
        case Type.map:
>>>         packer.beginMap(via.map.length);
            foreach (key, value; via.map) {
                key.toMsgpack(packer);
                value.toMsgpack(packer);
            }
            break;
        }

-----
October 24, 2012
Re: msgpack unresolved question
On Tuesday, 23 October 2012 at 13:40:00 UTC, Dan wrote:
> /tmp/.rd.../objs/compare_json.o: In function `const(@trusted 
> void function(ref 
> msgpack.Packer!(std.array.Appender!(ubyte[]).Appender).Packer)) 
> msgpack.Value.toMsgpack!(msgpack.Packer!(std.array.Appender!(ubyte[]).Appender).Packer).toMsgpack':
> /home/dbdavidson/stage/msgpack-d/src/msgpack.d:2967: undefined 
> reference to `@property ulong 
> object.AssociativeArray!(msgpack.Value, 
> const(msgpack.Value)).AssociativeArray.length()'
>

No answer yet, but the errors look very similar to those run into 
here:

http://www.digitalmars.com/d/archives/digitalmars/D/Something_wrong_with_dmd_s_-c_command_162601.html

back in March. Wish I knew how that was resolved. When I tried to 
use msgpack my steps were:

- git clone the msgpack project
- edit my dmd.conf file and add a -I to the src folder of msgpack.
- run rdmd on the .../example/compare_json.d

Thanks
Dan
October 25, 2012
Re: msgpack unresolved question
On Wednesday, 24 October 2012 at 11:19:08 UTC, Dan wrote:
> No answer yet, but the errors look very similar to those run 
> into here:
>
> http://www.digitalmars.com/d/archives/digitalmars/D/Something_wrong_with_dmd_s_-c_command_162601.html
>
> back in March. Wish I knew how that was resolved. When I tried 
> to use msgpack my steps were:
>
> - git clone the msgpack project
> - edit my dmd.conf file and add a -I to the src folder of 
> msgpack.
> - run rdmd on the .../example/compare_json.d
>
> Thanks
> Dan

It is a linker error. You need to compile the msgpack.d file and 
tell the linker where to find it. The simplest way is to just 
throw the file on the command line.

dmd compare_json.d msgpack.d

This kind of have some details about what you are doing:

http://stackoverflow.com/questions/6191772/calling-c-c-functions-in-dynamic-and-static-libraries-in-d/6194392#6194392
October 25, 2012
Re: msgpack unresolved question
On Thursday, 25 October 2012 at 17:59:40 UTC, Jesse Phillips 
wrote:
>
> It is a linker error. You need to compile the msgpack.d file 
> and tell the linker where to find it. The simplest way is to 
> just throw the file on the command line.
>
> dmd compare_json.d msgpack.d
>

Thanks. I tried your suggestion but had no luck (same link 
error). It could be my command is still wrong. Or maybe it is 
something related to associative arrays? The reason I suggest 
this is there is another example in the directory (custom.d) 
which uses functionality in msgpack and builds and runs fine 
without my specifying msgpack.d on the command line.

Thanks
Dan

dmd  /.../msgpack-d/example/compare_json.d  
/.../msgpack-d/src/msgpack.d

compare_json.o: In function 
`_D7msgpack5Value83__T9toMsgpackTS7msgpack50__T6PackerTS3std5array16__T8AppenderTAhZ8AppenderZ6PackerZ9toMsgpackMxFNeKS7msgpack50__T6PackerTS3std5array16__T8AppenderTAhZ8AppenderZ6PackerZv':
/.../msgpack-d/src/msgpack.d:(.text._D7msgpack5Value83__T9toMsgpackTS7msgpack50__T6PackerTS3std5array16__T8AppenderTAhZ8AppenderZ6PackerZ9toMsgpackMxFNeKS7msgpack50__T6PackerTS3std5array16__T8AppenderTAhZ8AppenderZ6PackerZv+0x1aa): 
undefined reference to 
`_D6object55__T16AssociativeArrayTS7msgpack5ValueTxS7msgpack5ValueZ16AssociativeArray6lengthMFNdZm'
collect2: ld returned 1 exit status
--- errorlevel 1
October 25, 2012
Re: msgpack unresolved question
Hmm, I can reproduce. It is caused by the call to pack in 
function 2.

    void f2()
    {
        unpack(pack(mpObj));
    }

I get the feeling this may be a compiler bug, I'm not seeing 
anything used that isn't part of those two files or Phobos.
November 04, 2012
Re: msgpack unresolved question
Hi Dan,

Sorry for the delay.
Your mail is referred to as spam in Gmail...

I also got same error in compare_json.d,
and I agree with Jesse.

"pragma(msg, typeof(via.map.length));" returns 'ulong' during 
compilation.
But the linker error occurred in the runtime.

Now, I have no idea to resolve it in library.
Give me some time to think it over.


Thanks,
Masahiro

On Thursday, 25 October 2012 at 18:50:55 UTC, Dan wrote:
> On Thursday, 25 October 2012 at 17:59:40 UTC, Jesse Phillips 
> wrote:
>>
>> It is a linker error. You need to compile the msgpack.d file 
>> and tell the linker where to find it. The simplest way is to 
>> just throw the file on the command line.
>>
>> dmd compare_json.d msgpack.d
>>
>
> Thanks. I tried your suggestion but had no luck (same link 
> error). It could be my command is still wrong. Or maybe it is 
> something related to associative arrays? The reason I suggest 
> this is there is another example in the directory (custom.d) 
> which uses functionality in msgpack and builds and runs fine 
> without my specifying msgpack.d on the command line.
>
> Thanks
> Dan
>
> dmd  /.../msgpack-d/example/compare_json.d  
> /.../msgpack-d/src/msgpack.d
>
> compare_json.o: In function 
> `_D7msgpack5Value83__T9toMsgpackTS7msgpack50__T6PackerTS3std5array16__T8AppenderTAhZ8AppenderZ6PackerZ9toMsgpackMxFNeKS7msgpack50__T6PackerTS3std5array16__T8AppenderTAhZ8AppenderZ6PackerZv':
> /.../msgpack-d/src/msgpack.d:(.text._D7msgpack5Value83__T9toMsgpackTS7msgpack50__T6PackerTS3std5array16__T8AppenderTAhZ8AppenderZ6PackerZ9toMsgpackMxFNeKS7msgpack50__T6PackerTS3std5array16__T8AppenderTAhZ8AppenderZ6PackerZv+0x1aa): 
> undefined reference to 
> `_D6object55__T16AssociativeArrayTS7msgpack5ValueTxS7msgpack5ValueZ16AssociativeArray6lengthMFNdZm'
> collect2: ld returned 1 exit status
> --- errorlevel 1
Top | Discussion index | About this forum | D home