why do I get "expected variable name"

45 views
Skip to first unread message

Basile Starynkevitch

unread,
Nov 30, 2020, 11:47:46 AM11/30/20
to ninja-build

Hello all,

In the Bismon software project (GPLv3+, for Linux), documented in http://starynkevitch.net/Basile/bismon-chariot-doc.pdf and funded by the http://www.chariotproject.eu/ project, I have an issue with ninja (probably I am misunderstanding the documentation).

The source code of Bismon is on https://github.com/bstarynk/bismon/

I am referring to its readline branch, more precisely to commit https://github.com/bstarynk/bismon/commit/4a06a5b84b8b7417169e27b0ca4f8b9894b007fc

This is on Linux/x86-64 Ubuntu 20.04 and /usr/bin/ninja is version 1.10.0

The build.ninja is generated by a C++ program, BISMON-config.cc

The generated build.ninja contains
# GENERATED file for ninja-build.org - /home/basile/bismon-readline/build.ninja - DONT EDIT
# ... for Bismon, see https://github.com/bstarynk/bismon -*- ninja -*-
# ... generated at 2020 Nov 30, 10:05:18 CET on pcbasile
# ... by BISMON-config.cc git 4a06a5b84b8b7417

# ... invoked as:
#|  ./BISMON-config --skip=for_1_ninja \
#|   --target-gcc=/usr/bin/gcc-10 --target-gxx=/usr/bin/g++-10 --output-directory=/home/basile/bismon-readline --ninja=build.ninja

ninja_required_version= 1.10

NJBM_short_gitid= 4a06a5b84b8b7417
NJBM_directory= /home/basile/bismon-readline
NJBM_make= make

NJBM_target_gcc= /usr/bin/gcc-10
NJBM_target_gxx= /usr/bin/g++-10

NJBM_pkgconfig_packages= glib-2.0 readline
NJBM_pkgconfig_cflags=-D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/readline

NJBM_pkgconfig_libs=-lglib-2.0 -lreadline

NJBM_host_cc= gcc
NJBM_host_cxx= g++
NJBM_host_optim_flags= -O
NJBM_host_prepro_flags= -I/usr/local/include
NJBM_host_debug_flags= -g
NJBM_host_warn_flags= -Wall -Wextra
NJBM_host_cwarn_flags= -Wmissing-prototypes

# hardcoded rules from BISMON-config.cc:631
#+++++++++++++++++++++++++++

# our hardcoded rules for ninja - conventionally ended by _rlBM
# see https://ninja-build.org/manual.html
###########
# compilation of _BM.c files
rule CC_rlBM
  depfile = _$out.mkd - handwritten C code
  description = CC_rlBM $out < $in (handwritten C code)
  command = $NJBM_host_cc -c $NJBM_host_warn_flags $NJBM_host_cwarn_flags $$
            $NJBM_host_optim_flags $NJBM_host_debug_flags $NJBM_host_prepro_flags $$
               -MD -MF _$out.mkd $$
               $in -o $out

# compilation of _BM.cc files - handwritten C++ code
rule CXX_rlBM
  depfile = _$out.mkd
  description = CXX_rlBM $out < $in (handwritten C++ code)
  command = $NJBM_host_cxx -c $NJBM_host_warn_flags $$
            $NJBM_host_optim_flags $NJBM_host_debug_flags $$
            $NJBM_host_prepro_flags $NJBM_pkgconfig_cflags $$
            -MD -MF  _$out.mkd $$
            $in -o $out


# compilation of generated modules/modbm_.c into a modubin/*.so shared object
rule MODCC_rlBM
  depfile = _$out.mkd
  description = MODCC_rlBM  $out < $in (generated C module)
  command = $NJBM_host_cxx -fPIC -shared $NJBM_host_warn_flags $$
            $NJBM_host_optim_flags $NJBM_host_debug_flags $$
            $NJBM_host_prepro_flags $NJBM_pkgconfig_cflags $$
            -MD -MF  _$out.mkd $$
            $in -o $out


# linking of all Bismon
rule LINKALLBISMON_rlBM
  description = LINKALLBISMON_rlBM (link everything into $out)
  command = $NJBM_host_cxx  $NJBM_host_warn_flags $$
            $NJBM_host_optim_flags $NJBM_host_debug_flags $$
            $in $NJBM_pkgconfig_libs
            -o $out

################### end of NinjaRules ###################

#---------------------------

# build 21 object files :::::::::
# .... from BISMON-config.cc:816
build allocgc_BM.o: CC_rlBM allocgc_BM.c

build code_BM.o: CC_rlBM code_BM.c

build jsonjansson_BM.o: CC_rlBM jsonjansson_BM.c

build user_BM.o: CC_rlBM user_BM.c

build sequence_BM.o: CC_rlBM sequence_BM.c

build id_BM.o: CC_rlBM id_BM.c

build agenda_BM.o: CC_rlBM agenda_BM.c

build list_BM.o: CC_rlBM list_BM.c

build emitcode_BM.o: CC_rlBM emitcode_BM.c

build node_BM.o: CC_rlBM node_BM.c

build load_BM.o: CC_rlBM load_BM.c

build dump_BM.o: CC_rlBM dump_BM.c

build parser_BM.o: CC_rlBM parser_BM.c

build assoc_BM.o: CC_rlBM assoc_BM.c

build gencode_BM.o: CC_rlBM gencode_BM.c

build main_BM.o: CC_rlBM main_BM.c

build object_BM.o: CC_rlBM object_BM.c

build scalar_BM.o: CC_rlBM scalar_BM.c

build engine_BM.o: CC_rlBM engine_BM.c

build primes_BM.o: CC_rlBM primes_BM.c

build misc_BM.o: CXX_rlBM misc_BM.cc


## building bismon executable - object files:
NJBM_object_files= allocgc_BM.o code_BM.o jsonjansson_BM.o $$
  user_BM.o sequence_BM.o id_BM.o agenda_BM.o $$
  list_BM.o emitcode_BM.o node_BM.o load_BM.o $$
  dump_BM.o parser_BM.o assoc_BM.o gencode_BM.o $$
  main_BM.o object_BM.o scalar_BM.o engine_BM.o $$
  primes_BM.o misc_BM.o

## building the bismon executable itself:
build bismon: LINKALLBISMON_rlBM $NJBM_object_files
## unimplemented bmc_print_config_ninja BISMON-config.cc:869


But when I am running in a terminal /usr/bin/ninja -v bismon I am getting the following error message:

ninja: error: build.ninja:43: expected variable name
            $NJBM_host_optim_flags $NJBM_host_debug_flags $NJBM_host_pre...
            ^ near here


What am I doing wrong?

Respectful regards from near Paris, France

Basile Starynkevitch

K. Moon

unread,
Nov 30, 2020, 12:12:08 PM11/30/20
to Basile Starynkevitch, ninja-build
I think you're using the wrong character for line continuations:
Also note that the error points to a different line than what you have in bold. (The CC_rlBM rule, rather than the CXX_rlBM rule.) This happens to be the first line that tries to continue across a line.

--
You received this message because you are subscribed to the Google Groups "ninja-build" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ninja-build...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ninja-build/db84b1c3-4524-4e15-89dd-181cb13ff8e7n%40googlegroups.com.

K. Moon

unread,
Nov 30, 2020, 12:14:26 PM11/30/20
to Basile Starynkevitch, ninja-build
No worries; good luck with your project!

On Mon, Nov 30, 2020 at 9:13 AM Basile Starynkevitch <bas...@starynkevitch.net> wrote:


On 11/30/20 6:11 PM, K. Moon wrote:
I think you're using the wrong character for line continuations:


Yes thanks a big lot. Sorry for my mistake

-- 
Basile Starynkevitch                  <bas...@starynkevitch.net>
(only mine opinions / les opinions sont miennes uniquement)
92340 Bourg-la-Reine, France
web page: starynkevitch.net/Basile/

Basile Starynkevitch

unread,
Dec 1, 2020, 8:31:47 AM12/1/20
to K. Moon, ninja-build


On 11/30/20 6:11 PM, K. Moon wrote:
I think you're using the wrong character for line continuations:


Yes thanks a big lot. Sorry for my mistake


Reply all
Reply to author
Forward
0 new messages