Requires pthread linker but is not present in Makefile [w/ fix]

Bug #1079218 reported by Bryan Paddock
80
This bug affects 14 people
Affects Status Importance Assigned to Milestone
ttyMIDI
Fix Released
Undecided
Unassigned

Bug Description

Simple problem but people who don't know better may not be able to fix it so easily.

Seems you're using pthreads but the Makefile doesn't contain the -lpthreads

After doing a make on a download/untar I got this:

gcc src/ttymidi.c -o ttymidi -lasound
/usr/bin/ld: /tmp/cc1Eaxfg.o: undefined reference to symbol 'pthread_create@@GLIBC_2.1'
/usr/bin/ld: note: 'pthread_create@@GLIBC_2.1' is defined in DSO /usr/lib/libpthread.so.0 so try adding it to the linker command line
/usr/lib/libpthread.so.0: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
make: *** [all] Error 1

Simply added "-lpthread" to Makefile fixed it.

--- Makefile 2012-02-01 21:56:20.000000000 +0200
+++ fixed/Makefile 2012-11-15 16:27:32.000000000 +0200
@@ -1,5 +1,5 @@
 all:
- gcc src/ttymidi.c -o ttymidi -lasound
+ gcc src/ttymidi.c -o ttymidi -lasound -lpthread
 clean:
  rm ttymidi
 install:

Revision history for this message
Johannes Keyser (johanneskeyser) wrote :

Thanks a lot Bryan, I was one of those that don't know better, and it took me some time to figure this out!

Revision history for this message
Craig Barnes (cjbarnes18) wrote :

Is this project still being maintained here?

Revision history for this message
Peter van de Pol (peter-rozenbottels) wrote :

Question is: how do I do this? I am not a programmer... Any help appreciated.

Revision history for this message
Brian Fay (ovaltinevortex) wrote :

Peter, open the file called "Makefile" in a text editor.

There is a line that says:
gcc src/ttymidi.c -o ttymidi -lasound

Change it to:
gcc src/ttymidi.c -o ttymidi -lasound -lpthread

Then try running "make" again (I think that part is in the instructions?)

Revision history for this message
Stemby (carlo-stemberger) wrote :

Thank you for the tip!

Changed in ttymidi:
status: New → Confirmed
Changed in ttymidi:
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.