Giter VIP home page Giter VIP logo

c-capnproto's People

Contributors

jmckaskill avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

c-capnproto's Issues

test.capnp.c : initializer element is not computable at load time

The following line of test.capnp.c generates a compiler error:

static const struct capn_segment capn_seg = {{0},0,0,0,(char*)&capn_buf[0],8168,8168};

johan@johanpc:~/git/c-capnproto$ make
cc -O2 -Wall -fPIC --std=gnu11 -I. -Wno-unused-function -c compiler/test.capnp.c -o compiler/test.capnp.o
compiler/test.capnp.c:1028:21: warning: initialization makes integer from pointer without a cast [enabled by default]
static const struct capn_segment capn_seg = {{0},0,0,0,(char*)&capn_buf[0],8168,8168};
^
compiler/test.capnp.c:1028:21: warning: (near initialization for ‘capn_seg.id’) [enabled by default]
compiler/test.capnp.c:1028:21: error: initializer element is not computable at load time
compiler/test.capnp.c:1028:21: error: (near initialization for ‘capn_seg.id’)
compiler/test.capnp.c:1028:21: warning: initialization makes pointer from integer without a cast [enabled by default]
compiler/test.capnp.c:1028:21: warning: (near initialization for ‘capn_seg.data’) [enabled by default]

Issue with installing the Capn C library

Hello,

I am new to the world of installing C libraries and I am having the task of installing capnp C libraries using g++ v4.8 in our RHEL6 environment.

I downloaded the source from https://github.com/jmckaskill/c-capnproto and ran make which gave me the below error.

~/tmp/c-capnproto-master $ env CC=/opt/rh/devtoolset-2/root/usr/bin/gcc CXX=/opt/rh/devtoolset-2/root/usr/bin/g++ make
/opt/rh/devtoolset-2/root/usr/bin/gcc -O2 -Wall -Werror -fPIC -I. -Wno-unused-function -c capn.c -o capn.o
capn.c: In function \u2018lookup_segment\u2019:
capn.c:221:19: error: \u2018y\u2019 may be used uninitialized in this function [-Werror=maybe-uninitialized]
s->hdr.parent = &y->hdr;
^
capn.c:222:6: error: \u2018x\u2019 may be used uninitialized in this function [-Werror=maybe-uninitialized]
x = &s->hdr;
^
cc1: all warnings being treated as errors
make: *
* [capn.o] Error 1

From #4, I understood that this fixed now and hence I downloaded the new code from flashforward branch and ran make.

Then, it was failing as gtest library wasn't available. I followed the steps in http://stackoverflow.com/questions/13513905/how-to-setup-googletest-as-a-shared-library-on-linux to install the gtest library and now it's failing with the below error.

~/tmp/c-capnproto-flashforward $ env CC=/opt/rh/devtoolset-2/root/usr/bin/gcc CXX=/opt/rh/devtoolset-2/root/usr/bin/g++ make
/opt/rh/devtoolset-2/root/usr/bin/g++ -g -Wall -Werror -I. -I../gtest/include -o capn-test.o -c capn-test.cpp
In file included from capn-test.cpp:7:0:
capn-malloc.c: In function \u2018int init_fp(capn_, FILE_, capn_stream_, int)\u2019:
capn-malloc.c:114:28: error: \u2018UINT32_MAX\u2019 was not declared in this scope
if (n > INT_MAX/8 || n > UINT32_MAX/8 || UINT32_MAX - total < n_8)
^
In file included from /usr/include/gtest/gtest.h:1929:0,
from capn-test.cpp:1:
capn-test.cpp: In member function \u2018virtual void WireFormat_SimpleRawDataStruct_Test::TestBody()\u2019:
capn-test.cpp:54:40: error: \u2018UINT64_C\u2019 was not declared in this scope
EXPECT_EQ(UINT64_C(0xefcdab8967452301), capn_read64(ptr, 0));
^
capn-test.cpp:54:3: error: template argument 1 is invalid
EXPECT_EQ(UINT64_C(0xefcdab8967452301), capn_read64(ptr, 0));
^
capn-test.cpp:55:23: error: \u2018UINT64_C\u2019 was not declared in this scope
EXPECT_EQ(UINT64_C(0), capn_read64(ptr, 8));
^
capn-test.cpp:55:3: error: template argument 1 is invalid
EXPECT_EQ(UINT64_C(0), capn_read64(ptr, 8));
^
capn-test.cpp:56:32: error: \u2018UINT32_C\u2019 was not declared in this scope
EXPECT_EQ(UINT32_C(0x67452301), capn_read32(ptr, 0));
^
capn-test.cpp:56:3: error: template argument 1 is invalid
EXPECT_EQ(UINT32_C(0x67452301), capn_read32(ptr, 0));
^
capn-test.cpp:57:32: error: \u2018UINT32_C\u2019 was not declared in this scope
EXPECT_EQ(UINT32_C(0xefcdab89), capn_read32(ptr, 4));
^
capn-test.cpp:57:3: error: template argument 1 is invalid
EXPECT_EQ(UINT32_C(0xefcdab89), capn_read32(ptr, 4));
^
capn-test.cpp:58:23: error: \u2018UINT32_C\u2019 was not declared in this scope
EXPECT_EQ(UINT32_C(0), capn_read32(ptr, 8));
^
capn-test.cpp:58:3: error: template argument 1 is invalid
EXPECT_EQ(UINT32_C(0), capn_read32(ptr, 8));
^
capn-test.cpp:59:28: error: \u2018UINT16_C\u2019 was not declared in this scope
EXPECT_EQ(UINT16_C(0x2301), capn_read16(ptr, 0));
^
capn-test.cpp:59:3: error: template argument 1 is invalid
EXPECT_EQ(UINT16_C(0x2301), capn_read16(ptr, 0));
^
capn-test.cpp:60:28: error: \u2018UINT16_C\u2019 was not declared in this scope
EXPECT_EQ(UINT16_C(0x6745), capn_read16(ptr, 2));
^
capn-test.cpp:60:3: error: template argument 1 is invalid
EXPECT_EQ(UINT16_C(0x6745), capn_read16(ptr, 2));
^
capn-test.cpp:61:28: error: \u2018UINT16_C\u2019 was not declared in this scope
EXPECT_EQ(UINT16_C(0xab89), capn_read16(ptr, 4));
^
capn-test.cpp:61:3: error: template argument 1 is invalid
EXPECT_EQ(UINT16_C(0xab89), capn_read16(ptr, 4));
^
capn-test.cpp:62:28: error: \u2018UINT16_C\u2019 was not declared in this scope
EXPECT_EQ(UINT16_C(0xefcd), capn_read16(ptr, 6));
^
capn-test.cpp:62:3: error: template argument 1 is invalid
EXPECT_EQ(UINT16_C(0xefcd), capn_read16(ptr, 6));
^
capn-test.cpp:63:23: error: \u2018UINT16_C\u2019 was not declared in this scope
EXPECT_EQ(UINT16_C(0), capn_read16(ptr, 8));
^
capn-test.cpp:63:3: error: template argument 1 is invalid
EXPECT_EQ(UINT16_C(0), capn_read16(ptr, 8));
^
capn-test.cpp: In function \u2018void setupStruct(capn_)\u2019:
capn-test.cpp:77:64: error: \u2018UINT64_C\u2019 was not declared in this scope
EXPECT_EQ(0, capn_write64(ptr, 0, UINT64_C(0x1011121314151617)));
^
capn-test.cpp:78:56: error: \u2018UINT32_C\u2019 was not declared in this scope
EXPECT_EQ(0, capn_write32(ptr, 8, UINT32_C(0x20212223)));
^
capn-test.cpp:79:53: error: \u2018UINT16_C\u2019 was not declared in this scope
EXPECT_EQ(0, capn_write16(ptr, 12, UINT16_C(0x3031)));
^
capn-test.cpp: In function \u2018void checkStruct(capn_)\u2019:
capn-test.cpp:156:40: error: \u2018UINT64_C\u2019 was not declared in this scope
EXPECT_EQ(UINT64_C(0x1011121314151617), capn_read64(ptr, 0));
^
capn-test.cpp:156:3: error: template argument 1 is invalid
EXPECT_EQ(UINT64_C(0x1011121314151617), capn_read64(ptr, 0));
^
capn-test.cpp:157:32: error: \u2018UINT32_C\u2019 was not declared in this scope
EXPECT_EQ(UINT32_C(0x20212223), capn_read32(ptr, 8));
^
capn-test.cpp:157:3: error: template argument 1 is invalid
EXPECT_EQ(UINT32_C(0x20212223), capn_read32(ptr, 8));
^
make: *** [capn-test.o] Error 1

