Bug 218740 - devel/protobuf: fix build when gcc is installed
Summary: devel/protobuf: fix build when gcc is installed
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Po-Chuan Hsieh
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-04-18 19:53 UTC by Pawel Pekala
Modified: 2017-05-09 17:19 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (sunpoet)


Attachments
gcc build fix (342 bytes, patch)
2017-04-18 19:53 UTC, Pawel Pekala
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Pawel Pekala freebsd_committer 2017-04-18 19:53:42 UTC
Created attachment 181879 [details]
gcc build fix

When there is gcc installed protobuf fails to build:

libtool: compile:  c++ -std=c++11 -DHAVE_CONFIG_H -I. -I.. -isystem /usr/local/include -D_THREAD_SAFE -pthread -DHAVE_PTHREAD=1 -DHAVE_ZLIB=1 -Wall -Wno-sign-compare -O2 -pipe -march=native -DGOOGLE_PROTOBUF_NO_RTTI -fstack-protector -isystem /usr/local/include -fno-strict-aliasing -isystem /usr/local/include -MT google/protobuf/compiler/js/js_generator.lo -MD -MP -MF google/protobuf/compiler/js/.deps/js_generator.Tpo -c google/protobuf/compiler/js/js_generator.cc  -fPIC -DPIC -o google/protobuf/compiler/js/.libs/js_generator.o
/usr/local/lib/gcc49/libstdc++.so.6: version GLIBCXX_3.4.21 required by /hdd/ports/devel/protobuf/work/protobuf-3.2.0/src/js_embed not found
gmake[3]: *** [Makefile:7853: google/protobuf/compiler/js/well_known_types_embed.cc] Error 1
gmake[3]: *** Waiting for unfinished jobs....

This is due to wrong native compiler detection. Attached patch fixes this by
hardcoding detected native compiler to system compiler which generates
proper js_embed binary that can be then executed without problems.
Comment 1 Po-Chuan Hsieh freebsd_committer 2017-04-29 16:15:26 UTC
I cannot reproduce this failure with either lang/gcc (5.4.0) or lang/gcc6 (6.3.0) installed.
Could you retry with protobuf 3.3.0 which I've committed today?
Thanks.
Comment 2 Walter Schwarzenfeld freebsd_triage 2017-04-29 17:18:34 UTC
Same error on 10,3.amd64. Also with the updated version. Can confirm
the patch solves the problem.
Comment 3 Pawel Pekala freebsd_committer 2017-04-29 19:20:41 UTC
Problem persists with 3.3.0 for me also.
Comment 4 Po-Chuan Hsieh freebsd_committer 2017-04-30 12:15:17 UTC
Both of you are running 10.3 and lang/gcc (5.4.0)?
Comment 5 Walter Schwarzenfeld freebsd_triage 2017-04-30 12:49:13 UTC
Yes, gcc from base and 10.3-RELEASE-p18 amd64.
Comment 6 Walter Schwarzenfeld freebsd_triage 2017-04-30 13:10:15 UTC
if have a different error message
/usr/local/lib/compat/libstdc++.so.6: version GLIBCXX_3.4.21 required by /ram/usr/ports/devel/protobuf/work/protobuf-3.3.0/src/js_embed not found
gmake[3]: *** [Makefile:8117: google/protobuf/compiler/js/well_known_types_embed.cc] Error 1
gmake[3]: *** Waiting for unfinished jobs..

It compiles fine if I remove compat9x (but I needed for other ports).
Comment 7 Walter Schwarzenfeld freebsd_triage 2017-04-30 15:05:10 UTC
r 439822 ends with the same error message.
Comment 8 Pawel Pekala freebsd_committer 2017-04-30 16:12:35 UTC
I can reproduce this bug on 12-CURRENT and 10.3, on both systems
gcc-5.4.0_1 and gcc49-4.9.4_2 packages are installed. In my case gcc49 seems
to be culprit:

/usr/local/lib/gcc49/libstdc++.so.6: version GLIBCXX_3.4.21 required by /hdd/ports/devel/protobuf/work/protobuf-3.2.0/src/js_embed not found
Comment 9 Walter Schwarzenfeld freebsd_triage 2017-04-30 18:01:46 UTC
src/Makefile.am:
510 # The special JS code for the well-known types is linked into the compiler via
511 # well_known_types_embed.cc, which is generated from .js source files. We have
512 # to build the js_embed binary using $(CXX_FOR_BUILD) so that it is executable
513 # on the build machine in a cross-compilation setup.
514 js_embed$(EXEEXT): $(srcdir)/google/protobuf/compiler/js/embed.cc
515         $(CXX_FOR_BUILD) -o $@ $<
Comment 10 Markus Wennrich 2017-05-05 06:58:01 UTC
Same problem here (10.3, gcc-5.4.0_1)

CONFIGURE_ENV=  CXX_FOR_BUILD=c++

from patch works for me, thanks.
Comment 11 Po-Chuan Hsieh freebsd_committer 2017-05-08 12:48:53 UTC
Committed. Thanks!
Comment 12 commit-hook freebsd_committer 2017-05-08 12:49:01 UTC
A commit references this bug:

Author: sunpoet
Date: Mon May  8 12:47:06 UTC 2017
New revision: 440430
URL: https://svnweb.freebsd.org/changeset/ports/440430

Log:
  Fix build with gcc installed

  PR:		218740
  Submitted by:	pawel
  MFH:		2017Q2

Changes:
  head/devel/protobuf/Makefile
Comment 13 commit-hook freebsd_committer 2017-05-09 17:19:29 UTC
A commit references this bug:

Author: sunpoet
Date: Tue May  9 17:19:15 UTC 2017
New revision: 440508
URL: https://svnweb.freebsd.org/changeset/ports/440508

Log:
  MFH: r440430

  Fix build with gcc installed

  PR:		218740
  Submitted by:	pawel

  Approved by:	ports-secteam

Changes:
_U  branches/2017Q2/
  branches/2017Q2/devel/protobuf/Makefile