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

Already on GitHub? Sign in to your account

Make fails: Compiling c_src/erlzmq_nif.c #3

Closed
NikolaVeber opened this Issue Apr 6, 2011 · 9 comments

Comments

Projects
None yet
3 participants

I have just cloned the repository and started make with following error (GCC version included at the bottom):

==> erlzmq2 (compile)
Compiled src/erlzmq_nif.erl
Compiled src/erlzmq.erl
Compiling c_src/erlzmq_nif.c
In file included from c_src/erlzmq_nif.c:26:
c_src/vector.h:44: error: conflicting types for ‘size_t’
/usr/lib/gcc/i686-linux-gnu/4.4.5/include/stddef.h:211: note: previous declaration of ‘size_t’ was here
c_src/erlzmq_nif.c: In function ‘erlzmq_nif_getsockopt’:
c_src/erlzmq_nif.c:393: warning: passing argument 4 of ‘zmq_getsockopt’ from incompatible pointer type
deps/zeromq2/include/zmq.h:217: note: expected ‘size_t ’ but argument is of type ‘size_t *’
c_src/erlzmq_nif.c:407: warning: passing argument 4 of ‘zmq_getsockopt’ from incompatible pointer type
deps/zeromq2/include/zmq.h:217: note: expected ‘size_t *’ but argument is of type ‘size_t *’
c_src/erlzmq_nif.c:418: warning: passing argument 4 of ‘zmq_getsockopt’ from incompatible pointer type
deps/zeromq2/include/zmq.h:217: note: expected ‘size_t *’ but argument is of type ‘size_t *’
c_src/erlzmq_nif.c:436: warning: passing argument 4 of ‘zmq_getsockopt’ from incompatible pointer type
deps/zeromq2/include/zmq.h:217: note: expected ‘size_t *’ but argument is of type ‘size_t *’
ERROR: $CC -c $CFLAGS $DRV_CFLAGS c_src/erlzmq_nif.c -o c_src/erlzmq_nif.o failed with error: 1
make: *
* [compile] Error 1
mile@mile-Mr-Gamer-HD5770-X4:/erlzmq2$ gcc
gcc: no input files
mile@mile-Mr-Gamer-HD5770-X4:
/erlzmq2$ gcc --version
gcc (Ubuntu/Linaro 4.4.4-14ubuntu5) 4.4.5

I Couldn't find any tags to get an older version for comparison, so I can't tell if a change in my system affected the outcome. 2 weeks ago the current version built just fine.

Contributor

evax commented Apr 6, 2011

Thanks for the report.
Does the following patch solve your problem ?

diff --git a/c_src/vector.h b/c_src/vector.h
index f7ace29..c43ea33 100644
--- a/c_src/vector.h
+++ b/c_src/vector.h
@@ -40,6 +40,7 @@
#ifndef VECTOR_H
#define VECTOR_H

+#include <stddef.h>
#ifndef size_t
typedef unsigned long size_t;
#endif

Contributor

evax commented Apr 6, 2011

Markdown ate the patch, here it is:
https://gist.github.com/905627

Thanks for the quick reply. Unfortunately, this does not solve the problem.

I have cloned the repository, applied the patch and still:

Compiling c_src/erlzmq_nif.c
In file included from c_src/erlzmq_nif.c:26:
c_src/vector.h:45: error: conflicting types for ‘size_t’
/usr/lib/gcc/i686-linux-gnu/4.4.5/include/stddef.h:211: note: previous
declaration of ‘size_t’ was here
c_src/erlzmq_nif.c: In function ‘erlzmq_nif_getsockopt’:
c_src/erlzmq_nif.c:393: warning: passing argument 4 of
‘zmq_getsockopt’ from incompatible pointer type
deps/zeromq2/include/zmq.h:219: note: expected ‘size_t ’ but argument
is of type ‘size_t *’
c_src/erlzmq_nif.c:407: warning: passing argument 4 of
‘zmq_getsockopt’ from incompatible pointer type
deps/zeromq2/include/zmq.h:219: note: expected ‘size_t *’ but argument
is of type ‘size_t *’
c_src/erlzmq_nif.c:418: warning: passing argument 4 of
‘zmq_getsockopt’ from incompatible pointer type
deps/zeromq2/include/zmq.h:219: note: expected ‘size_t *’ but argument
is of type ‘size_t *’
c_src/erlzmq_nif.c:436: warning: passing argument 4 of
‘zmq_getsockopt’ from incompatible pointer type
deps/zeromq2/include/zmq.h:219: note: expected ‘size_t *’ but argument
is of type ‘size_t *’
ERROR: $CC -c $CFLAGS $DRV_CFLAGS c_src/erlzmq_nif.c -o
c_src/erlzmq_nif.o failed with error: 1
make: *
* [compile] Error 1

vector.h looks like this after patching:
...

  • DAMAGE.
    */
    #ifndef VECTOR_H
    #define VECTOR_H

#include <stddef.h>
#ifndef size_t
typedef unsigned long size_t;
#endif

typedef struct {
,,,

On Wed, Apr 6, 2011 at 3:23 PM, evax
reply@reply.github.com
wrote:

Thanks for the report.
Does the following patch solve your problem ?

diff --git a/c_src/vector.h b/c_src/vector.h
index f7ace29..c43ea33 100644
--- a/c_src/vector.h
+++ b/c_src/vector.h
@@ -40,6 +40,7 @@
 #ifndef VECTOR_H
 #define VECTOR_H

+#include <stddef.h>
 #ifndef size_t
 typedef unsigned long size_t;
 #endif

Reply to this email directly or view it on GitHub:
#3 (comment)

Contributor

evax commented Apr 7, 2011

Are you trying to cross compile ?

Nope, simple compiling on Ubuntu,

$ gcc --version
gcc (Ubuntu/Linaro 4.4.4-14ubuntu5) 4.4.5

On Thu, Apr 7, 2011 at 12:51 PM, evax
reply@reply.github.com
wrote:

Are you trying to cross compile ?

Reply to this email directly or view it on GitHub:
#3 (comment)

Contributor

evax commented Apr 7, 2011

Ok, reproduced.
For some reason on your 32bit system size_t is not a typedef, so the patch was not working because size_t was typedefed the same.
I pushed the proper fix.

Member

yrashk commented Apr 7, 2011

Please let us know if this latest commit fixed your problem

I have just tried the current git version, works fine!

Thanks for the prompt reaction!

On Thu, Apr 7, 2011 at 4:32 PM, yrashk
reply@reply.github.com
wrote:

Please let us know if this latest commit fixed your problem

Reply to this email directly or view it on GitHub:
#3 (comment)

Contributor

evax commented Apr 7, 2011

Thanks for reporting and testing !

@evax evax closed this Apr 7, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment