Jump to content
Ronex

SystemC- 2.3.1 64-bit static library linking issue in windows

Recommended Posts

Hello,

 

    I am using systemC-2.3.1 which I think has started supporting native windows(x64) build. I have build the library of systemC using the msvc solution file in visual C++ express 2010. The library is generated under x64/Release directory and I didn't get any build error.

 

But while linking this library with my application it throws an error message as follow:

 

systemc.lib<sc_time.obj> : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'x86'.

 

I am compiling my application with visual studio command prompt.

Am I missing here something ?

Share this post


Link to post
Share on other sites

The release notes don't explicitly mention Visual C++ 2010 with 64 bit. But I expect it should work. I'd guess some option is wrong on your command line, perhaps in how you specify the linker options? Can you post the command line you use?

 

regards

Alan

Share this post


Link to post
Share on other sites

My guess would be, that you didn't configure your application project in MSVC to be built as 64-bit application.  You need to (add and) select the 'x64' platform and make sure that the settings are consistent with the SystemC library project. You can use the project files for the examples as a starting point.

 

Update: I should read the question properly.  Please forget the above answer.

 

Using the command-line requires to select the "correct" set of tools for the platform you want to use.  Have a look at the TLM examples (examples/tlm/build-msvc), which provide command-line Makefiles for MSVC as well.  Most importantly, have a look at "vsvars.bat" in this folder, which can be used to choose the correct MSVC command-line configuration.

 

You can then derive additional command-line settings from the "Makefile.config" file in the same directory.

 

/Philipp

Edited by Philipp A. Hartmann

Share this post


Link to post
Share on other sites

Hi Philipp,

 

 

Thanks for the reply.

 

Can you please look over simple example that Itried and suggest me where I am wrong:

 

Example: HelloWorld.cpp

 

#include "systemc.h"

SC_MODULE(Hello_SystemC)
{ // declare module class
    void main_thread(void)
    {
        SC_REPORT_INFO("Temp", "Hello SystemC World!");
    }

    SC_CTOR(Hello_SystemC)
    { // create a constructor
        SC_THREAD(main_thread);// register the process
    }//end constructor
};


int sc_main(int sc_argc, char* sc_argv[])
{
    //create an instance of the SystemC module
    Hello_SystemC HelloWorld_i("HelloWorld_i");

    sc_start(); // invoke the simulator
    return 0;
}

 

Command Line:

cl /FoHelloWorld.obj /c HelloWorld.cpp /TP /nologo /EHsc /GR /vmg /I<path_of_systemc-2.3.1>\src

link /nologo /OUT:helloworld.exe /LIBPATH:<path_of_systemc-2.3.1>\msvc80\SystemC\x64\Release systemc.lib HelloWorld.obj

 

Now, this gives me the same error for different systemc module: (Previously I got error w.r.t. to my other project)

systemc.lib<sc_simcontext.obj> : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'x86'

 

 

PS:

 

1) I am working on Visual C++ express 2010(windows 7 - 64 bit host) and To set 64 bit environment I have used:

CALL "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64"

 

Surprisingly using "vcvarsall.bat x64" throws following error:

The specified configuration type is missing. The tools for the configuration might not be installed.

 

So, I preferred option (1).

 

SystemC library is builded using the solution file present in the systemc-2.3.1 source zip file downloaded from official site.

And while building the library In the configuration manager, I have changed the platform to 'x64'.

Share this post


Link to post
Share on other sites

Command Line:

cl /FoHelloWorld.obj /c HelloWorld.cpp /TP /nologo /EHsc /GR /vmg /I<path_of_systemc-2.3.1>\src

link /nologo /OUT:helloworld.exe /LIBPATH:<path_of_systemc-2.3.1>\msvc80\SystemC\x64\Release systemc.lib HelloWorld.obj

 

Now, this gives me the same error for different systemc module: (Previously I got error w.r.t. to my other project)

systemc.lib<sc_simcontext.obj> : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'x86'

 

You still have not configured the correct target machine type for your application. Add '/MACHINE:X64' to your linker command-line.

 

hth,

  Philipp

Share this post


Link to post
Share on other sites
1) I am working on Visual C++ express 2010(windows 7 - 64 bit host) and To set 64 bit environment I have used:

CALL "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64"

 

Surprisingly using "vcvarsall.bat x64" throws following error:

The specified configuration type is missing. The tools for the configuration might not be installed.

 

The correct name of the configuration type for 64-bit differs between the MSVC toolchain versions/variants.

Try one of 'amd64' or 'x86_amd64'. See READMEcommandlinemsvc.txt in examples/tlm/build-msvc.

 

/Philipp

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×