Jump to content
ayoub

Systemc-2.3.1 installation issue.

Recommended Posts

I installed systemc-2.3.1 on Ubuntu 14.04.1. The installation appears to have gone well, "make check" passes all tests. When I try running the pipe example stand-alone I get the error listed below:

 

ayoub@VBox:~/systemc-2.3.1/examples/sysc/pipe$ make
gcc  -g -Wall -pedantic -Wno-long-long -Werror -I. -I.. -I/usr/local/systemc-2.3.1/include  -c display.cpp -o display.o
gcc  -g -Wall -pedantic -Wno-long-long -Werror -I. -I.. -I/usr/local/systemc-2.3.1/include  -c main.cpp -o main.o
gcc  -g -Wall -pedantic -Wno-long-long -Werror -I. -I.. -I/usr/local/systemc-2.3.1/include  -c numgen.cpp -o numgen.o
gcc  -g -Wall -pedantic -Wno-long-long -Werror -I. -I.. -I/usr/local/systemc-2.3.1/include  -c stage1.cpp -o stage1.o
gcc  -g -Wall -pedantic -Wno-long-long -Werror -I. -I.. -I/usr/local/systemc-2.3.1/include  -c stage2.cpp -o stage2.o
gcc  -g -Wall -pedantic -Wno-long-long -Werror -I. -I.. -I/usr/local/systemc-2.3.1/include  -c stage3.cpp -o stage3.o
gcc  -g -Wall -pedantic -Wno-long-long -Werror -L. -L.. -L /usr/local/systemc-2.3.1/lib-linux -Wl,-rpath=/usr/local/systemc-2.3.1/lib-linux -o pipe.x display.o main.o numgen.o stage1.o stage2.o stage3.o -lsystemc -lm  2>&1 | c++filt
/usr/bin/ld: main.o: undefined reference to symbol 'operator new(unsigned int)@@GLIBCXX_3.4'
//usr/lib/i386-linux-gnu/libstdc++.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [pipe.x] Error 1

 

 

 

ayoub@VBox:~/systemc-2.3.1/examples/sysc/pipe$ uname -a
Linux VBox 3.13.0-34-generic #60-Ubuntu SMP Wed Aug 13 15:49:09 UTC 2014 i686 i686 i686 GNU/Linux

 

ayoub@VBox:~/systemc-2.3.1/examples/sysc/pipe$ g++ --version
g++ (Ubuntu 4.8.2-19ubuntu1) 4.8.2
Copyright © 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Is this a real problem? Is there a fix out some where? I have seen similar c++ issues posted elswhere but no solutions.

 

Thanks,

 

Ayoub

Share this post


Link to post
Share on other sites

I added an echo line to the make rule that does the linking to be as:

    147 $(EXE): $(OBJS) $(SYSTEMC_LIB_DIR)/libsystemc.a
    148         echo $(SYSTEMC_HOME)    and    $(TARGET_ARCH)
    149         $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) 2>&1 | c++filt
    150         @test -x $@
    151
The output became (the second and  third lines show the result of the echo):

ayoub@VBox:~/systemc-2.3.1/examples/sysc/pipe$ make
echo /usr/local/systemc-2.3.1    and    linux
/usr/local/systemc-2.3.1 and linux
gcc  -g -Wall -pedantic -Wno-long-long -Werror -L. -L.. -L /usr/local/systemc-2.3.1/lib-linux -Wl,-rpath=/usr/local/systemc-2.3.1/lib-linux -o pipe.x display.o main.o numgen.o stage1.o stage2.o stage3.o -lsystemc -lm  2>&1 | c++filt
/usr/bin/ld: main.o: undefined reference to symbol 'operator new(unsigned int)@@GLIBCXX_3.4'
//usr/lib/i386-linux-gnu/libstdc++.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [pipe.x] Error 1
 

The variable do look match the systemC install as far as I can tell. The Install generated a number of files. Which one should I inspect or upload?

 

Thanks,

 

Ayoub

Share this post


Link to post
Share on other sites

You're using the C compiler driver gcc to compile C++ code. Therefore, the C++ standard library is not linked to your program leading to the linker error. You have to compile with g++. The default make rules use CC and CXX environment variables to respectively select the C and C++ compiler. As far as I remember, the SystemC configure script sets both environment variables for compiler selection (CC and CXX) to g++.

Share this post


Link to post
Share on other sites

That change allowed it to complete the linking. However, shouldn't the install scripts normally detect which compiler to use? The install scripts did not ask me for that information. 

 

Thanks,

 

Ayoub

Share this post


Link to post
Share on other sites

That change allowed it to complete the linking. However, shouldn't the install scripts normally detect which compiler to use? The install scripts did not ask me for that information.

 

There is indeed an issue in the Makefile.rules file, used when compiling the examples manually.  Due to some incomplete try to stay backwards-compatible with the old TLM Makefiles (which used CC instead of CXX), the Makefiles prefer CC over CXX (even for the linking) if explicitly set by the user.

 

You should be able to fix the problem by changing all occurrences of $(CC) to $(CXX) in both examples/sysc/Makefile.rules and examples/tlm/build-unix/Makefile.rules. I'll queue up this change for a future release of the proof-of-concept simulator.

 

Thanks for reporting,

  Philipp

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...