Minimal project compilation error

Bug #1960075 reported by MaxStotsky
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
caffe (Ubuntu)
New
Undecided
Unassigned

Bug Description

I trying to compile simple project using Caffe library. But I received compile error.

I create simple cpp file (test.cpp):

#include <caffe/caffe.hpp>

int main(int /*argc*/, char ** /*argv*/)
{
        caffe::SolverParameter solver_param;
        return 0;
}

And try to compile it:

$ c++ -DCPU_ONLY -I/usr/include/opencv4 -o test.o -c test.cpp

I have 155 errors in compile logs. All errors in caffe.pb.h file about Protobuf API:

/usr/include/caffe/proto/caffe.pb.h:49:51: error: ‘AuxiliaryParseTableField’ in namespace ‘google::protobuf::internal’ does not name a type; did you mean ‘AuxillaryParseTableField’?
   49 | static const ::PROTOBUF_NAMESPACE_ID::internal::AuxiliaryParseTableField aux[]
      | ^~~~~~~~~~~~~~~~~~~~~~~~
      | AuxillaryParseTableField
/usr/include/caffe/proto/caffe.pb.h:336:30: error: ‘ConstStringParam’ is not a member of ‘google::protobuf’
  336 | ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, FillerParameter_VarianceNorm* value) {
      | ^~~~~~~~~~~~~~~~
/usr/include/caffe/proto/caffe.pb.h:336:81: error: expected primary-expression before ‘*’ token
  336 | ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, FillerParameter_VarianceNorm* value) {
      | ^
...

I have installed libprotobuf-dev version 3.12.4-1ubuntu3:

$ apt-cache policy libprotobuf-dev
libprotobuf-dev:
  Installed: 3.12.4-1ubuntu3
  Candidate: 3.12.4-1ubuntu3
  Version table:
 *** 3.12.4-1ubuntu3 500
        500 http://ua.archive.ubuntu.com/ubuntu impish/main amd64 Packages
        100 /var/lib/dpkg/status

What should I do to compile my test.cpp?

ProblemType: Bug
DistroRelease: Ubuntu 21.10
Package: caffe (not installed)
ProcVersionSignature: Ubuntu 5.13.0-25.26-generic 5.13.19
Uname: Linux 5.13.0-25-generic x86_64
NonfreeKernelModules: nvidia_modeset nvidia
ApportVersion: 2.20.11-0ubuntu71
Architecture: amd64
CasperMD5CheckResult: unknown
CurrentDesktop: ubuntu:GNOME
Date: Fri Feb 4 18:37:26 2022
InstallationDate: Installed on 2020-10-20 (472 days ago)
InstallationMedia: Ubuntu 20.10 "Groovy Gorilla" - Beta amd64 (20200930)
ProcEnviron:
 TERM=screen-256color
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=<set>
 LANG=uk_UA.UTF-8
 SHELL=/bin/zsh
RebootRequiredPkgs: Error: path contained symlinks.
SourcePackage: caffe
UpgradeStatus: Upgraded to impish on 2021-10-08 (118 days ago)

Revision history for this message
MaxStotsky (maxstotsky) wrote :
Revision history for this message
MaxStotsky (maxstotsky) wrote :

I manually build the debian package in my environment. It works now.

Steps to fix it:

apt-get source libcaffe-dev
sudo apt build-dep libcaffe-dev
cd caffe-1.0.0+git20180821.99bd997
dpkg-buildpackage -tc
sudo dpkg -i ../libcaffe-dev_1.0.0+git20180821.99bd997-8build2_amd64.deb

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.