Any thoughts on this? Please let me know if I am missing something here.

-Ram

Warnings in compilation 4

g++ -g -Wall -Werror -I. -I../gtest/include -o capn-test.o -c capn-test.cpp
In file included from capn-test.cpp:6:0:
capn.c: In function ‘uint64_t lookup_double(capn_segment**, char**, uint64_t)’:
capn.c:242:23: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
capn.c: In function ‘uint64_t lookup_far(capn_segment**, char**, uint64_t)’:
capn.c:275:22: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
capn.c: In function ‘int copy_ptr(capn_segment*, char*, capn_ptr*, capn_ptr*, int*)’:
capn.c:669:41: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
In file included from capn-test.cpp:7:0:
capn-malloc.c: In function ‘int read_fp(void*, size_t, FILE*, capn_stream*, uint8_t*, int)’:
capn-malloc.c:83:21: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
capn-malloc.c: In function ‘int capn_write_mem(capn*, uint8_t*, size_t, int)’:
capn-malloc.c:195:37: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
capn-malloc.c:211:17: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
capn-test.cpp: In function ‘void getSegments(capn*, capn_segment**, size_t)’:
capn-test.cpp:280:23: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
capn-test.cpp:284:23: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
capn-test.cpp: In member function ‘virtual void WireFormat_StructRoundTrip_OneSegmentPerAllocation_Test::TestBody()’:
capn-test.cpp:321:58: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
capn-test.cpp: In member function ‘virtual void WireFormat_StructRoundTrip_OneSegmentPerAllocation_NoTag_Test::TestBody()’:
capn-test.cpp:377:58: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
capn-test.cpp: In member function ‘virtual void WireFormat_StructRoundTrip_MultipleSegmentsWithMultipleAllocations_Test::TestBody()’:
capn-test.cpp:427:58: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
cc1plus: all warnings being treated as errors
Makefile:25: recipe for target 'capn-test.o' failed

bootstrap for capnp update?

I started looking into updating to the current capnp version 0.5.3, and found that the existing capnpc-c plugin was failing to regenerate compiler/schema.{c|h} based on the current schema.capnp from upstream capnproto. I suspect it may be because the format of schema.capnp has changed, and capnpc-c can't process the new format with its older generated struct/enum defs.

Wondering if you'd recommend a manual fixup of compiler/schema.{c|h} or if you've used a more efficient strategy in the past - couldn't quite tell from the git history.

Also, not sure if you're still interested in receiving questions/pull requests on this repo, as I saw your msgs on the capnproto discuss list that you wouldn't have much time for your go implementation any more. If not, I'll just plug along on my clone of the repo :)

Warning in compilation

Using gcc 4.7.3

capn.c: In function ‘lookup_segment’:
capn.c:221:19: error: ‘y’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
capn.c:222:6: error: ‘x’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
cc1: all warnings being treated as errors
Makefile:13: recipe for target 'capn.o' failed

Warnings in complilation 2

cc -O2 -Wall -Werror -fPIC -I. -Wno-unused-function -c compiler/capnpc-c.c -o compiler/capnpc-c.o
compiler/capnpc-c.c:908:63: error: missing terminating ' character [-Werror]

Howto use the program?

cat ../capnproto/c++/samples/addressbook.capnp | ./capnpc-c 
failed to read schema from stdin

Is there a how to use the program? Or isn't it finished?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.