Hey, I ran into a few issues compiling on FreeBSD 11 from the source tree, so I put together some patches to address the issues. I wanted to run the check-tests on FreeBSD before submitting a PR, but, another platform error in the tests is preventing me from completing it. I will add those patches to a PR once I've got tests running.
# uname -a
FreeBSD buildtest 11.1-RELEASE FreeBSD 11.1-RELEASE #0 r321309: Fri Jul 21 02:08:28 UTC 2017 root@releng2.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64
# clang --version
FreeBSD clang version 4.0.0 (tags/RELEASE_400/final 297347) (based on LLVM 4.0.0)
Target: x86_64-unknown-freebsd11.1
Thread model: posix
InstalledDir: /usr/bin
# pkg info autoconf automake libtool
autoconf-2.69_1
automake-1.15.1
libtool-2.4.6
Here's the technical breakdowns. I've got patches but I'm not ready to post a PR until I've got the tests running...
Detect FreeBSD in configure
FreeBSD requires __BSD_VISIBLE to be set to expose M_PI and mkstemp() in the
system includes. This is normally set when _ANSI_SOURCE, _C99_SOURCE, or
_C11_SOURCE are undefined, but, I don't see any of those being set by autotools. I don't want to dig into what the compiler is setting, so I'm just detecting the __freebsd__ compiler-macro in the configure script to add the __BSD_VISIBLE CFLAG.
The definitions for towlower() and towupper() are defined in /usr/include/wctype.h on FreeBSD. I just removed the define and used the ucd_ equivilent where towlower/towupper were found.
/bin/sh ./libtool --tag=CC --mode=compile cc -DHAVE_CONFIG_H -I. -fPIC -fvisibility=hidden -pedantic -fno-exceptions -D PATH_ESPEAK_DATA=\"/usr/local/share/espeak-
ng-data\" -DLIBESPEAK_NG_EXPORT -Isrc/include -Isrc/include/compat -I src/ucd-tools/src/include -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_POSIX_C_SOURCE=200112L -Wno-endif-lab
els -g -O2 -std=c99 -MT src/libespeak-ng/src_libespeak_ng_la-readclause.lo -MD -MP -MF src/libespeak-ng/.deps/src_libespeak_ng_la-readclause.Tpo -c -o src/libespeak-n
g/src_libespeak_ng_la-readclause.lo `test -f 'src/libespeak-ng/readclause.c' || echo './'`src/libespeak-ng/readclause.c
libtool: compile: cc -DHAVE_CONFIG_H -I. -fPIC -fvisibility=hidden -pedantic -fno-exceptions -D PATH_ESPEAK_DATA=\"/usr/local/share/espeak-ng-data\" -DLIBESPEAK_NG_EXPO
RT -Isrc/include -Isrc/include/compat -I src/ucd-tools/src/include -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_POSIX_C_SOURCE=200112L -Wno-endif-labels -g -O2 -std=c99 -MT src/li
bespeak-ng/src_libespeak_ng_la-readclause.lo -MD -MP -MF src/libespeak-ng/.deps/src_libespeak_ng_la-readclause.Tpo -c src/libespeak-ng/readclause.c -fPIC -DPIC -o src/l
ibespeak-ng/.libs/src_libespeak_ng_la-readclause.o
In file included from src/libespeak-ng/readclause.c:32:
In file included from src/include/compat/wctype.h:30:
/usr/include/wctype.h:73:8: error: conflicting types for 'ucd_tolower'
wint_t towlower(wint_t);
^
src/include/compat/wchar.h:37:18: note: expanded from macro 'towlower'
^
src/ucd-tools/src/include/ucd/ucd.h:503:13: note: previous declaration is here
codepoint_t ucd_tolower(codepoint_t c);
^
In file included from src/libespeak-ng/readclause.c:32:
In file included from src/include/compat/wctype.h:30:
/usr/include/wctype.h:74:8: error: conflicting types for 'ucd_toupper'
wint_t towupper(wint_t);
^
src/include/compat/wchar.h:38:18: note: expanded from macro 'towupper'
^
src/ucd-tools/src/include/ucd/ucd.h:491:13: note: previous declaration is here
codepoint_t ucd_toupper(codepoint_t c);
^
src/libespeak-ng/readclause.c:366:19: warning: implicit declaration of function 'mkstemp' is invalid in C99 [-Wimplicit-function-declaration]
if ((fd_temp = mkstemp(fname_temp)) >= 0)
^
1 warning and 2 errors generated.
The mkstemp() warning is fixed by the __BSD_VISIBLE change.
sha1sum linuxism in tests/languages.test
The command-line program sha1sum doesn't exist on FreeBSD. It should be possible to use the analogous command, sha1, for FreeBSD instead.
tests/languages.test: sha1sum: not found
---
Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/48866382-build-and-test-errors-on-freebsd-11-1?utm_campaign=plugin&utm_content=tracker%2F254964&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F254964&utm_medium=issues&utm_source=github).
Hey, I ran into a few issues compiling on FreeBSD 11 from the source tree, so I put together some patches to address the issues. I wanted to run the check-tests on FreeBSD before submitting a PR, but, another platform error in the tests is preventing me from completing it. I will add those patches to a PR once I've got tests running.
Here's the technical breakdowns. I've got patches but I'm not ready to post a PR until I've got the tests running...
Detect FreeBSD in configure
FreeBSD requires
__BSD_VISIBLE
to be set to exposeM_PI
andmkstemp()
in the system includes. This is normally set when_ANSI_SOURCE
,_C99_SOURCE
, or_C11_SOURCE
are undefined, but, I don't see any of those being set by autotools. I don't want to dig into what the compiler is setting, so I'm just detecting the__freebsd__
compiler-macro in the configure script to add the__BSD_VISIBLE
CFLAG.towlower/towupper name conflicts
The definitions for towlower() and towupper() are defined in /usr/include/wctype.h on FreeBSD. I just removed the define and used the ucd_ equivilent where towlower/towupper were found.
The
mkstemp()
warning is fixed by the __BSD_VISIBLE change.sha1sum linuxism in tests/languages.test
The command-line program
sha1sum
doesn't exist on FreeBSD. It should be possible to use the analogous command,sha1
, for FreeBSD instead.