# Static linking error building BVLC/Caffe on FreeBSD



## PeterSprague (Feb 1, 2017)

Attempting to build BVLC/Caffe computer vision machine learning framework (https://github.com/BVLC/caffe)


Installed all the dependencies including GCC 4.9.4

Created Makefile.config
Modified the Makefile by substituting FreeBSD for Linux in "Configure build" section (lines #242+), revised (#257) -  CXX ?= /usr/local/bin/g++


```
$ gmake
Makefile:314: *** Cannot static link with the c++ compiler.  Stop.
```
Has anyone gotten Caffe built in FreeBSD?  What steps are needed to successfully build?


----------



## quanquan (Aug 25, 2018)

i have compile caffe successfuly with ports,by when run this, error with protobuf and caffe.proto


----------



## leebrown66 (Aug 25, 2018)

PeterSprague: Why not use ports or packages for graphics/caffe?  They are already patched for FreeBSD.

If, for some reason you really need to compile it yourself, use the port as a guideline as to the modifications required to build under FreeBSD.


----------



## quanquan (Aug 25, 2018)

leebrown66 said:


> PeterSprague: Why not use ports or packages for graphics/caffe?  They are already patched for FreeBSD.
> 
> If, for some reason you really need to compile it yourself, use the port as a guideline as to the modifications required to build under FreeBSD.



pkg and ports has been used, they both can install caffe, but when run caffe,get an error about libprotobuf.

```
[libprotobuf error google/protobuf/descriptor_database.cc:58] file already exists in dadabase: caffe.proto
```
google tell me that, both opencv and caffeuse libprotobuf with caffe.proto,i should compile caffe with static libprotobuf.a，i have changed the ports comfig,but failed caffe


----------



## leebrown66 (Aug 25, 2018)

Try addressing this with the port maintainer.  I see it was updated only 2 weeks ago.  Automated testing ensures it compiles, but a runtime failure is sure to fall through the cracks.


----------



## First_Law_of_Unix (Sep 11, 2022)

"caffe" is removed from ports. Anyone was still able to get it to work on FreeBSD from github source?


----------

