davidepatti / noxim

Network on Chip Simulator
230 stars 122 forks source link

Error: (E549) uncaught exception: yaml-cpp: error at line 0, column 0: invalid node; this may result from using a map iterator as a sequence iterator, or vice-versa #21

Closed jjgcc closed 7 years ago

jjgcc commented 7 years ago

I've installed noxim in my Ubuntu 16.04 machine, with libyaml-cpp-dev and libboost-dev packages from official Ubuntu repositories.

Executing the command:

[...]/noxim/bin$ ./noxim -config ../config_examples/default_config.yaml 

        SystemC 2.3.1-Accellera --- Apr  7 2017 12:26:23
        Copyright (c) 1996-2014 by all Contributors,
        ALL RIGHTS RESERVED

        Noxim - the NoC Simulator
        (C) University of Catania

Loading configuration from file "../config_examples/default_config.yaml"... Done
Loading power configurations from file "power.yaml"... Done

Error: (E549) uncaught exception: yaml-cpp: error at line 0, column 0: invalid node; 
this may result from using a map iterator as a sequence iterator, or vice-versa
In file: ../../../../src/sysc/kernel/sc_except.cpp:100

Have I done something wrong? I just followed the install instructions in the doc/INSTALL.txt file...

jjgcc commented 7 years ago

Fixed, the way I did it was the following:

Instead of installing the libyaml-cpp-dev from Ubuntu official repositories, I downloaded the latest version from https://github.com/jbeder/yaml-cpp/archive/master.zip, as stated in the doc/INSTALL.txt (alternative way).

Once yaml-cpp was built and installed in a custom folder of mine, I modified the noxim Makefile to read:

##### LIBRARIES CONFIGURATION #####

SYSTEMC := /home/juanjosegcc/local/systemc/2.3.1a
YAML    := /home/juanjosegcc/local/yaml-cpp/0.5.3

##### DIRECTORIES #####

SYSTEMC_LIBS := $(wildcard $(SYSTEMC)/lib-*)

SRCDIR  := ../src
SUBDIRS := $(filter %/,$(wildcard $(SRCDIR)/*/))
OBJDIR  := ./build

SRCS := $(wildcard $(SRCDIR)/*.cpp) $(wildcard $(addsuffix *.cpp,$(SUBDIRS)))
OBJS := $(subst $(SRCDIR),$(OBJDIR),$(SRCS:.cpp=.o))

MODULE := noxim

##### COMPILER OPTIONS #####

CXX      := g++
OPT      := -O3
DEBUG    := # -g -DDEBUG
OTHER    := -Wall -DSC_NO_WRITE_CHECK -std=c++11# -Wno-deprecated
CXXFLAGS := $(OPT) $(OTHER) $(DEBUG)

INCDIR := -I$(SRCDIR) -isystem $(SYSTEMC)/include -I$(YAML)/include
LIBDIR := -L$(SRCDIR) -L$(SYSTEMC_LIBS) -L$(YAML)/lib

LIBS := -lsystemc -lm -lyaml-cpp 

SPACE := $(subst ,, )
VPATH := $(SRCDIR):$(subst $(SPACE),:,$(SUBDIRS))

##### RULES #####

$(MODULE): $(OBJS)
    $(CXX) $(LIBDIR) $^ $(LIBS) -o $@ 2>&1 | c++filt

$(OBJDIR)/%.o: %.cpp
    @mkdir -p $(dir $@)
    $(CXX) $(CXXFLAGS) $(INCDIR) -c $< -o $@

clean:
    rm -f $(OBJS) $(MODULE) *~

depend: 
    makedepend $(SRCS) -Y -f- 2>/dev/null | sed 's_$(SRCDIR)_$(OBJDIR)_' > Makefile.deps

-include Makefile.deps

As you can see the variables SYSTEMC and YAML at the beginning were modified with my custom folders (just as the doc/INSTALL.txt suggests), but also in variable OTHER you should add the compiler option -std=c++11 in order to build with the yaml-cpp library.

Thats it! Looks like the latests version in Ubuntu repositories of yaml-cpp is v.0.5.2, but the version downloaded from the author's repository is v0.5.3.

Kind regards

Jiji10 commented 6 years ago

Hello, I have the same problem, when I execute Noxim, I have the following error: ./noxim -config ../config_examples/default_config.yaml

SystemC 2.3.1-Accellera --- Nov 20 2017 10:56:41
Copyright (c) 1996-2014 by all Contributors,
ALL RIGHTS RESERVED

Noxim - the WNoC Simulator
(C) University of Catania

Adaptations by LGGM - UdeA

Loading configuration from file "../config_examples/default_config.yaml"... Done Loading power configurations from file "power.yaml"... Done

Error: (E549) uncaught exception: yaml-cpp: error at line 0, column 0: invalid node; this may result from using a map iterator as a sequence iterator, or vice-versa In file: ../../../../src/sysc/kernel/sc_except.cpp:100

The noxim Makefile is as follow: `##### LIBRARIES CONFIGURATION ##### SYSTEMC := /usr/local/systemc-2.3.1 YAML := /usr/local/include/yaml-cpp

DIRECTORIES

SYSTEMC_LIBS := $(wildcard $(SYSTEMC)/lib-*)

SRCDIR := ../src SUBDIRS := $(filter %/,$(wildcard $(SRCDIR)/*/)) OBJDIR := ./build

SRCS := $(wildcard $(SRCDIR)/.cpp) $(wildcard $(addsuffix .cpp,$(SUBDIRS))) OBJS := $(subst $(SRCDIR),$(OBJDIR),$(SRCS:.cpp=.o)) DEPS := $(OBJS:.o=.d)

MODULE := noxim

COMPILER OPTIONS

CXX := g++ OPT := -O3 -MMD DEBUG := #-g -DDEBUG

OTHER := -Wall# -Wno-deprecated

OTHER := -Wall -DSC_NO_WRITE_CHECK -std=c++11# -Wno-deprecated ... `