Opened 3 years ago

Closed 3 years ago

#62912 closed defect (fixed)

netcdf-cxx @4.2: ../version:1:1: error: expected external declaration

Reported by: Cathysige Owned by: tenomoto (Takeshi Enomoto)
Priority: Normal Milestone:
Component: ports Version: 2.6.4
Keywords: Cc:
Port: netcdf-cxx

Description (last modified by ryandesign (Ryan Carsten Schmidt))

Attached is the error log

:info:build ../version:1:1: error: expected external declaration
:info:build ../version:1:2: error: unknown type name 'n'
:info:build ../version:1:4: error: expected unqualified-id
:info:build ../version:1:1: error: expected external declaration
:info:build ../version:1:2: error: unknown type name 'n'
:info:build ../version:1:4: error: expected unqualified-id
:info:build ../version:1:1: error: expected external declaration
:info:build ../version:1:2: error: unknown type name 'n'
:info:build ../version:1:4: error: expected unqualified-id
:info:build ../version:1:1: error: expected external declaration
:info:build ../version:1:2: error: unknown type name 'n'
:info:build ../version:1:4: error: expected unqualified-id
:info:build ../version:1:1: error: expected external declaration
:info:build ../version:1:2: error: unknown type name 'n'
:info:build ../version:1:4: error: expected unqualified-id
:info:build ../version:1:1: error: expected external declaration
:info:build ../version:1:2: error: unknown type name 'n'
:info:build ../version:1:4: error: expected unqualified-id
:info:build ../version:1:1: error: expected external declaration
:info:build ../version:1:2: error: unknown type name 'n'
:info:build ../version:1:4: error: expected unqualified-id
:info:build ../version:1:1: error: expected external declaration
:info:build ../version:1:2: error: unknown type name 'n'
:info:build ../version:1:4: error: expected unqualified-id
:info:build ../version:1:1: error: expected external declaration
:info:build ../version:1:2: error: unknown type name 'n'
:info:build ../version:1:4: error: expected unqualified-id
:info:build ../version:1:1: error: expected external declaration
:info:build ../version:1:2: error: unknown type name 'n'
:info:build ../version:1:4: error: expected unqualified-id
:info:build ../version:1:1: error: expected external declaration
:info:build ../version:1:2: error: unknown type name 'n'
:info:build ../version:1:4: error: expected unqualified-id
:info:build ../version:1:1: error: expected external declaration
:info:build ../version:1:2: error: unknown type name 'n'
:info:build ../version:1:4: error: expected unqualified-id
:info:build ../version:1:1: error: expected external declaration
:info:build fatal error: too many errors emitted, stopping now [-ferror-limit=]
:info:build ../version:1:1: error: expected external declaration
:info:build fatal error: too many errors emitted, stopping now [-ferror-limit=]
:info:build 20 errors generated.
:info:build make[2]: *** [libnetcdf_c___la-ncvalues.lo] Error 1
:info:build 20 errors generated.
:info:build make[2]: *** [libnetcdf_c___la-netcdf.lo] Error 1
:info:build make[1]: *** [all-recursive] Error 1
:info:build make: *** [all] Error 2
:error:build Failed to build netcdf-cxx: command execution failed
:debug:build Error code: CHILDSTATUS 3868 2
:error:build See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_netcdf-cxx/netcdf-cxx/main.log for details.

Change History (2)

comment:1 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

Description: modified (diff)
Keywords: netcdf removed
Owner: set to tenomoto
Port: netcdf-cxx added; bash removed
Status: newassigned
Summary: Failed to build netcdf-cxx@4.2 under Big Sur 11.3.1netcdf-cxx @4.2: ../version:1:1: error: expected external declaration

You didn't attach the main.log, but the portion of it that you copied into the ticket description is enough to figure out that this is the familiar problem where you are using a C++20-capable compiler on a case-insensitive filesystem and the project you are trying to compile includes a VERSION file and it adds a -I flag pointing to the directory containing the VERSION file which then conflicts with the C++20 "version" header. See https://bugs.llvm.org/show_bug.cgi?id=42540

It's an upstream issue that should be reported to and fixed by the developers of netcdf-cxx.

The best solution is for the project to change its build system so that a -I flag for the directory containing the VERSION file is not added. Usually the VERSION file is in the top level directory and usually source files are in a subdirectory like "src" so adding an include path for the root directory isn't necessary. Often though projects by default write something like a config.h to the root directory, which causes the problem. If this is what's going on here, then the project can avoid the problem by writing config.h to a different directory.

An alternative is to move or rename the VERSION file, for example to VERSION.txt. If the VERSION file is referenced by other files, those references need to be updated.

Last edited 3 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:2 Changed 3 years ago by tenomoto (Takeshi Enomoto)

Resolution: fixed
Status: assignedclosed

In 698730eff15a75d06a44fcae83070e252a0d403a/macports-ports (master):

netcdf-cxx: workaround for a LLVM bug with C++20

Closes: #62912

Note: See TracTickets for help on using tickets.