title: Apache Avro C Installation
body: <p>I am working on a project and I am using Apache Avro. I have downloaded Apache Avro for C and I followed the instructions provided in order to install it on my system (Ubuntu Linux v14.04). After the installation, I have some header files under the <code>/include</code> directory and some libraries under <code>/lib</code> directory. All of those are the ones that were installed from Apache Avro.</p>
  
  <p>At this point, I have created my C source files which are as follows: </p>
  
  <p>1) socket_client.h :</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;sys/socket.h&gt;
  #include &lt;netinet/in.h&gt;
  #include "avro.h"
  #include &lt;errno.h&gt;
  #include &lt;stdint.h&gt;
  
  #ifndef SOCKET_CLIENT_H_
  #define SOCKET_CLIENT_H_
  
  void init_schema(void);
  
  int client_execution_connect(char* ip_addr, int port, char* type);
  
  #endif /* SOCKET_CLIENT_H_ */
  </code></pre>
  
  <p>2) socket_client.c : </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include "socket_client.h"
  
  avro_schema_t bigpeer_schema;
  void init_schema(void)
  {
      if( avro_schema_from_json_literal(BIG_PEER_SCHEMA, &amp;bigpeer_schema) )
      {
          printf("Unable to parse big_peer schema");
          exit(EXIT_FAILURE);
      }
  }
  int client_execution_connect(char* ip_addr, int port, char* type)
  {
      ...
  }
  </code></pre>
  
  <p>and a test main file. Also, I have created the following makefile to compile my code:</p>
  
  <pre><code>CC=gcc
  CFLAGS=-c -Wall
  LDFLAGS=
  SOURCES=test_main.c socket_client.c
  OBJECTS=$(SOURCES:.c=.o)
  EXECUTABLE=avro_test
  INC_PATH=/include/avro/
  
  INC=-I/include
  LIB=-L/lib
  
  all: $(SOURCES) $(EXECUTABLE)
  
  $(EXECUTABLE): $(OBJECTS)
      $(CC) $(LDFLAGS) $(LIB) $(OBJECTS) -o $@
  
  .c.o:
      $(CC) $(INC) $(CFLAGS) $&lt; -o $@
  
  clean:
      rm -rf *.o avro_test
  </code></pre>
  
  <p>But, when I try to make my application, I get the following:</p>
  
  <pre><code>nick@rethimno:~/Downloads/AvroClient$ make
  gcc -I/include -c -Wall test_main.c -o test_main.o
  test_main.c: In function ‘main’:
  test_main.c:22:6: warning: unused variable ‘port’ [-Wunused-variable]
    int port = atoi(argv[2]);
        ^
  test_main.c:15:8: warning: unused variable ‘type’ [-Wunused-variable]
     char* type = "db_node";
          ^
  gcc -I/include -c -Wall socket_client.c -o socket_client.o
  gcc  -L/lib test_main.o socket_client.o -o avro_test
  socket_client.o: In function `init_schema':
  socket_client.c:(.text+0x14): undefined reference to `avro_schema_from_json_length'
  collect2: error: ld returned 1 exit status
  make: *** [avro_test] Error 1
  </code></pre>
  
  <p>What am I doing wrong? I am not quite certain if the libraries of Apache Avro are loaded properly.</p>
  
  <p>Thank you,
  Nick</p>