lichray / nvi2

A multibyte fork of the nvi editor for BSD

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Building on OSX

larryhynes opened this issue · comments

Hi

I am attempting the following on OS X 10.10.5 (Yosemite):

$ cd nvi2/build
$ cmake .
-- The C compiler identification is AppleClang 7.0.2.7000181
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Looking for openpty
-- Looking for openpty - found
-- Looking for __b64_ntop
-- Looking for __b64_ntop - not found
-- Looking for __iconv
-- Looking for __iconv - not found
-- Performing Test ICONV_TRADITIONAL
-- Performing Test ICONV_TRADITIONAL - Success
-- Looking for include file libutil.h
-- Looking for include file libutil.h - not found
-- Looking for include file ncurses.h
-- Looking for include file ncurses.h - found
-- Looking for include file term.h
-- Looking for include file term.h - found
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/larry/nvi2/build

So far, so good.

$ make
Scanning dependencies of target regex
[  1%] Building C object CMakeFiles/regex.dir/Users/larry/nvi2/regex/regcomp.c.o
[  2%] Building C object CMakeFiles/regex.dir/Users/larry/nvi2/regex/regerror.c.o
[  3%] Building C object CMakeFiles/regex.dir/Users/larry/nvi2/regex/regexec.c.o
[  4%] Building C object CMakeFiles/regex.dir/Users/larry/nvi2/regex/regfree.c.o
[  5%] Linking C static library libregex.a
[  5%] Built target regex
Scanning dependencies of target nvi
[  6%] Building C object CMakeFiles/nvi.dir/Users/larry/nvi2/cl/cl_funcs.c.o
In file included from /Users/larry/nvi2/cl/cl_funcs.c:32:
In file included from /Users/larry/nvi2/cl/../common/common.h:81:
/Users/larry/nvi2/cl/../common/cut.h:35:2: error: unknown type name 'recno_t'
        recno_t  lno;                   /* 1-N: file line. */
        ^
In file included from /Users/larry/nvi2/cl/cl_funcs.c:32:
In file included from /Users/larry/nvi2/cl/../common/common.h:84:
/Users/larry/nvi2/cl/../common/mark.h:26:2: error: unknown type name 'recno_t'
        recno_t  lno;                   /* Line number. */
        ^
/Users/larry/nvi2/cl/../common/mark.h:32:2: error: unknown type name 'recno_t'
        recno_t  lno;                   /* Line number. */
        ^
In file included from /Users/larry/nvi2/cl/cl_funcs.c:32:
In file included from /Users/larry/nvi2/cl/../common/common.h:86:
/Users/larry/nvi2/cl/../common/../ex/ex.h:71:2: error: unknown type name 'recno_t'
        recno_t start, stop;            /* Start/stop of the range. */
        ^
/Users/larry/nvi2/cl/../common/../ex/ex.h:79:2: error: unknown type name 'recno_t'
        recno_t   if_lno;               /* Associated line number. */
        ^
/Users/larry/nvi2/cl/../common/../ex/ex.h:96:2: error: unknown type name 'recno_t'
        recno_t   range_lno;            /* @/global range: set line number. */
        ^
/Users/larry/nvi2/cl/../common/../ex/ex.h:115:2: error: unknown type name 'recno_t'
        recno_t   lineno;               /* Command: line number. */
        ^
In file included from /Users/larry/nvi2/cl/cl_funcs.c:32:
In file included from /Users/larry/nvi2/cl/../common/common.h:86:
In file included from /Users/larry/nvi2/cl/../common/../ex/ex.h:233:
/Users/larry/nvi2/cl/../common/../ex/extern.h:44:32: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
int ex_g_insdel(SCR *, lnop_t, recno_t);
                               ^
/Users/larry/nvi2/cl/../common/../ex/extern.h:72:46: error: unknown type name 'recno_t'
int ex_readfp(SCR *, char *, FILE *, MARK *, recno_t *, int);
                                             ^
/Users/larry/nvi2/cl/../common/../ex/extern.h:78:22: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
int sscr_exec(SCR *, recno_t);
                     ^
/Users/larry/nvi2/cl/../common/../ex/extern.h:115:41: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
void ex_cinit(SCR *, EXCMD *, int, int, recno_t, recno_t, int);
                                        ^
/Users/larry/nvi2/cl/../common/../ex/extern.h:115:50: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
void ex_cinit(SCR *, EXCMD *, int, int, recno_t, recno_t, int);
                                                 ^
/Users/larry/nvi2/cl/../common/../ex/extern.h:115:50: error: redefinition of parameter 'recno_t'
/Users/larry/nvi2/cl/../common/../ex/extern.h:115:41: note: previous declaration is here
void ex_cinit(SCR *, EXCMD *, int, int, recno_t, recno_t, int);
                                        ^
In file included from /Users/larry/nvi2/cl/cl_funcs.c:32:
In file included from /Users/larry/nvi2/cl/../common/common.h:87:
/Users/larry/nvi2/cl/../common/gs.h:28:2: error: unknown type name 'recno_t'
        recno_t  lno;                   /* 1-N: file cursor line. */
        ^
/Users/larry/nvi2/cl/../common/gs.h:92:2: error: unknown type name 'recno_t'
        recno_t   if_lno;               /* Current associated line number. */
        ^
