How to install hdf5 on Windows? - windows

HDF5 is a file format that I need to download to work with some data that I have. I am running Windows 11 on a 64 bit machine. I am finding it so difficult to install HDF5 on Windows and would be so grateful for any assistance.
Following the HDF5 website, it seemed that I needed to build HDF5 with cmake. I am able to get to step 5 of the build instructions on this webpage.
However, when I run the following recommended command
ctest -S HDF5config.cmake,BUILD_GENERATOR=VS201564 -C Release -VV -O hdf5.logsktop\CMake-hdf5-1.13.2\CMake-hdf5-1.13.2>
The built binary is not actually built, and I get the following error message that I do not understand
[OUTPUT]
* Extra verbosity turned on
[HANDLER_VERBOSE_OUTPUT]
Reading Script: C:/Users/User Name/Desktop/CMake-hdf5-1.13.2/CMake-hdf5-1.13.2/HDF5config.cmake,BUILD_GENERATOR=VS201564
[HANDLER_OUTPUT]
-- Dashboard script configuration:
CTEST_SITE=[WIN7VS201564.XXXX]
CTEST_BUILD_NAME=[Windows-WIN10-vs2015]
CTEST_SOURCE_DIRECTORY=[C:/Users/User Name/Desktop/CMake-hdf5-1.13.2/CMake-hdf5-1.13.2\hdf5-1.13.2]
CTEST_BINARY_DIRECTORY=[C:/Users/User Name/Desktop/CMake-hdf5-1.13.2/CMake-hdf5-1.13.2\build]
CTEST_CMAKE_GENERATOR=[Visual Studio 14 2015 Win64]
CTEST_CONFIGURATION_TYPE=[Release]
CTEST_GIT_COMMAND=[]
CTEST_CHECKOUT_COMMAND=[]
CTEST_CONFIGURE_COMMAND=["C:/Program Files/CMake/bin/cmake.exe" -C "C:/Users/User Name/Desktop/CMake-hdf5-1.13.2/CMake-hdf5-1.13.2\hdf5-1.13.2/config/cmake/cacheinit.cmake" -DCMAKE_BUILD_TYPE:STRING=Release -DHDF5_BUILD_FORTRAN:BOOL=OFF -DHDF5_BUILD_JAVA:BOOL=OFF -DCMAKE_INSTALL_PREFIX:PATH=%ProgramFiles%/HDF_Group/HDF5/1.13.2 -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=TGZ -DTGZPATH:PATH=C:/Users/User Name/Desktop/CMake-hdf5-1.13.2/CMake-hdf5-1.13.2 -DHDF5_PACKAGE_EXTLIBS:BOOL=ON -DSITE:STRING=WIN7VS201564.XXXX -DBUILDNAME:STRING=Windows-WIN10-vs2015 -DCTEST_USE_LAUNCHERS:BOOL=OFF "-GVisual Studio 14 2015 Win64" "" "" "C:/Users/User Name/Desktop/CMake-hdf5-1.13.2/CMake-hdf5-1.13.2\hdf5-1.13.2"]
CTEST_SCRIPT_DIRECTORY=[C:/Users/User Name/Desktop/CMake-hdf5-1.13.2/CMake-hdf5-1.13.2]
CTEST_USE_LAUNCHERS=[0]
[HANDLER_VERBOSE_OUTPUT]
SetCTestConfiguration:SourceDirectory:C:/Users/User Name/Desktop/CMake-hdf5-1.13.2/CMake-hdf5-1.13.2/hdf5-1.13.2
SetCTestConfiguration:BuildDirectory:C:/Users/User Name/Desktop/CMake-hdf5-1.13.2/CMake-hdf5-1.13.2/build
[HANDLER_OUTPUT]
Run dashboard with model Experimental
Source directory: C:/Users/User Name/Desktop/CMake-hdf5-1.13.2/CMake-hdf5-1.13.2\hdf5-1.13.2
Build directory: C:/Users/User Name/Desktop/CMake-hdf5-1.13.2/CMake-hdf5-1.13.2\build
Group: Experimental
[OUTPUT]
Reading ctest configuration file: C:/Users/User Name/Desktop/CMake-hdf5-1.13.2/CMake-hdf5-1.13.2/hdf5-1.13.2/CTestConfig.cmake
[HANDLER_VERBOSE_OUTPUT]
SetCTestConfigurationFromCMakeVariable:NightlyStartTime:CTEST_NIGHTLY_START_TIME
SetCTestConfiguration:NightlyStartTime:18:00:00 CST
SetCTestConfigurationFromCMakeVariable:Site:CTEST_SITE
SetCTestConfiguration:Site:WIN7VS201564.XXXX
SetCTestConfigurationFromCMakeVariable:BuildName:CTEST_BUILD_NAME
SetCTestConfiguration:BuildName:Windows-WIN10-vs2015
[OUTPUT]
Site: WIN7VS201564.XXXX
Build name: Windows-WIN10-vs2015
Use Experimental tag: 20220824-2256
[HANDLER_VERBOSE_OUTPUT]
Add coverage exclude regular expressions.
SetCTestConfiguration:BuildDirectory:C:/Users/User Name/Desktop/CMake-hdf5-1.13.2/CMake-hdf5-1.13.2/build
SetCTestConfiguration:SourceDirectory:C:/Users/User Name/Desktop/CMake-hdf5-1.13.2/CMake-hdf5-1.13.2/hdf5-1.13.2
SetCTestConfiguration:ConfigureCommand:"C:/Program Files/CMake/bin/cmake.exe" -C "C:/Users/User Name/Desktop/CMake-hdf5-1.13.2/CMake-hdf5-1.13.2\hdf5-1.13.2/config/cmake/cacheinit.cmake" -DCMAKE_BUILD_TYPE:STRING=Release -DHDF5_BUILD_FORTRAN:BOOL=OFF -DHDF5_BUILD_JAVA:BOOL=OFF -DCMAKE_INSTALL_PREFIX:PATH=%ProgramFiles%/HDF_Group/HDF5/1.13.2 -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=TGZ -DTGZPATH:PATH=C:/Users/User Name/Desktop/CMake-hdf5-1.13.2/CMake-hdf5-1.13.2 -DHDF5_PACKAGE_EXTLIBS:BOOL=ON -DSITE:STRING=WIN7VS201564.XXXX -DBUILDNAME:STRING=Windows-WIN10-vs2015 -DCTEST_USE_LAUNCHERS:BOOL=OFF "-GVisual Studio 14 2015 Win64" "" "" "C:/Users/User Name/Desktop/CMake-hdf5-1.13.2/CMake-hdf5-1.13.2\hdf5-1.13.2"
[HANDLER_OUTPUT]
Configure project
[HANDLER_VERBOSE_OUTPUT]
Configure with command: "C:/Program Files/CMake/bin/cmake.exe" -C "C:/Users/User Name/Desktop/CMake-hdf5-1.13.2/CMake-hdf5-1.13.2\hdf5-1.13.2/config/cmake/cacheinit.cmake" -DCMAKE_BUILD_TYPE:STRING=Release -DHDF5_BUILD_FORTRAN:BOOL=OFF -DHDF5_BUILD_JAVA:BOOL=OFF -DCMAKE_INSTALL_PREFIX:PATH=%ProgramFiles%/HDF_Group/HDF5/1.13.2 -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=TGZ -DTGZPATH:PATH=C:/Users/User Name/Desktop/CMake-hdf5-1.13.2/CMake-hdf5-1.13.2 -DHDF5_PACKAGE_EXTLIBS:BOOL=ON -DSITE:STRING=WIN7VS201564.XXXX -DBUILDNAME:STRING=Windows-WIN10-vs2015 -DCTEST_USE_LAUNCHERS:BOOL=OFF "-GVisual Studio 14 2015 Win64" "" "" "C:/Users/User Name/Desktop/CMake-hdf5-1.13.2/CMake-hdf5-1.13.2\hdf5-1.13.2"
Run command: "C:/Program Files/CMake/bin/cmake.exe" "-C" "C:/Users/User Name/Desktop/CMake-hdf5-1.13.2/CMake-hdf5-1.13.2\hdf5-1.13.2/config/cmake/cacheinit.cmake" "-DCMAKE_BUILD_TYPE:STRING=Release" "-DHDF5_BUILD_FORTRAN:BOOL=OFF" "-DHDF5_BUILD_JAVA:BOOL=OFF" "-DCMAKE_INSTALL_PREFIX:PATH=%ProgramFiles%/HDF_Group/HDF5/1.13.2" "-DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=TGZ" "-DTGZPATH:PATH=C:/Users/User" "Name/Desktop/CMake-hdf5-1.13.2/CMake-hdf5-1.13.2" "-DHDF5_PACKAGE_EXTLIBS:BOOL=ON" "-DSITE:STRING=WIN7VS201564.XXXX" "-DBUILDNAME:STRING=Windows-WIN10-vs2015" "-DCTEST_USE_LAUNCHERS:BOOL=OFF" "-GVisual Studio 14 2015 Win64" "" "" "C:/Users/User Name/Desktop/CMake-hdf5-1.13.2/CMake-hdf5-1.13.2\hdf5-1.13.2"
CMake Warning:
Ignoring empty string ("") provided on the command line.
CMake Warning:
Ignoring empty string ("") provided on the command line.
CMake Warning:
Ignoring extra path from command line:
"C:/Users/User Name/Desktop/CMake-hdf5-1.13.2/CMake-hdf5-1.13.2/build/Name/Desktop/CMake-hdf5-1.13.2/CMake-hdf5-1.13.2"
loading initial cache file C:/Users/User Name/Desktop/CMake-hdf5-1.13.2/CMake-hdf5-1.13.2\hdf5-1.13.2/config/cmake/cacheinit.cmake
-- Selecting Windows SDK version to target Windows 10.0.22000.
-- The C compiler identification is MSVC 19.0.24210.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Looking for include file sys/file.h
-- Looking for include file sys/file.h - not found
-- Looking for include file sys/ioctl.h
-- Looking for include file sys/ioctl.h - not found
-- Looking for include file sys/resource.h
-- Looking for include file sys/resource.h - not found
-- Looking for include file sys/socket.h
-- Looking for include file sys/socket.h - not found
-- Looking for include file sys/stat.h
-- Looking for include file sys/stat.h - found
-- Looking for include files sys/stat.h, sys/time.h
-- Looking for include files sys/stat.h, sys/time.h - not found
-- Looking for include files sys/stat.h, sys/types.h
-- Looking for include files sys/stat.h, sys/types.h - found
-- Looking for 3 include files sys/stat.h, ..., features.h
-- Looking for 3 include files sys/stat.h, ..., features.h - not found
-- Looking for 3 include files sys/stat.h, ..., dirent.h
-- Looking for 3 include files sys/stat.h, ..., dirent.h - not found
-- Looking for 3 include files sys/stat.h, ..., unistd.h
-- Looking for 3 include files sys/stat.h, ..., unistd.h - not found
-- Looking for 3 include files sys/stat.h, ..., pwd.h
-- Looking for 3 include files sys/stat.h, ..., pwd.h - not found
-- Looking for 3 include files sys/stat.h, ..., globus/common.h
-- Looking for 3 include files sys/stat.h, ..., globus/common.h - not found
-- Looking for 3 include files sys/stat.h, ..., pdb.h
-- Looking for 3 include files sys/stat.h, ..., pdb.h - not found
-- Looking for 3 include files sys/stat.h, ..., pthread.h
-- Looking for 3 include files sys/stat.h, ..., pthread.h - not found
-- Looking for 3 include files sys/stat.h, ..., srbclient.h
-- Looking for 3 include files sys/stat.h, ..., srbclient.h - not found
-- Looking for 3 include files sys/stat.h, ..., string.h
-- Looking for 3 include files sys/stat.h, ..., string.h - found
-- Looking for 4 include files sys/stat.h, ..., strings.h
-- Looking for 4 include files sys/stat.h, ..., strings.h - not found
-- Looking for 4 include files sys/stat.h, ..., stdlib.h
-- Looking for 4 include files sys/stat.h, ..., stdlib.h - found
-- Looking for 5 include files sys/stat.h, ..., memory.h
-- Looking for 5 include files sys/stat.h, ..., memory.h - found
-- Looking for 6 include files sys/stat.h, ..., dlfcn.h
-- Looking for 6 include files sys/stat.h, ..., dlfcn.h - not found
-- Looking for 6 include files sys/stat.h, ..., netinet/in.h
-- Looking for 6 include files sys/stat.h, ..., netinet/in.h - not found
-- Looking for 6 include files sys/stat.h, ..., netdb.h
-- Looking for 6 include files sys/stat.h, ..., netdb.h - not found
-- Looking for 6 include files sys/stat.h, ..., arpa/inet.h
-- Looking for 6 include files sys/stat.h, ..., arpa/inet.h - not found
-- Looking for include file quadmath.h
-- Looking for include file quadmath.h - not found
-- Looking for gethostname in ucb;
-- Looking for gethostname in ucb; - not found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of char
-- Check size of char - done
-- Check size of short
-- Check size of short - done
-- Check size of int
-- Check size of int - done
-- Check size of unsigned
-- Check size of unsigned - done
-- Check size of long
-- Check size of long - done
-- Check size of long long
-- Check size of long long - done
-- Check size of float
-- Check size of float - done
-- Check size of double
-- Check size of double - done
-- Check size of long double
-- Check size of long double - done
-- Check size of int8_t
-- Check size of int8_t - done
-- Check size of uint8_t
-- Check size of uint8_t - done
-- Check size of int_least8_t
-- Check size of int_least8_t - done
-- Check size of uint_least8_t
-- Check size of uint_least8_t - done
-- Check size of int_fast8_t
-- Check size of int_fast8_t - done
-- Check size of uint_fast8_t
-- Check size of uint_fast8_t - done
-- Check size of int16_t
-- Check size of int16_t - done
-- Check size of uint16_t
-- Check size of uint16_t - done
-- Check size of int_least16_t
-- Check size of int_least16_t - done
-- Check size of uint_least16_t
-- Check size of uint_least16_t - done
-- Check size of int_fast16_t
-- Check size of int_fast16_t - done
-- Check size of uint_fast16_t
-- Check size of uint_fast16_t - done
-- Check size of int32_t
-- Check size of int32_t - done
-- Check size of uint32_t
-- Check size of uint32_t - done
-- Check size of int_least32_t
-- Check size of int_least32_t - done
-- Check size of uint_least32_t
-- Check size of uint_least32_t - done
-- Check size of int_fast32_t
-- Check size of int_fast32_t - done
-- Check size of uint_fast32_t
-- Check size of uint_fast32_t - done
-- Check size of int64_t
-- Check size of int64_t - done
-- Check size of uint64_t
-- Check size of uint64_t - done
-- Check size of int_least64_t
-- Check size of int_least64_t - done
-- Check size of uint_least64_t
-- Check size of uint_least64_t - done
-- Check size of int_fast64_t
-- Check size of int_fast64_t - done
-- Check size of uint_fast64_t
-- Check size of uint_fast64_t - done
-- Check size of size_t
-- Check size of size_t - done
-- Check size of ssize_t
-- Check size of ssize_t - failed
-- Check size of off_t
-- Check size of off_t - done
-- Check size of off64_t
-- Check size of off64_t - failed
-- Check size of time_t
-- Check size of time_t - done
-- Check size of _Bool
-- Check size of _Bool - done
-- Looking for alarm
-- Looking for alarm - not found
-- Looking for fcntl
-- Looking for fcntl - not found
-- Looking for flock
-- Looking for flock - not found
-- Looking for fork
-- Looking for fork - not found
-- Looking for getrusage
-- Looking for getrusage - not found
-- Looking for lstat
-- Looking for lstat - not found
-- Looking for pread
-- Looking for pread - not found
-- Looking for pwrite
-- Looking for pwrite - not found
-- Looking for rand_r
-- Looking for rand_r - not found
-- Looking for random
-- Looking for random - not found
-- Looking for setsysinfo
-- Looking for setsysinfo - not found
-- Looking for siglongjmp
-- Looking for siglongjmp - not found
-- Looking for sigsetjmp
-- Looking for sigsetjmp - not found
-- Looking for sigprocmask
-- Looking for sigprocmask - not found
-- Looking for srandom
-- Looking for srandom - not found
-- Looking for symlink
-- Looking for symlink - not found
-- Looking for tmpfile
-- Looking for tmpfile - found
-- Looking for asprintf
-- Looking for asprintf - not found
-- Looking for vasprintf
-- Looking for vasprintf - not found
-- Looking for waitpid
-- Looking for waitpid - not found
-- Looking for sigsetjmp
-- Looking for sigsetjmp - not found
-- Check size of __float128
-- Check size of __float128 - failed
-- Check size of _Quad
-- Check size of _Quad - failed
-- Testing maximum decimal precision for C - Exit code 0xc0000135
CMake Error at config/cmake/ConfigureChecks.cmake:318 (list):
list index: 1 out of range (-1, 0)
Call Stack (most recent call first):
CMakeLists.txt:469 (include)
-- maximum decimal precision for C var - 0
-- Found Perl: C:/cygwin64/bin/perl.exe (found version "5.26.3")
-- ....All Warnings are enabled
-- Filter PLUGIN file C:/Users/User/hdf5_plugins.tar.gz not found
-- The CXX compiler identification is MSVC 19.0.24210.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- ....All Warnings are enabled
-- Configuring incomplete, errors occurred!
See also "C:/Users/User Name/Desktop/CMake-hdf5-1.13.2/CMake-hdf5-1.13.2/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/User Name/Desktop/CMake-hdf5-1.13.2/CMake-hdf5-1.13.2/build/CMakeFiles/CMakeError.log".
Command exited with the value: 1
[ERROR_MESSAGE]
Error(s) when configuring the project
[HANDLER_VERBOSE_OUTPUT]
SetCTestConfiguration:BuildDirectory:C:/Users/User Name/Desktop/CMake-hdf5-1.13.2/CMake-hdf5-1.13.2/build
SetCTestConfiguration:SourceDirectory:C:/Users/User Name/Desktop/CMake-hdf5-1.13.2/CMake-hdf5-1.13.2/hdf5-1.13.2
SetMakeCommand:"C:\Program Files\CMake\bin\cmake.exe" --build . --config "Release"
SetCTestConfiguration:MakeCommand:"C:\Program Files\CMake\bin\cmake.exe" --build . --config "Release"
SetCTestConfiguration:UseLaunchers:0
[HANDLER_OUTPUT]
Build project
[HANDLER_VERBOSE_OUTPUT]
MakeCommand:"C:\Program Files\CMake\bin\cmake.exe" --build . --config "Release"
Run command: "C:\Program Files\CMake\bin\cmake.exe" "--build" "." "--config" "Release"
Microsoft (R) Build Engine version 14.0.25420.1
Copyright (C) Microsoft Corporation. All rights reserved.
MSBUILD : error MSB1009: Project file does not exist.
Switch: ALL_BUILD.vcxproj
Command exited with the value: 1
MakeCommand:"C:\Program Files\CMake\bin\cmake.exe" --build . --config "Release"
[ERROR_MESSAGE]
Error(s) when building project
[HANDLER_OUTPUT]
1 Compiler errors
1 Compiler warnings
[HANDLER_VERBOSE_OUTPUT]
SetCTestConfiguration:BuildDirectory:C:/Users/User Name/Desktop/CMake-hdf5-1.13.2/CMake-hdf5-1.13.2/build
SetCTestConfiguration:SourceDirectory:C:/Users/User Name/Desktop/CMake-hdf5-1.13.2/CMake-hdf5-1.13.2/hdf5-1.13.2
[HANDLER_OUTPUT]
Test project C:/Users/User Name/Desktop/CMake-hdf5-1.13.2/CMake-hdf5-1.13.2/build
[HANDLER_VERBOSE_OUTPUT]
Constructing a list of tests
Updating test list for fixtures
Added 0 tests to meet fixture requirements
Checking test dependency graph...
Checking test dependency graph end
[ERROR_MESSAGE]
No tests were found!!!
Really any pointers or references to things I could read to better understand what is going on would be appreciated, because I really do not understand this error message.
However, I am a bit worried that a possible bug could be coming from that fact that my User for this laptop is User Name, i.e. it has a space in it.
The HDF5 site has a warning that Blank spaces MUST NOT be used in directory path names as this will cause the build to fail.
However, this site warns that changing a User Folder name can be super risky, and I'd really not do that if at all possible.

Related

Why arm-poky-linux-gnueabi-ar says "invalid option -- 'g'" whereas this option doesn't appear in the args list of the command line?

I am using bitbake building command "bitbake -v update-engine-titan-c" and here are the logs :
[le944v7:latest] /LE944V7/meta-titan bitbake -v update-engine-titan-c
.../...
Build Configuration:
BB_VERSION = "1.40.0"
BUILD_SYS = "x86_64-linux"
NATIVELSBSTRING = "ubuntu-18.04"
TARGET_SYS = "arm-poky-linux-gnueabi"
MACHINE = "le944v7"
DISTRO = "poky-ivt-systemd"
DISTRO_VERSION = "12.0.0"
TUNE_FEATURES = "arm armv7ve vfp neon vfpv4 callconvention-hard cortexa7"
TARGET_FPU = "hard"
.../...
make[2]: Entering directory '/LE944V7/meta-titan/build/artefacts/work/cortexa7hf-neon-vfpv4-poky-linux-gnueabi/update-engine-titan-c/1.0-r0/build/src/wrapper'
rm -f libupdate_engine_titan_c_wrapper.a
arm-poky-linux-gnueabi-ar cru libupdate_engine_titan_c_wrapper.a update_attempter_wrapper.o -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lcrypto -lcurl -llog -lssl -lprotobuf-lite -lpthread -lbz2 -lgflags -lbase -lchrome -lbrillo -lbrillo_stream -levent -lbspatch -lfstab -lbootctrl -lxz -lpuffpatch -lbrotli
arm-poky-linux-gnueabi-ar: invalid option -- 'g'
Usage: arm-poky-linux-gnueabi-ar [emulation options] [-]{dmpqrstx}[abcDfilMNoOPsSTuvV] [--plugin <name>] [member-name] [count] archive-file file...
arm-poky-linux-gnueabi-ar -M [<mri-script]
commands:
d - delete file(s) from the archive
m[ab] - move file(s) in the archive
p - print file(s) found in the archive
q[f] - quick append file(s) to the archive
r[ab][f][u] - replace existing or insert new file(s) into the archive
s - act as ranlib
t[O][v] - display contents of the archive
x[o] - extract file(s) from the archive
command specific modifiers:
[a] - put file(s) after [member-name]
[b] - put file(s) before [member-name] (same as [i])
[D] - use zero for timestamps and uids/gids (default)
[U] - use actual timestamps and uids/gids
[N] - use instance [count] of name
[f] - truncate inserted file names
[P] - use full path names when matching
[o] - preserve original dates
[O] - display offsets of files in the archive
[u] - only replace files that are newer than current archive contents
generic modifiers:
[c] - do not warn if the library had to be created
[s] - create an archive index (cf. ranlib)
[S] - do not build a symbol table
[T] - make a thin archive
[v] - be verbose
[V] - display the version number
#<file> - read options from <file>
--target=BFDNAME - specify the target object format as BFDNAME
optional:
--plugin <p> - load the specified plugin
emulation options:
No emulation specific options
arm-poky-linux-gnueabi-ar: supported targets: elf32-littlearm elf32-littlearm-fdpic elf32-bigarm elf32-bigarm-fdpic elf32-little elf32-big plugin srec symbolsrec verilog tekhex binary ihex
I don't understand why arm-poky-linux-gnueabi-ar says "invalid option -- 'g'" whereas this option doesn't appear in arm-poky-linux-gnueabi-ar args list in the command line (see log) ?
It seems like ar doesn't take -lgio-2.0 arguments. I think you're supposed to put the path to the libgio-2.0.so file directly on the command line, not via a -l argument.
(In the ar manpage it says the -l argument is accepted but ignored, so I suspect G.M. is correct in the comment in saying that -lgio-2.0 is where the -g comes from)
An extension to #ptomato's answer is that ar will interpret anything starting with a - as a bunch of short-letter options coming after each other, so while -l is a valid short-letter option in ar, other letters coming after it might not be and that's how it triggers an "unknown option" error.
It's actually even worse if all the letters passed are miraculously valid because then ar will be running in an undefined way and make more subtle errors down the road.
For example, passing -lm to ar (this can happen if you specify it in your automake *_LIBADD variables, for example) might make you think that you are linking to the math library but it will actually tell ar to move files around in the static lib (-m option).

Configure clang-check for c++ standard libraries

I am trying to run Ale as my linter, which in turn uses clang-check to lint my code.
$ clang-check FeatureManager.h
Error while trying to load a compilation database:
Could not auto-detect compilation database for file "FeatureManager.h"
No compilation database found in /home/babbleshack/ or any parent directory
json-compilation-database: Error while opening JSON database: No such file or directory
Running without flags.
/home/babbleshack/FeatureManager.h:6:10: fatal error: 'unordered_map' file not found
#include <unordered_map>
^~~~~~~~~~~~~~~
1 error generated.
Error while processing /home/babbleshack/FeatureManager.h.
Whereas compiling with clang++ returns only a warning.
$ clang++ -std=c++11 -Wall FeatureManager.cxx FeatureManager.h
clang-5.0: warning: treating 'c-header' input as 'c++-header' when in C++ mode, this behavior is deprecated [-Wdeprecated]
There are no flags to clang-check allowing me to set compilation flags.
Took a while to figure this out, but you can do
clang-check file.cxx -- -Wall -std=c++11 -x c++
or if you are using clang-tidy
clang-tidy file.cxx -- -Wall -std=c++11 -x c++
To get both working with ALE, I added the following to my vimrc
let g:ale_cpp_clangtidy_options = '-Wall -std=c++11 -x c++'
let g:ale_cpp_clangcheck_options = '-- -Wall -std=c++11 -x c++'
If you want ALE to work for C as well, you will have to do the same for g:ale_c_clangtidy_options and g:ale_c_clangcheck_options.
I was getting stumped by a similar error message for far too long:
/my/project/src/util.h:4:10: error: 'string' file not found [clang-diagnostic-error]
#include <string>
^
I saw other questions suggesting that I was missing some critical package, but everything already seemed to be installed (and my code built just fine, it was only clang-tidy that was getting upset).
Passing -v showed that my .h file was being handled differently:
$ clang-tidy ... src/*.{h,cc} -- ... -v
...
clang-tool ... -main-file-name util.cc ... -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9 ... -x c++ ... /tmp/copy/src/util_test.cc
...
clang-tool ... -main-file-name util.h ... -x c-header /my/project/src/util.h
...
As Kris notes the key distinction is the -x c-header flag, which is because clang assumes a .h file contains C, not C++, and this in turn means that the system C++ includes weren't being used to process util.h.
But the -main-file-name flag also stood out to me as odd; why would a header file ever be the main file? While digging around I also came across this short but insightful answer that header files shouldn't be directly compiled in the first place! Using src/*.cc instead of src/*.{h,cc} avoids the problem entirely by never asking Clang to try to process a .h on its own in the first place!
This does introduce one more wrinkle, though. Errors in these header files won't be reported by default, since they're not the files you asked clang-tidy to look at. This is where the "Use -header-filter=. to display errors from all non-system headers.*" message clang-tidy prints comes in. If I pass -header-filter=src/.* (to only include my src headers and not any other header files I'm including with -I) I see the expected errors in my header files. Phew!
I'm not sure whether to prefer -x c++ or -header-filter=.* generally. A downside of -header-filter is you have to tune the filter regex, rather than just passing in the files you want to check. But on the other hand processing header files in isolation is essentially wasteful work (that I expect would add up quickly in a larger project).

Understanding the gcc abbreviations

I just took a look to the gcc-arm-none-eabi compiler binaries which are listed bellow but I really do not know all the used abbreviations. I would like to know which binary is the preprocessor, the linker, the compiler and so on ...
$ ls /opt/gcc-arm-none-eabi-5_4-2016q3/bin/
arm-none-eabi-addr2line
arm-none-eabi-ar
arm-none-eabi-as
arm-none-eabi-c++
arm-none-eabi-c++filt
arm-none-eabi-cpp
arm-none-eabi-elfedit
arm-none-eabi-g++
arm-none-eabi-gcc
arm-none-eabi-gcc-5.4.1
arm-none-eabi-gcc-ar
arm-none-eabi-gcc-nm
arm-none-eabi-gcc-ranlib
arm-none-eabi-gcov
arm-none-eabi-gcov-tool
arm-none-eabi-gdb
arm-none-eabi-gdb-py
arm-none-eabi-gprof
arm-none-eabi-ld
arm-none-eabi-ld.bfd
arm-none-eabi-nm
arm-none-eabi-objcopy
arm-none-eabi-objdump
arm-none-eabi-ranlib
arm-none-eabi-readelf
arm-none-eabi-size
arm-none-eabi-strings
arm-none-eabi-strip
I just can guess: gcc is the compiler? ld is the linker?
What is the exact purpose of all these binaries?
The leading 'arm-none-eabi' is the type of compiler. This is known as the tuple and is specified as a configure 'prefix'. Many of the binaries may be links or short wrapper scripts that call another binary (gcc). Also some of the names are just in case you have existing system binaries with the same name or multiple gcc installs.
You can find this information by running a man command on the program name. Briefly,
addr2line - convert an address (hex) to a code line number.
ar - a static library (or archive) tool.
as - an assembler
c++ - the C++ front-end
c++filt - convert a mangled name to function with prototypes.
cpp - the preprocessor only.
elfedit - elf header manipulation.
g++ - C++ with gnu extensions.
gcc - standard binary (given options can do the same as wrappers).
gcc-5.4.1 - full name for system with multiple GCC installs.
gcc-ar - rename in case of multiple 'ar'.
gcc-nm - rename in case of multiple 'nm'.
gcc-ranlib - rename in case of multiple 'ranlib'.
gcov - code coverage
gcov-tool - code coverage
gdb - the debugger
gdb-py - more minimal debugger
gprof - call graph/profiler.
ld - the linker (most likely gold).
ld.bfd - an older style linker with a few more features; MUCH slower for large C++ projects.
nm - display 'names' in a binary.
objcopy - manipulate a binary (sections).
objdump - information on a binary.
ranlib - generate a library index.
readelf - information on ELF binaries.
size - program section sizes
strings - dump all strings in a binary.
strip - remove debug information from a binary.
As a concept, the name 'gcc-ar' and 'ar' are physically the same thing. However, another 'ar' may exist in the path (a Solaris, or other Unix system) and the 'gcc-ar' name can be used to get the gcc specific 'ar'; all the 'gcc-XXX' things are for this use case.

Compiling using gfortran on older code

I need to run an old program found here: http://netlib.sandia.gov/conformal/ under the title "kirch1" in the list. I have absolutely no experience running fortran code, but I would like to do so from my Mac OS X 10.10 command line.
I know I have the 'gfortan' compiler installed on my system, but I'm not sure if this doesn't like this older code. When I run gfortran KIRCH1.f (this file is the one above) I get the following error:
KIRCH1.f:266.8:
x(2) = -1. + dx
1
Warning: Array reference at (1) is out of bounds (2 > 1) in dimension 1
KIRCH1.f:200.21:
common /param1/ nq2,c2,x2(20),z2(20),qwork2(460),betam2(20)
1
Warning: Padding of 4 bytes required before 'c2' in COMMON 'param1' at (1); reorder elements or use -fno-align-commons
KIRCH1.f:285.21:
common /param1/ nq,c,x(20),z(20),qwork(460),betam(20)
1
Warning: Padding of 4 bytes required before 'c' in COMMON 'param1' at (1); reorder elements or use -fno-align-commons
Undefined symbols for architecture x86_64:
"_gaussj_", referenced from:
_qinitx_ in ccoKtvwZ.o
"_ns01a_", referenced from:
_ksolv_ in ccoKtvwZ.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
This error seems to be do to the syntax in the code? I doubt there is anything wrong with the code itself, so I'm thinking its something to do with my systems interpretation of the code (for lack of a better way of phrasing this)
I have no fortran programming experience, I should mention. What am I doing wrong?
EDIT
As suggested by Ed Smith
I run gfortran sclibdbl.f KIRCH1.f but I still get the following warnings:
KIRCH1.f:266.8:
x(2) = -1. + dx
1
Warning: Array reference at (1) is out of bounds (2 > 1) in dimension 1
KIRCH1.f:200.21:
common /param1/ nq2,c2,x2(20),z2(20),qwork2(460),betam2(20)
1
Warning: Padding of 4 bytes required before 'c2' in COMMON 'param1' at (1); reorder elements or use -fno-align-commons
KIRCH1.f:285.21:
common /param1/ nq,c,x(20),z(20),qwork(460),betam(20)
1
Warning: Padding of 4 bytes required before 'c' in COMMON 'param1' at (1); reorder elements or use -fno-align-commons
The following compiled for me:
gfortran sclibdbl.f KIRCH1.f
where KIRCH1.f is the code from http://netlib.sandia.gov/conformal/kirch1 and sclibdb1.f is the code from http://netlib.org/conformal/sclibdbl.
You were just missing the required subroutines gaussj and ns01a which are referenced in the KIRCH1 source code but included in sclibdbl. The code from netlib.org/conformal/sclibdbl includes both the gaussj and ns01a subroutine (note the underscore is added to routine names by default in gfortran).
As #francescalus noted, it's modern fortran compiler and old school FORTRAN code. The warning is because modern fortran is far more explicit about array extents. In this code, x is passed with size 1 to yxtran() which is okay as passing is a reference to the start of array. When element 2 is accessed the modern fortran compiler gets worried. You can remove the two common block errors by adding the -fno-align-commons flag to the compiler. The x(1) error could be removed by replacing x(1) on line 258 with x(n-1). Personally, I wouldn't worry unless you notice problems/unexpected behavior when you run the code (especially as it's from netlib).

Two header with same name in include path

In CINCLUDE path in my make file there are two headers with same name.
I cannot remove one of them . How can I instruct makefile to give priority to header files in a specific folder.
This is usually something specified by the compiler. For example with gcc, you can create the following files:
qq.c:
#include <qq.h>
int main (void) {
return 0;
}
1/qq.h:
#error file number 1
2/qq.h:
#error file number 2
Then, when you compile them:
pax> gcc -I1 -I2 -o qq qq.c
In file included from qq.c:1:
1/qq.h:1:2: #error file number 1
pax> gcc -I2 -I1 -o qq qq.c
In file included from qq.c:1:
2/qq.h:1:2: #error file number 2
In other words, it's the order in which the include paths are specified (with -I) which dictates the order of search (there are other things such as whether headers are named the same as system headers but they need not concern us here).

Resources