Using SoX 14.4.2 on OS X 10.9.5, the output from sox --version is missing the version number:
$ sox --version
sox: SoX v
$
This is using OS X 10.9.5, Xcode 6.1.1, and Apple's compiler:
Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
The same result occurs using clang 3.6.
Configuring with CFLAGS=-g instead of the default -O2, it works as expected.
Looking at the assembly output, it appears that as part of its optimization the compiler replaced the call to sox_version() with a simple load of the address of the static versionstr buffer that would be returned by sox_version(). Because sox_version() does not end up being called, the versionstr buffer contains an empty string.
It appears that this occurs because the function sox_version() was declared in src/sox.h as LSX_RETURN_PURE (i.e. __attribute__ ((pure))). However the function actually does have an important side effect, which is to fill in the versionstr buffer. The functions sox_version_info() and lsx_enum_option() also appear to have potential side effects despite being marked LSX_RETURN_PURE. Removing LSX_RETURN_PURE from these functions resolves the issue.
https://codeberg.org/sox_ng/sox_ng/issues/159