In file included from /Users/larry/nvi2/cl/cl_funcs.c:32:
In file included from /Users/larry/nvi2/cl/../common/common.h:88:
/Users/larry/nvi2/cl/../common/screen.h:62:2: error: unknown type name 'recno_t'
        recno_t  lno;                   /* 1-N: file line. */
        ^
/Users/larry/nvi2/cl/../common/screen.h:74:2: error: unknown type name 'recno_t'
        recno_t  rptlchange;            /* Ex/vi: last L_CHANGED lno. */
        ^
/Users/larry/nvi2/cl/../common/screen.h:75:2: error: unknown type name 'recno_t'
        recno_t  rptlines[L_YANKED + 1];/* Ex/vi: lines changed by last op. */
        ^
/Users/larry/nvi2/cl/../common/screen.h:81:2: error: unknown type name 'recno_t'
        recno_t  defscroll;             /* Vi: ^D, ^U scroll information. */
        ^
In file included from /Users/larry/nvi2/cl/cl_funcs.c:32:
In file included from /Users/larry/nvi2/cl/../common/common.h:89:
/Users/larry/nvi2/cl/../common/exf.h:24:2: error: unknown type name 'recno_t'
        recno_t  c_lno;                 /* Cached line number. */
        ^
/Users/larry/nvi2/cl/../common/exf.h:25:2: error: unknown type name 'recno_t'
        recno_t  c_nlines;              /* Cached lines in the file. */
        ^
/Users/larry/nvi2/cl/../common/exf.h:30:2: error: unknown type name 'recno_t'
        recno_t  l_high;                /* Log last + 1 record number. */
        ^
/Users/larry/nvi2/cl/../common/exf.h:31:2: error: unknown type name 'recno_t'
        recno_t  l_cur;                 /* Log current record number. */
        ^
In file included from /Users/larry/nvi2/cl/cl_funcs.c:32:
In file included from /Users/larry/nvi2/cl/../common/common.h:93:
/Users/larry/nvi2/cl/../common/extern.h:6:21: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
int cut_line(SCR *, recno_t, size_t, size_t, CB *);
                    ^
/Users/larry/nvi2/cl/../common/extern.h:35:20: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
int db_eget(SCR *, recno_t, CHAR_T **, size_t *, int *);
                   ^
/Users/larry/nvi2/cl/../common/extern.h:36:19: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
int db_get(SCR *, recno_t, u_int32_t, CHAR_T **, size_t *);
                  ^
/Users/larry/nvi2/cl/../common/extern.h:37:22: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
int db_delete(SCR *, recno_t);
                     ^
/Users/larry/nvi2/cl/../common/extern.h:38:27: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
int db_append(SCR *, int, recno_t, CHAR_T *, size_t);
                          ^
/Users/larry/nvi2/cl/../common/extern.h:39:22: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
int db_insert(SCR *, recno_t, CHAR_T *, size_t);
                     ^
/Users/larry/nvi2/cl/../common/extern.h:40:19: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
int db_set(SCR *, recno_t, CHAR_T *, size_t);
                  ^
/Users/larry/nvi2/cl/../common/extern.h:41:21: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
int db_exist(SCR *, recno_t);
                    ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
12 warnings and 20 errors generated.
make[2]: *** [CMakeFiles/nvi.dir/Users/larry/nvi2/cl/cl_funcs.c.o] Error 1
make[1]: *** [CMakeFiles/nvi.dir/all] Error 2
make: *** [all] Error 2

[exited with status 2.]

The errors referring to recno_t would appear to suggest that cmake isn't picking up the db.h file that's in /usr/local/include, or maybe I've got that wrong?

Should nvi2 build on OS X?

I spent some time adjusting the CMakeLists.txt file in an attempt to build against db.h. I also tried installing Berkeley DB v4 and building against that. None of that worked.

From /usr/include/db.h:

 *
 *  @(#)db.h    8.7 (Berkeley) 6/16/94
 * $FreeBSD: src/include/db.h,v 1.5 2002/03/26 01:35:05 bde Exp $
 */

(So I'm guessing Hypothesis No.1 is not valid.)

I can't really say much about Hypothesis No.2, but I will say that I find it surprising that there is no mention of db in the output of cmake .; like, if the db is required, shouldn't we check for it?

I have another version of Berkeley DB installed, in /usr/local; if I delete that, nvi2 builds fine. That package is required by other packages, though, so deleting it is not an ideal scenario. I wonder would it be possible to get cmake to specifically look for db.h in /usr?

Some other notes on the build process:

  1. It seems a little bit weird that there is no install target generated.
$ make install
make: *** No rule to make target `install'.  Stop.
  1. Would you be open to the idea of including an INSTALL file? I could draft one for review in a pull request, though that may well involve you spending more time answering my stupid questions about cmake (which I am not very familiar with) than if you just wrote one yourself.

Ah, thanks: cpp -Wp,-v does indeed specifically ignore /usr/include, for some bizarre reason:

ignoring duplicate directory "/usr/include"
  as it is a non-system directory that duplicates a system directory

I hadn't seen the Porting page on the wiki, thank you. (It seems to cover most of what INSTALL might, and more - perhaps link to it from the README so that people can find it? Note, that - on my system, at least - cmake -i, referred to on that wiki page, is no longer supported.)