Skip to content

error: expected primary-expression before '__attribute__' when expand macro in port_def.inc #6659

@Haffon

Description

@Haffon

What version of protobuf and what language are you using?
Version: master/v3.9.1.0, v3.9.1.0 is reported by CMake script.
Language: C++

What operating system (Linux, Windows, ...) and version?
Windows 10
What runtime / compiler are you using (e.g., python version or gcc version)
gcc 8.1.0 in mingw-w64
What did you do?
Steps to reproduce the behavior:

  1. download tensorflow 1.13.2 source code
  2. generate codeblocks project with cmake under tensorflow/contrib/cmake/_build_mingw64 directory
  3. open the tensorflow.cbp project with codeblocks svn 11825
  4. codeblocks already configured with mingw-w64, so select GNU GCC Compiler (x64) from the build options dialog.
  5. Click the "Build" button
  6. Then cmake script start to call git clone to download zlib, protobuf, etc. source code.
  7. Click the "Build" button again if failed by cmake find sh, the second time seems ignored this error.
  8. the "expected primary-expression before 'attribute'" error occurred when compiling protobuf.

What did you expect to see
protobuf been compiled.
What did you see instead?
tensorflow-1.13.2/tensorflow/contrib/cmake/_build_mingw64/protobuf/src/protobuf/src/google/protobuf/port_def.inc:516:42: error: expected primary-expression before 'attribute'
PROTOBUF_EXPORT_TEMPLATE_TEST(MSVC_HACK, __declspec(dllexport));

Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs).

Anything else we should know about your project / environment

I'm trying compile tensorflow C++ library with mingw-w64 toolchain, as I need a little cross-compile to set -march= for some special cpu. the make file is generated by cmake. If bazel support setting -march= flags, let me know.

Metadata

Metadata

Assignees

No one assigned

    Labels

    c++inactiveDenotes the issue/PR has not seen activity in the last 90 days.platform relatedAny issue releated to specific platform or OS

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions