Jump to content

Pthread error


Recommended Posts

Hi

I'm writing a program with platform to simulate ARM core,

when I compile under Linux32, I have some error

[root@localhost platform_cpp]# make VERBOSE=1 -f $IMPERAS_HOME/ImperasLib/source/buildutils/Makefile.TLM.platform OBJECT=simple

# Linking platform.Linux32.exe

g++ -o platform.Linux32.exe Build/Linux32/usr/platform.o -L/root/Desktop/OVP/Imperas.20120906/bin/Linux32 -lRuntimeLoader /root/Desktop/systemc-2.3.0/lib-linux/libsystemc.a -m32 Build/Linux32/tlm/tlmSupport.a

/root/Desktop/systemc-2.3.0/lib-linux/libsystemc.a(sc_prim_channel.o): In function `sc_core::sc_host_mutex::trylock()':

sc_prim_channel.cpp:(.text._ZN7sc_core13sc_host_mutex7trylockEv[sc_core::sc_host_mutex::trylock()]+0x1c): undefined reference to `pthread_mutex_trylock'

collect2: ld return 1

make: *** [platform.Linux32.exe] Error 1

and I check my configure

checking for the pthreads library -lpthreads... no

checking whether pthreads work without any flags... no

checking whether pthreads work with -Kthread... no

checking whether pthreads work with -kthread... no

checking for the pthreads library -llthread... no

checking whether pthreads work with -pthread... yes

is it correct that I don't have pthread library?

I really don't know why it show undefined reference to `pthread_mutex_trylock'

Thx!

Link to comment
Share on other sites

[root@localhost platform_cpp]# make VERBOSE=1 -f $IMPERAS_HOME/ImperasLib/source/buildutils/Makefile.TLM.platform OBJECT=simple

First note: You should not run your simulations as the root user.

# Linking platform.Linux32.exe

g++ -o platform.Linux32.exe Build/Linux32/usr/platform.o -L/root/Desktop/OVP/Imperas.20120906/bin/Linux32 -lRuntimeLoader /root/Desktop/systemc-2.3.0/lib-linux/libsystemc.a -m32 Build/Linux32/tlm/tlmSupport.a

[...]

I really don't know why it show undefined reference to `pthread_mutex_trylock'

If you want to link statically against SystemC (libsystemc.a), you need to add "-pthread" to your compiler and linker flags (on Linux). This dependency is caused by the "async_request_update" feature in SystemC 2.3.0. Alternatively, you can add "--disable-async-updates" to your SystemC configure options, if you don't need this functionality.

Greetings from Oldenburg,

Philipp

Link to comment
Share on other sites

  • 6 months later...

Hi,

 

I have same problem. I set SYSTEMC_CXX_FLAGS with export SYSTEMC_CXX_FLAGS=-pthread. After that I tried to compile it again and I got the same error.

I don't know what I should do. Can you help me, please?

By the way how can I add "--disable-async-updates" to my SystemC configure options.

 

 

Thank you in advance.

Link to comment
Share on other sites

Mehmet,

 

I have same problem. I set SYSTEMC_CXX_FLAGS with export SYSTEMC_CXX_FLAGS=-pthread. After that I tried to compile it again and I got the same error.

 

"SYSTEMC_CXX_FLAGS" is a variable used in your local build scripts/Makefiles?
Can you post the resulting compiler/linker calls?

 

By the way how can I add "--disable-async-updates" to my SystemC configure options.

 

When building the SystemC library, you need to run the configure script first.  When invoking this script, you can pass several options to it.  One of these options is "--disable-async-updates".  See INSTALL file in the SystemC package for more information.

 

Greetings from Oldenburg,

  Philipp

Link to comment
Share on other sites

Hi Philipp,

 

I thank you a lot for your quickly answer.

 

I configured my SystemC configure options by invoking ../configure --disable-async-updates --prefix=/usr/local/systemc-2.3.0.

Now I don't have linking problems anymore.

 

 

Actually I don't need the pthread functionality. But for the case I need it: Do I only have to write SYSTEMC_CXX_FLAGS=-pthread in my Makefile?

 

Here are the error message I got before I disabled the "async_request_update" feature:

 

make  -f $IMPERAS_HOME/ImperasLib/source/buildutils/Makefile.TLM.platform Platform= PLATFORM=OVPsim_microblaze_tlm2.0

g++ -o platform.Linux32.exe Build/Linux32/usr/local/platform.o -L/Imperas.20130315/bin/Linux32 -lRuntimeLoader /usr/local/systemc-2.3.0/lib-linux/libsystemc.a -m32 Build/Linux32/tlm/tlmSupport.a
/usr/local/systemc-2.3.0/lib-linux/libsystemc.a(sc_prim_channel.o): In function `sc_core::sc_host_mutex::trylock()':
sc_prim_channel.cpp:(.text._ZN7sc_core13sc_host_mutex7trylockEv[sc_core::sc_host_mutex::trylock()]+0x1c): undefined reference to `pthread_mutex_trylock'
collect2: ld return 1
make: *** [platform.Linux32.exe] Error 1

 

 

Thank you once again.

 

Greetings from Bochum

Mehmet

Link to comment
Share on other sites

Actually I don't need the pthread functionality. But for the case I need it: Do I only have to write SYSTEMC_CXX_FLAGS=-pthread in my Makefile?

 

I don't know the details of the OVP build system.  You should probably consult the documentation provided by Imperas on how to add additional compiler and linker flags to the build.  Why don't you just check what happens to the g++ call if you set the SYSTEMC_CXX_FLAGS variable?

 

/Philipp

Link to comment
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...