Opened 2 years ago

Closed 2 years ago

#65645 closed defect (fixed)

google-glog fails on 10.6.8 Rosetta: raw_logging.cc: error: #pragma GCC diagnostic not allowed inside functions

Reported by: barracuda156 Owned by: barracuda156
Priority: Normal Milestone:
Component: ports Version: 2.7.2
Keywords: powerpc, rosetta, snowleopard Cc:
Port: google-glog

Description

/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_google-glog/google-glog/work/glog-0.6.0/src/raw_logging.cc: In function ‘bool google::VADoRawLog(char**, size_t*, const char*, char*)’:
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_google-glog/google-glog/work/glog-0.6.0/src/raw_logging.cc:105: error: #pragma GCC diagnostic not allowed inside functions
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_google-glog/google-glog/work/glog-0.6.0/src/raw_logging.cc:106: error: #pragma GCC diagnostic not allowed inside functions
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_google-glog/google-glog/work/glog-0.6.0/src/raw_logging.cc:110: error: #pragma GCC diagnostic not allowed inside functions
In file included from /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_google-glog/google-glog/work/glog-0.6.0/src/vlog_is_on.cc:44:
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_google-glog/google-glog/work/build/glog/raw_logging.h:48: warning: expected [error|warning|ignored] after ‘#pragma GCC diagnostic’
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_google-glog/google-glog/work/build/glog/raw_logging.h:161: warning: expected [error|warning|ignored] after ‘#pragma GCC diagnostic’
In file included from /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_google-glog/google-glog/work/glog-0.6.0/src/logging.cc:69:
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_google-glog/google-glog/work/build/glog/raw_logging.h:48: warning: expected [error|warning|ignored] after ‘#pragma GCC diagnostic’
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_google-glog/google-glog/work/build/glog/raw_logging.h:161: warning: expected [error|warning|ignored] after ‘#pragma GCC diagnostic’
make[2]: *** [CMakeFiles/glogbase.dir/src/raw_logging.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_google-glog/google-glog/work/glog-0.6.0/src/logging.cc: In member function ‘virtual void google::LogSink::send(google::LogSeverity, const char*, const char*, int, const google::LogMessageTime&, const char*, size_t)’:
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_google-glog/google-glog/work/glog-0.6.0/src/logging.cc:2083: error: #pragma GCC diagnostic not allowed inside functions
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_google-glog/google-glog/work/glog-0.6.0/src/logging.cc:2084: error: #pragma GCC diagnostic not allowed inside functions
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_google-glog/google-glog/work/glog-0.6.0/src/logging.cc:2092: error: #pragma GCC diagnostic not allowed inside functions
make[2]: *** [CMakeFiles/glogbase.dir/src/logging.cc.o] Error 1

Change History (3)

comment:1 Changed 2 years ago by barracuda156

So first of all, we need to use gcc-4.6 or later: https://github.com/civetweb/civetweb/issues/640 Then, Rosetta ignores blacklisting *gcc-4.*, only whitelist works. Finally, when building with gcc12, it fails on:

Undefined symbols:
  "__ZN6google14FlagRegistererC1INSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEPKcS9_S9_PT_SB_", referenced from:
      __GLOBAL__sub_I_logging.cc in logging.cc.o
      __GLOBAL__sub_I_logging.cc in logging.cc.o
      __GLOBAL__sub_I_logging.cc in logging.cc.o
      __GLOBAL__sub_I_logging.cc in logging.cc.o
      __GLOBAL__sub_I_logging.cc in logging.cc.o
      __GLOBAL__sub_I_vlog_is_on.cc in vlog_is_on.cc.o
ld: symbol(s) not found

comment:2 Changed 2 years ago by barracuda156

So, we need to use the same compiler for gflags and google-glog, something related to: https://github.com/gflags/gflags/issues/203 Once that is done, i.e. gflags is rebuilt with gcc12, google-glog build proceeds and finally fails on atomics:

Undefined symbols:
  "___atomic_load_8", referenced from:
      _main in logging_unittest.cc.o
  "___atomic_store_8", referenced from:
      _main in logging_unittest.cc.o
ld: symbol(s) not found
collect2: error: ld returned 1 exit status
make[2]: *** [logging_unittest] Error 1

I will add ldflag now for that, and hopefully issue is fixed.

comment:3 Changed 2 years ago by barracuda156

Owner: set to barracuda156
Resolution: fixed
Status: newclosed

In 2eeb273491927382997902b4aa150489cafe4435/macports-ports (master):

gflags: same compiler is to be used as for google-glog
Fixes: #65645

Note: See TracTickets for help on using tickets.