cxxmatrix: Awk throws an error on OSX

When running make on OSX, I get an error:

mbp:cxxmatrix osx$ awk -f glyph.awk glyph.def > glyph.inl
awk: calling undefined function or
 input record number 11, file glyph.def
 source line number 28

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 18 (10 by maintainers)

Most upvoted comments

Pulling latest patch and then:

$ brew install gawk
$ brew unlink awk
$ brew link --overwrite gawk
$ make clean
$ make all

Worked fine for me. Thanks all!

I am afraid I’m still unable to compile this:

mbp:cxxmatrix osx$ git rev-parse HEAD
385878cc4fa9b2529be779d9c412439488a5a50e
mbp:cxxmatrix osx$ make
awk -f glyph.awk glyph.def > glyph.inl
c++ -std=c++17 -Wall -Wextra -Os -MD -MP -MF cxxmatrix.dep -c -o cxxmatrix.o cxxmatrix.cpp
In file included from cxxmatrix.cpp:595:
./glyph.inl:78:2: error: illegal character encoding in character literal
{U'<EF>', 21, {127, 65, 65, 65, 65, 65, 127, }},
 ^
./glyph.inl:79:2: error: illegal character encoding in character literal
{U'<EF>', 21, {573695, 2072768, 104616, 104344, 37000, 1609860, 430211, }},
 ^
./glyph.inl:80:2: error: illegal character encoding in character literal
{U'<EF>', 21, {164354, 260859, 2015779, 1221155, 692770, 429602, 1238014, }},
 ^
./glyph.inl:81:2: error: illegal character encoding in character literal
{U'<EF>', 21, {526408, 1044472, 796815, 1841292, 659452, 592138, 583945, }},
 ^
./glyph.inl:82:2: error: illegal character encoding in character literal
{U'<EF>', 21, {33, 8161, 4159, 4136, 4136, 4134, 8161, }},
 ^
./glyph.inl:83:2: error: illegal character encoding in character literal
{U'<EF>', 21, {0, 0, 0, 0, 0, 0, 0, }},
 ^
./glyph.inl:84:2: error: illegal character encoding in character literal
{U'<EF>', 21, {0, 0, 0, 0, 0, 0, 0, }},
 ^
./glyph.inl:85:2: error: illegal character encoding in character literal
{U'<EF>', 21, {0, 0, 0, 0, 0, 0, 0, }},
 ^
./glyph.inl:86:2: error: illegal character encoding in character literal
{U'<EF>', 21, {0, 0, 0, 0, 0, 0, 0, }},
 ^
./glyph.inl:87:2: error: illegal character encoding in character literal
{U'<EF>', 21, {0, 0, 0, 0, 0, 0, 0, }},
 ^
./glyph.inl:88:2: error: illegal character encoding in character literal
{U'<EF>', 21, {0, 0, 0, 0, 0, 0, 0, }},
 ^
./glyph.inl:89:2: error: illegal character encoding in character literal
{U'<EF>', 21, {2088610, 49314, 53247, 49314, 1089696, 823440, 233102, }},
 ^
./glyph.inl:90:2: error: illegal character encoding in character literal
{U'<EF>', 21, {1771019, 722443, 1772543, 459530, 164490, 147979, 1719027, }},
 ^
./glyph.inl:91:2: error: illegal character encoding in character literal
{U'<EF>', 21, {825871, 862700, 1911052, 790525, 657674, 592137, 583912, }},
 ^
./glyph.inl:92:2: error: illegal character encoding in character literal
{U'<EF>', 21, {175, 160, 959, 7336, 168, 166, 161, }},
 ^
./glyph.inl:93:2: error: illegal character encoding in character literal
{U'<EF>', 21, {0, 0, 0, 0, 0, 0, 0, }},
 ^
./glyph.inl:94:2: error: illegal character encoding in character literal
{U'<EF>', 21, {0, 0, 0, 0, 0, 0, 0, }},
 ^
