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

Bug #1079218 reported by Bryan Paddock on 2012-11-15
46
This bug affects 8 people
Affects Status Importance Assigned to Milestone
ttyMIDI
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:

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

Craig Barnes (cjbarnes18) wrote :

Is this project still being maintained here?

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

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?)

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers