Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.4.1 fails to build on FreeBSD 11.0-RELEASE-p6 #54

Closed
ghostonthewire opened this issue Jan 9, 2017 · 2 comments
Closed

0.4.1 fails to build on FreeBSD 11.0-RELEASE-p6 #54

ghostonthewire opened this issue Jan 9, 2017 · 2 comments

Comments

@ghostonthewire
Copy link

Hello,

I'm working on sysutils/dateutils FreeBSD port and encountered following build error:

===>  Building for dateutils-0.4.1
Making all in build-aux
/usr/bin/make  all-am
cc -std=gnu11 -DHAVE_CONFIG_H -I. -I../src  -D_POSIX_C_SOURCE=200809L  -D_XOPEN_SOURCE=700 -D_BSD_SOURCE  -D_ALL_SOURCE -D_DARWIN_C_SOURCE  -D_NETBSD_SOURCE  -DYUCK_TEMPLATE_PATH='"/wrkdirs/usr/ports/sysutils/dateutils/work/dateutils-0.4.1/build-aux"'  -DWITH_SCMVER  -DBOOTSTRAP -DWITH_SCMVER   -O2 -pipe  -fstack-protector -fno-strict-aliasing   -ggdb3  -Wall -Wextra -Wsign-compare -Wno-char-subscripts -Wundef -Wpointer-arith -Wshadow -Wmissing-declarations -Wmissing-prototypes -Winline -Wbad-function-cast -Wcast-qual -Wcast-align -Wno-switch -Wunused-function -Wunused-variable -Wunused-parameter -Wunused-value -Wunused -fdiagnostics-show-option -Wunknown-pragmas -Wuninitialized -Wreorder -Wdeprecated -Wno-parentheses -Wstrict-aliasing -MT yuck_bootstrap-yuck.o -MD -MP -MF .deps/yuck_bootstrap-yuck.Tpo -c -o yuck_bootstrap-yuck.o `test -f 'yuck.c' || echo './'`yuck.c
mv -f .deps/yuck_bootstrap-yuck.Tpo .deps/yuck_bootstrap-yuck.Po
/bin/sh ../libtool  --tag=CC    --mode=link cc -std=gnu11  -O2 -pipe  -fstack-protector -fno-strict-aliasing   -ggdb3  -Wall -Wextra -Wsign-compare -Wno-char-subscripts -Wundef -Wpointer-arith -Wshadow -Wmissing-declarations -Wmissing-prototypes -Winline -Wbad-function-cast -Wcast-qual -Wcast-align -Wno-switch -Wunused-function -Wunused-variable -Wunused-parameter -Wunused-value -Wunused -fdiagnostics-show-option -Wunknown-pragmas -Wuninitialized -Wreorder -Wdeprecated -Wno-parentheses -Wstrict-aliasing   -fstack-protector -o yuck-bootstrap yuck_bootstrap-yuck.o  
libtool: link: cc -std=gnu11 -O2 -pipe -fstack-protector -fno-strict-aliasing -ggdb3 -Wall -Wextra -Wsign-compare -Wno-char-subscripts -Wundef -Wpointer-arith -Wshadow -Wmissing-declarations -Wmissing-prototypes -Winline -Wbad-function-cast -Wcast-qual -Wcast-align -Wno-switch -Wunused-function -Wunused-variable -Wunused-parameter -Wunused-value -Wunused -fdiagnostics-show-option -Wunknown-pragmas -Wuninitialized -Wreorder -Wdeprecated -Wno-parentheses -Wstrict-aliasing -fstack-protector -o yuck-bootstrap yuck_bootstrap-yuck.o 
cc -std=gnu11 -DHAVE_CONFIG_H -I. -I../src  -D_POSIX_C_SOURCE=200809L  -D_XOPEN_SOURCE=700 -D_BSD_SOURCE  -D_ALL_SOURCE -D_DARWIN_C_SOURCE  -D_NETBSD_SOURCE  -DYUCK_TEMPLATE_PATH='"/wrkdirs/usr/ports/sysutils/dateutils/work/dateutils-0.4.1/build-aux"'  -DWITH_SCMVER   -O2 -pipe  -fstack-protector -fno-strict-aliasing   -ggdb3  -Wall -Wextra -Wsign-compare -Wno-char-subscripts -Wundef -Wpointer-arith -Wshadow -Wmissing-declarations -Wmissing-prototypes -Winline -Wbad-function-cast -Wcast-qual -Wcast-align -Wno-switch -Wunused-function -Wunused-variable -Wunused-parameter -Wunused-value -Wunused -fdiagnostics-show-option -Wunknown-pragmas -Wuninitialized -Wreorder -Wdeprecated -Wno-parentheses -Wstrict-aliasing -MT yuck-yuck.o -MD -MP -MF .deps/yuck-yuck.Tpo -c -o yuck-yuck.o `test -f 'yuck.c' || echo './'`yuck.c
yuck.c:1160:15: error: use of undeclared identifier 'CTL_KERN'
        int mib[] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1};
                     ^
yuck.c:1160:25: error: use of undeclared identifier 'KERN_PROC'
        int mib[] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1};
                               ^
yuck.c:1160:36: error: use of undeclared identifier 'KERN_PROC_PATHNAME'
        int mib[] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1};
                                          ^
yuck.c:1164:15: warning: implicit declaration of function 'sysctl' is invalid in C99 [-Wimplicit-function-declaration]
        if (UNLIKELY(sysctl(mib, countof(mib), buf, &bsz, NULL, 0) < 0)) {
                     ^
yuck.c:1164:27: error: invalid application of 'sizeof' to an incomplete type 'int []'
        if (UNLIKELY(sysctl(mib, countof(mib), buf, &bsz, NULL, 0) < 0)) {
            ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
yuck.c:80:28: note: expanded from macro 'countof'
# define countof(x)     (sizeof(x) / sizeof(*x))
                               ^
yuck.c:73:41: note: expanded from macro 'UNLIKELY'
# define UNLIKELY(_x)   __builtin_expect((_x), 0)
                                          ^~
yuck.c:1361:17: warning: implicitly declaring library function 'vfork' with type 'int (void)' [-Wimplicit-function-declaration]
        switch ((m4p = vfork())) {
                       ^
yuck.c:1361:17: note: include the header <unistd.h> or explicitly provide a declaration for 'vfork'
2 warnings and 4 errors generated.
*** Error code 1

Stop.
make[3]: stopped in /wrkdirs/usr/ports/sysutils/dateutils/work/dateutils-0.4.1/build-aux
*** Error code 1

Stop.
make[2]: stopped in /wrkdirs/usr/ports/sysutils/dateutils/work/dateutils-0.4.1/build-aux
*** Error code 1

Stop.
make[1]: stopped in /wrkdirs/usr/ports/sysutils/dateutils/work/dateutils-0.4.1
*** Error code 1

Stop.
make: stopped in /usr/ports/sysutils/dateutils

Full build log is available here.

Following patch fixed build issue, but I'm not sure that root cause was addressed.

--- ./build-aux/yuck.c.orig       2017-01-09 22:46:09.567046000 +0000
+++ ./build-aux/yuck.c    2017-01-09 22:47:34.812054000 +0000
@@ -61,6 +61,8 @@
 #include <fcntl.h>
 #include <sys/wait.h>
 #include <sys/stat.h>
+#include <sys/types.h>
+#include <sys/sysctl.h>
 #include <time.h>
 #if defined WITH_SCMVER
 # include <yuck-scmver.h>

P.S. Also, for some reason, lib files (include/dateutils/*.h, lib/libdut.a, libdata/pkgconfig/libdut.pc) weren't installed during make install phase, though have been built successfully.

hroptatyr added a commit that referenced this issue Jan 10, 2017
* bug/54:
  fix, fix build issue on FreeBSD 11 as proposed in bug #54
@hroptatyr
Copy link
Owner

Thanks for the report. I applied your suggested patch, it should be the root cause because none of the KERN_* directives are defined without that header.

As for the PS, I gave up on C language bindings a while ago (apart from using the libdut library internally). Mainly because the API doesn't feel as elegant as I originally envisaged.
Secondly, most of the power lies in orthogonal concepts (parsing, formatting, timezones, dates vs. date/times, etc.) being glued together and provided through the command line tools, for a reusable kit (and only those should be installed) all the glue and I/O magic would have to be part of the library too.
Now to make an API that feels right isn't an easy task, I tried and failed and haven't tried again since.

ghostonthewire added a commit to ghostonthewire/freebsd-ports that referenced this issue Jan 10, 2017
- Update to version 0.4.1
- Remove legacy patches which was accepted upstream [^1]
- Fix build error [^2]
- Remove C bindings from pkg-plist. Author no longer considers API as
  public. Extended commentary on the topic given by him in issue freebsd#54.
- portlint yields single warning regarding no ftp/http mirror in
  MASTER_SITES, but I have no idea how to resolve it. Author
  [admittedly] uses GH as primary platform, but it's HTTPS as well and
  does nothing in this case.

Has been successfully built on following versions:
10.2-RELEASE-p28/amd64
10.2-RELEASE-p28/i386
10.3-RELEASE-p15/amd64
10.3-RELEASE-p15/i386
11.0-RELEASE-p6/amd64
11.0-RELEASE-p6/i386

Full poudriere logs -
https://gist.github.com/15287909c8dc2e3a5030c763cb7607a6

[^1]: hroptatyr/dateutils@45ebf6d

[^2]: hroptatyr/dateutils#54, patch was
accepted by author
@ghostonthewire
Copy link
Author

Thanks for your prompt response and commentary regarding C bindings. Have just successfully built port on various FreeBSD versions/architectures and submitted patch (Bug 215931) to freebsd-ports-bugs@. Issue is now resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants