Unidata / netcdf-cxx4

Official GitHub repository for netCDF-C++ libraries and utilities.
Other
124 stars 49 forks source link

Errors building 4.3.1 tag on macOS with Clang 12.0.5 #111

Closed aerorahul closed 3 years ago

aerorahul commented 3 years ago

https://github.com/Unidata/netcdf-cxx4/blob/45fbd4979d388ee42e2650d8f0bd352797fe3d13/configure.ac#L10

I recently tried building the CXX4 API on macOS with Clang 12.0.5 and discovered that the above line gives an error such as below:

In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr
../version:1:1: error: expected external declaration
-n 4.3.1
^
../version:1:2: error: unknown type name 'n'
-n 4.3.1
 ^
../version:1:4: error: expected unqualified-id
-n 4.3.1
   ^

I traced the solution down to replacing the line in configure:

~/s/s/h/p/netcdf-cxx4-4.3.1 ❯❯❯ git diff                                                                tags/v4.3.1^0 ✱
diff --git i/configure w/configure
index cd6cf06..8c8d28e 100755
--- i/configure
+++ w/configure
@@ -2491,7 +2491,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu

 # Create the VERSION file, which contains the package version from
 # AC_INIT.
-echo -n 4.3.1>VERSION
+echo -n 4.3.1>VERSION.txt

 { $as_echo "$as_me:${as_lineno-$LINENO}: netCDF-cxx4 4.3.1" >&5

And from there to configure.ac to the above line.

I am not very familiar with the autotools build system, so I apologize if this is not the correct place for the edit. I thought documenting a solution in an issue might help some other users facing a similar issue.