I am confused. Is the fw_init definition (not just an extern declaration) in 
the source you compile in (A.c or disk_image.cc)? If so, why do you need the 
library?

The "-v" has to go at the end. You don't want to know the version of scons, but 
tell it to be verbose :-)

Andreas

From: Hasan Ijaz <[email protected]<mailto:[email protected]>>
Reply-To: Hasan Ijaz <[email protected]<mailto:[email protected]>>, 
gem5 users mailing list <[email protected]<mailto:[email protected]>>
Date: Wednesday, 17 April 2013 08:59
To: "[email protected]<mailto:[email protected]>" 
<[email protected]<mailto:[email protected]>>
Subject: Re: [gem5-users] Error while Linking static Library with GEM5


Hi,

I figured something out. Here is the scenario. In the 
gem5-stable/dev/Sconscript file I have these two files:

Source('A.c')
Source('disk_image.cc')

Consider the function fw_inti(). If i place my function fw_init() in the A.c 
file it compiles and links successfully. However if I put it in the 
disk_image.cc file it does not.

And if I remove the line

main.Append(LIBS = ['fw']) in the SConstruct file

the function stops being linked in both the files. Which means that scons is 
taking the right library path and is linking the function fw_init() when it is 
placed in the A.c file. However it is unable to link when the function is in 
the .cc file.

Does this seem absurd? What am I missing?

Regards,
Hasan Ijaz
________________________________
From: Andreas Hansson <[email protected]<mailto:[email protected]>>
To: Hasan Ijaz <[email protected]<mailto:[email protected]>>; gem5 
users mailing list <[email protected]<mailto:[email protected]>>
Sent: Wednesday, April 17, 2013 5:04 PM
Subject: Re: [gem5-users] Error while Linking static Library with GEM5

Hi Hasan,

What you have done looks absolutely right, with the exception that you should 
not inlude "lib" in the library name. Thus, LIBS = ['fw']. You can always run 
scons with "-v" and have a look at the linking command line to ensure it is 
correct.

Good luck.

Andreas

From: Hasan Ijaz <[email protected]<mailto:[email protected]>>
Reply-To: Hasan Ijaz <[email protected]<mailto:[email protected]>>, 
gem5 users mailing list <[email protected]<mailto:[email protected]>>
Date: Wednesday, 17 April 2013 06:54
To: "[email protected]<mailto:[email protected]>" 
<[email protected]<mailto:[email protected]>>
Subject: [gem5-users] Error while Linking static Library with GEM5

Hi,

        I am trying to compile a software framework with GEM5. I have compiled 
my code into a static library using make. After that I have added these lines 
to SContruct file:

# add the framework library path to the main environment
main.Append(CPPPATH = 
['/home/opensilicon/Codes/gem5-stable/src/dev/framework/include'])
main.Append(LIBPATH = ['/home/opensilicon/Codes/gem5-stable/src/dev'])
main.Append(LIBS = ['libfw'])

    I am calling functions from the library in the Disk_Image.cc file. It 
compiles successfully but during Linking I get the following error:

In function `SsdDiskImage':
/home/opensilicon/Codes/gem5-stable/build/X86/dev/disk_image.cc:63: undefined 
reference to `fw_init(unsigned char)'

Although this function compiles suceessfully and is in the lib. What am I 
missing?

Regards,
Hasan Ijaz

-- IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.





-- IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.
_______________________________________________
gem5-users mailing list
[email protected]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users

Reply via email to