adias Posted August 20, 2017 Report Share Posted August 20, 2017 Hi all, This is my first SystemC/SystemC-AMS code, so please ignore any bad coding that might exist. I wanted to design a PLL just to test SystemC-AMS. The code is available at: https://github.com/americodias/systemc-ams_pll It is working, but I had to change the signals UP and DN from sc_signal<bool> to sc_signal<unsigned char>. If I use bool I get the following linking problem: Undefined symbols for architecture x86_64: "sca_tdf::sca_de::sca_in<bool>::bind(sc_core::sc_port_b<sc_core::sc_signal_in_if<bool> >&)", referenced from: vtable for sca_tdf::sc_in<bool> in main.cpp.o "sca_tdf::sca_de::sca_in<bool>::trace(sc_core::sc_trace_file*) const", referenced from: vtable for sca_tdf::sc_in<bool> in main.cpp.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) Using "sc_bit" also fix the problem, but this type is deprecated. I am using SystemC 2.3.1 and SystemC-AMS 2.1. Thanks in advance. PS: The issue seems to be on the chargepump ams module when I use "sca_tdf::sc_in<bool>" do declare UP and DN. Américo Quote Link to comment Share on other sites More sharing options...
karsten Posted August 29, 2017 Report Share Posted August 29, 2017 I can't reproduce the issue - the example compiles and runs under Linux 64Bit with the gcc 4.9.2 The example works also after I changed the port types and the signals to bool. Do you removed all object files before recompiling (call make clean) - may the make file of the example works not properly, it does not recompile the main function after changing the header Best regards Karsten Quote Link to comment Share on other sites More sharing options...
Philipp A Hartmann Posted September 1, 2017 Report Share Posted September 1, 2017 My crystal ball guess would be the linker ordering between -lsystemc and -lsystemc-ams. Please make sure to put -lsystemc right of -lsystemc-ams in your linker command. Can you share the build setup, especially the final linker command line? /Philipp Quote Link to comment Share on other sites More sharing options...
adias Posted September 1, 2017 Author Report Share Posted September 1, 2017 Hi! Thank you for your answers. @karsten The default g++ version on Mac OS is the 4.2.1. I tried to install g++ 4.9.2 using brew, but I've got a lot of warnings when compiling and I ended up with more problems than before. @Philipp A Hartmann That was one of the first things I've tried. But independently of the the order I get the same error: adias-desktop:PLL adias$ make c++ -Wno-deprecated -std=c++11 -I/usr/local/Cellar/systemc-ams/2.1/include -I/usr/local/Cellar/systemc/2.3.1/include -fpermissive -O3 -c chargepump.cpp -o chargepump.cpp.o c++ -Wno-deprecated -std=c++11 -I/usr/local/Cellar/systemc-ams/2.1/include -I/usr/local/Cellar/systemc/2.3.1/include -fpermissive -O3 -c divider.cpp -o divider.cpp.o c++ -Wno-deprecated -std=c++11 -I/usr/local/Cellar/systemc-ams/2.1/include -I/usr/local/Cellar/systemc/2.3.1/include -fpermissive -O3 -c main.cpp -o main.cpp.o c++ -Wno-deprecated -std=c++11 -I/usr/local/Cellar/systemc-ams/2.1/include -I/usr/local/Cellar/systemc/2.3.1/include -fpermissive -O3 -c pfdetector.cpp -o pfdetector.cpp.o c++ -Wno-deprecated -std=c++11 -I/usr/local/Cellar/systemc-ams/2.1/include -I/usr/local/Cellar/systemc/2.3.1/include -fpermissive -O3 -c vcoscillator.cpp -o vcoscillator.cpp.o c++ ./chargepump.cpp.o ./divider.cpp.o ./main.cpp.o ./pfdetector.cpp.o ./vcoscillator.cpp.o -L/usr/local/Cellar/systemc/2.3.1/lib -lsystemc -L/usr/local/Cellar/systemc-ams/2.1/lib-macosx64 -lsystemc-ams -o pll Undefined symbols for architecture x86_64: "sca_tdf::sca_de::sca_in<bool>::bind(sc_core::sc_port_b<sc_core::sc_signal_in_if<bool> >&)", referenced from: vtable for sca_tdf::sc_in<bool> in main.cpp.o "sca_tdf::sca_de::sca_in<bool>::trace(sc_core::sc_trace_file*) const", referenced from: vtable for sca_tdf::sc_in<bool> in main.cpp.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [pll] Error 1 Thanks, Américo Quote Link to comment Share on other sites More sharing options...
ralph.goergen Posted September 4, 2017 Report Share Posted September 4, 2017 Hi. The line you posted shows the wrong order of libs. They should be in opposite order of their dependencies, i.e. first systemc-ams the systemc. The same should be done for the object files. Some compilers expect the correct order for them as well. And are you sure that you compiled both libs (systemc and systemc-ams) with the same compiler and settings? Are you sure that there are no remainders of the gcc4.9 experiments in the libs? Regards Ralph Quote Link to comment Share on other sites More sharing options...
adias Posted September 21, 2017 Author Report Share Posted September 21, 2017 Hi Ralph, Believe me, I have tried all the possible combinations with the same result. :) Regarding the libraries, I have installed the systemc using homebrew package manager and then I compiled systemc-ams using the standard macOS compiler (4.2.1 from Xcode). Regards, Américo PS: I guess the fix for this will be to use a linux virtual machine. :) PS2: The exact same code compiles without errors or warnings in Ubuntu 17.04. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.