./glyph.inl:95:2: error: illegal character encoding in character literal
{U'<EF>', 21, {0, 0, 0, 0, 0, 0, 0, }},
 ^
./glyph.inl:96:2: error: illegal character encoding in character literal
{U'<EF>', 21, {0, 0, 0, 0, 0, 0, 0, }},
 ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [cxxmatrix.o] Error 1

I am unable to make your previous version too I’m afraid.

mbp:cxxmatrix osx$ git checkout 761eeb097205af1a21d0a78e6ee714454bf747dd
Note: checking out '761eeb097205af1a21d0a78e6ee714454bf747dd'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

HEAD is now at 761eeb0 glyph: avoid using GNU awk specific "or" and "lshift"
mbp:cxxmatrix osx$ git status
HEAD detached at 761eeb0
nothing to commit, working tree clean
mbp:cxxmatrix osx$ make
awk -f glyph.awk glyph.def > glyph.inl
awk: calling undefined function strtonum
 input record number 98, file glyph.def
 source line number 15
make: *** [glyph.inl] Error 2

Edit: 761eeb0 manages to compile on second attempt, as was already mentioned.

FWIW, installing a GNU awk (which https://github.com/akinomyoga/cxxmatrix/commit/4fbee4279484050070f40b30377f9ab4c67772eb detected) fixed the issue for me on macOS.

@akinomyoga not OP but:

locale
LANG=""
LC_COLLATE="C"
LC_CTYPE="UTF-8"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=

The command you gave output the same error:

$ LC_ALL="C.UTF-8" make all
awk -f glyph.awk glyph.def > glyph.inl
c++ -std=c++17 -Wall -Wextra -Os -MD -MP -MF cxxmatrix.dep -c -o cxxmatrix.o cxxmatrix.cpp
In file included from cxxmatrix.cpp:595:
./glyph.inl:78:2: error: illegal character encoding in character literal
{U'<EF>', 21, {127, 65, 65, 65, 65, 65, 127, }},
 ^
./glyph.inl:79:2: error: illegal character encoding in character literal
{U'<EF>', 21, {573695, 2072768, 104616, 104344, 37000, 1609860, 430211, }},
 ^
./glyph.inl:80:2: error: illegal character encoding in character literal
{U'<EF>', 21, {164354, 260859, 2015779, 1221155, 692770, 429602, 1238014, }},
 ^
./glyph.inl:81:2: error: illegal character encoding in character literal
{U'<EF>', 21, {526408, 1044472, 796815, 1841292, 659452, 592138, 583945, }},
 ^

@mimischi Thank you very much for the information!

Unfortunately the MacBook Air I’m using is struggling to keep up with the load while running 😃

The performance largely depends on the terminal emulators. For example, iTerm2 is extremely slow according to the benchmark test by alacritty. Terminal.app and xterm are also slow. Maybe you can try it with faster terminal emulators such as urxvt (rxvt-unicode) or Alacritty (though I haven’t tested with Alacritty).

Running make the second time manages to compile the software.

$ git rev-parse HEAD
761eeb097205af1a21d0a78e6ee714454bf747dd
$ make
awk -f glyph.awk glyph.def > glyph.inl
awk: calling undefined function strtonum
 input record number 98, file glyph.def
 source line number 15
make: *** [glyph.inl] Error 2
$ make
c++ -std=c++17 -Wall -Wextra -Os -MD -MP -MF cxxmatrix.dep -c -o cxxmatrix.o cxxmatrix.cpp
cxxmatrix.cpp:27:15: warning: unused variable 'xmatrix_cell_power_max' [-Wunused-const-variable]
constexpr int xmatrix_cell_power_max = 10;
              ^
1 warning generated.
c++ -std=c++17 -Wall -Wextra -Os -o cxxmatrix cxxmatrix.o

Unfortunately the MacBook Air I’m using is struggling to keep up with the load while running 😃 Thanks for the software though!