Search code examples
c++protocol-buffersstatic-linkingcodelite

Static linking of protocol buffers with codelite


This is my first ever serious compiling experience on linux. I've installed codelite on ubuntu. I'm trying to build a shared library that uses protocol buffers. I've built protocol buffers with no problems. However, no matter what I do I cannot add protobuf statically to my shared library. I don't know what the problem is. I'm not getting any errors when compiling but the .so file is 80kb instead of >1.9MB. I know the file size because I'm using the same shared library on windows. What should I do?

Here's my compiler settings:

Codelite compiler settings

Here's my linker settings:

Codelite linker settings


Solution

  • OK I've managed to do it. Here's what I did. First of all I compiled protocol buffers with the following flags

    ./configure "CFLAGS=-fPIC" "CXXFLAGS=-fPIC"
    

    Then I switched to code blocks, it's ugly but get's the job done.