You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sander@witte:~/git/newspost$ make
make main CFLAGS="-O2 -Wall" LIBS="-lpthread"
make[1]: Entering directory '/home/sander/git/newspost'
cd base ; make CC="gcc" CFLAGS="-O2 -Wall"
make[2]: Entering directory '/home/sander/git/newspost/base'
gcc -O2 -Wall -o test test.c
./test
rm -f test test.o
gcc -O2 -Wall -c -o encode.o encode.c
gcc -O2 -Wall -c -o nntp.o nntp.c
gcc -O2 -Wall -c -o newspost.o newspost.c
gcc -O2 -Wall -c -o socket.o socket.c
gcc -O2 -Wall -c -o queue.o queue.c
gcc -O2 -Wall -c -o utils.o utils.c
make[2]: Leaving directory '/home/sander/git/newspost/base'
cd ui ; make CC="gcc" CFLAGS="-O2 -Wall"
make[2]: Entering directory '/home/sander/git/newspost/ui'
gcc -O2 -Wall -c -o main.o main.c
main.c: In function ‘main’:
main.c:166:5: warning: ignoring return value of ‘system’, declared with attribute warn_unused_result [-Wunused-result]
system(command->data);
^~~~~~~~~~~~~~~~~~~~~
main.c:187:7: warning: ignoring return value of ‘system’, declared with attribute warn_unused_result [-Wunused-result]
system(command->data);
^~~~~~~~~~~~~~~~~~~~~
main.c:230:4: warning: ignoring return value of ‘system’, declared with attribute warn_unused_result [-Wunused-result]
system(command->data);
^~~~~~~~~~~~~~~~~~~~~
main.c: In function ‘signal_handler’:
main.c:304:4: warning: ignoring return value of ‘system’, declared with attribute warn_unused_result [-Wunused-result]
system(command->data);
^~~~~~~~~~~~~~~~~~~~~
gcc -O2 -Wall -c -o options.o options.c
gcc -O2 -Wall -c -o ui.o ui.c
make[2]: Leaving directory '/home/sander/git/newspost/ui'
cd enc ; make CC="gcc" CFLAGS="-O2 -Wall"
make[2]: Entering directory '/home/sander/git/newspost/enc'
gcc -O2 -Wall -c -o uuencode.o uuencode.c
gcc -O2 -Wall -c -o yencode.o yencode.c
make[2]: Leaving directory '/home/sander/git/newspost/enc'
cd cksfv ; make CC="gcc" CFLAGS="-O2 -Wall"
make[2]: Entering directory '/home/sander/git/newspost/cksfv'
gcc -O2 -Wall -c -o crc32.o crc32.c
gcc -O2 -Wall -c -o newsfv.o newsfv.c
make[2]: Leaving directory '/home/sander/git/newspost/cksfv'
cd parchive ; make CC="gcc" CFLAGS="-O2 -Wall"
make[2]: Entering directory '/home/sander/git/newspost/parchive'
gcc -O2 -Wall -c -o makepar.o makepar.c
gcc -O2 -Wall -c -o rwpar.o rwpar.c
gcc -O2 -Wall -c -o rs.o rs.c
gcc -O2 -Wall -c -o md5.o md5.c
gcc -O2 -Wall -c -o fileops.o fileops.c
gcc -O2 -Wall -c -o backend.o backend.c
make[2]: Leaving directory '/home/sander/git/newspost/parchive'
gcc -o newspost -lpthread base/*.o ui/*.o enc/*.o cksfv/*.o \
parchive/*.o
/usr/bin/ld: base/newspost.o: in function `poster_thread':
newspost.c:(.text+0x5f): undefined reference to `pthread_rwlock_wrlock'
/usr/bin/ld: newspost.c:(.text+0x6f): undefined reference to `pthread_rwlock_unlock'
/usr/bin/ld: newspost.c:(.text+0x14b): undefined reference to `pthread_rwlock_wrlock'
/usr/bin/ld: newspost.c:(.text+0x15b): undefined reference to `pthread_rwlock_unlock'
/usr/bin/ld: newspost.c:(.text+0x2de): undefined reference to `pthread_rwlock_wrlock'
/usr/bin/ld: newspost.c:(.text+0x309): undefined reference to `pthread_rwlock_unlock'
/usr/bin/ld: newspost.c:(.text+0x3c0): undefined reference to `pthread_rwlock_wrlock'
/usr/bin/ld: newspost.c:(.text+0x3d0): undefined reference to `pthread_rwlock_unlock'
/usr/bin/ld: base/newspost.o: in function `newspost':
newspost.c:(.text+0x7cb): undefined reference to `pthread_rwlock_init'
/usr/bin/ld: newspost.c:(.text+0x7f9): undefined reference to `pthread_create'
/usr/bin/ld: newspost.c:(.text+0x9c8): undefined reference to `pthread_rwlock_unlock'
/usr/bin/ld: newspost.c:(.text+0x9d8): undefined reference to `pthread_join'
/usr/bin/ld: newspost.c:(.text+0x9e6): undefined reference to `pthread_rwlock_rdlock'
/usr/bin/ld: newspost.c:(.text+0x9f7): undefined reference to `pthread_cancel'
/usr/bin/ld: newspost.c:(.text+0xa2d): undefined reference to `pthread_rwlock_destroy'
/usr/bin/ld: newspost.c:(.text+0xaab): undefined reference to `pthread_rwlock_init'
/usr/bin/ld: newspost.c:(.text+0xbf3): undefined reference to `pthread_rwlock_destroy'
/usr/bin/ld: base/nntp.o: in function `nntp_post':
nntp.c:(.text+0x4d4): undefined reference to `pthread_rwlock_wrlock'
/usr/bin/ld: nntp.c:(.text+0x4e1): undefined reference to `pthread_rwlock_unlock'
/usr/bin/ld: nntp.c:(.text+0x539): undefined reference to `pthread_rwlock_wrlock'
/usr/bin/ld: nntp.c:(.text+0x542): undefined reference to `pthread_rwlock_unlock'
/usr/bin/ld: base/utils.o: in function `file_entry_free':
utils.c:(.text+0x338): undefined reference to `pthread_rwlock_destroy'
/usr/bin/ld: ui/options.o: in function `parse_input_files':
options.c:(.text+0x146): undefined reference to `pthread_rwlock_init'
/usr/bin/ld: ui/ui.o: in function `ui_post_start':
ui.c:(.text+0x6c4): undefined reference to `pthread_rwlock_init'
/usr/bin/ld: ui/ui.o: in function `ui_chunk_posted':
ui.c:(.text+0x1188): undefined reference to `pthread_rwlock_wrlock'
/usr/bin/ld: ui.c:(.text+0x11a2): undefined reference to `pthread_rwlock_unlock'
/usr/bin/ld: ui/ui.o: in function `ui_posting_part_done':
ui.c:(.text+0x1215): undefined reference to `pthread_rwlock_wrlock'
/usr/bin/ld: ui.c:(.text+0x1228): undefined reference to `pthread_rwlock_unlock'
/usr/bin/ld: ui/ui.o: in function `ui_post_done':
ui.c:(.text+0x13d4): undefined reference to `pthread_rwlock_destroy'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:33: main] Error 1
make[1]: Leaving directory '/home/sander/git/newspost'
make: *** [Makefile:43: opt] Error 2
sander@witte:~/git/newspost$
So:
sander@witte:~/git/newspost$ gcc -o newspost -lpthread base/*.o ui/*.o enc/*.o cksfv/*.o parchive/*.o
/usr/bin/ld: base/newspost.o: in function `poster_thread':
newspost.c:(.text+0x5f): undefined reference to `pthread_rwlock_wrlock'
/usr/bin/ld: newspost.c:(.text+0x6f): undefined reference to `pthread_rwlock_unlock'
/usr/bin/ld: newspost.c:(.text+0x14b): undefined reference to `pthread_rwlock_wrlock'
/usr/bin/ld: newspost.c:(.text+0x15b): undefined reference to `pthread_rwlock_unlock'
/usr/bin/ld: newspost.c:(.text+0x2de): undefined reference to `pthread_rwlock_wrlock'
/usr/bin/ld: newspost.c:(.text+0x309): undefined reference to `pthread_rwlock_unlock'
/usr/bin/ld: newspost.c:(.text+0x3c0): undefined reference to `pthread_rwlock_wrlock'
/usr/bin/ld: newspost.c:(.text+0x3d0): undefined reference to `pthread_rwlock_unlock'
/usr/bin/ld: base/newspost.o: in function `newspost':
newspost.c:(.text+0x7cb): undefined reference to `pthread_rwlock_init'
/usr/bin/ld: newspost.c:(.text+0x7f9): undefined reference to `pthread_create'
/usr/bin/ld: newspost.c:(.text+0x9c8): undefined reference to `pthread_rwlock_unlock'
/usr/bin/ld: newspost.c:(.text+0x9d8): undefined reference to `pthread_join'
/usr/bin/ld: newspost.c:(.text+0x9e6): undefined reference to `pthread_rwlock_rdlock'
/usr/bin/ld: newspost.c:(.text+0x9f7): undefined reference to `pthread_cancel'
/usr/bin/ld: newspost.c:(.text+0xa2d): undefined reference to `pthread_rwlock_destroy'
/usr/bin/ld: newspost.c:(.text+0xaab): undefined reference to `pthread_rwlock_init'
/usr/bin/ld: newspost.c:(.text+0xbf3): undefined reference to `pthread_rwlock_destroy'
/usr/bin/ld: base/nntp.o: in function `nntp_post':
nntp.c:(.text+0x4d4): undefined reference to `pthread_rwlock_wrlock'
/usr/bin/ld: nntp.c:(.text+0x4e1): undefined reference to `pthread_rwlock_unlock'
/usr/bin/ld: nntp.c:(.text+0x539): undefined reference to `pthread_rwlock_wrlock'
/usr/bin/ld: nntp.c:(.text+0x542): undefined reference to `pthread_rwlock_unlock'
/usr/bin/ld: base/utils.o: in function `file_entry_free':
utils.c:(.text+0x338): undefined reference to `pthread_rwlock_destroy'
/usr/bin/ld: ui/options.o: in function `parse_input_files':
options.c:(.text+0x146): undefined reference to `pthread_rwlock_init'
/usr/bin/ld: ui/ui.o: in function `ui_post_start':
ui.c:(.text+0x6c4): undefined reference to `pthread_rwlock_init'
/usr/bin/ld: ui/ui.o: in function `ui_chunk_posted':
ui.c:(.text+0x1188): undefined reference to `pthread_rwlock_wrlock'
/usr/bin/ld: ui.c:(.text+0x11a2): undefined reference to `pthread_rwlock_unlock'
/usr/bin/ld: ui/ui.o: in function `ui_posting_part_done':
ui.c:(.text+0x1215): undefined reference to `pthread_rwlock_wrlock'
/usr/bin/ld: ui.c:(.text+0x1228): undefined reference to `pthread_rwlock_unlock'
/usr/bin/ld: ui/ui.o: in function `ui_post_done':
ui.c:(.text+0x13d4): undefined reference to `pthread_rwlock_destroy'
collect2: error: ld returned 1 exit status
sander@witte:~/git/newspost$
sander@witte:~/git/newspost$
ander@witte:~/git/newspost$ ./newspost
Newspost version 2.2.1
Copyright (C) 2001 - 2010 Jim Faulkner
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Usage: newspost [OPTIONS [ARGUMENTS]] file1 file2 file3...
Options:
--host -i <string> - hostname or IP of the news server
--port -z <int> - port number on the news server
--user -u <string> - username on the news server
--password -p <string> - password on the news server
--threads -N <int> - amount of threads to use for posting
-pthread tells the compiler to link in the pthread library as well as configure the compilation for threads.
For example, the following shows the macros that get defined when the -pthread option gets used on the GCC package installed on my Ubuntu machine:
Using the -lpthread option only causes the pthread library to be linked - the pre-defined macros don't get defined.
Bottom line: you should use the -pthread option.
Note: the -pthread option is documented as a platform specific option in the GCC docs, so it might not always be available. However, it is available on platforms that the GCC docs don't explicitly list it for (such as i386 and x86-64) - you should use it when available.
Also note that other similar options have been used by GCC, such as -pthreads (listed as a synonym for -pthread on Solaris 2) and -mthread (for MinGW-specific thread support on i386 and x86-64 Windows). My understanding is that GCC is trying to move to using -pthread uniformly going forward.
TLDR:
sed -i 's/lpthread/pthread/g' Makefile
Long
Problems make-ing on Ubuntu Linux:
So:
Let's try with
-pthread
instad of-lpthread
:Hey ... that works?!
So:
Let's try again:
and try again:
Done!!!
The text was updated successfully, but these errors were encountered: