Skip to content

Fixing linking flag -lpthread -> -pthread so linking works under Linux Mint 17.2#6

Open
Qqwy wants to merge 1 commit intofbb-git:masterfrom
Qqwy:pthread_fix
Open

Fixing linking flag -lpthread -> -pthread so linking works under Linux Mint 17.2#6
Qqwy wants to merge 1 commit intofbb-git:masterfrom
Qqwy:pthread_fix

Conversation

@Qqwy
Copy link

@Qqwy Qqwy commented Nov 29, 2016

I had problems with the compilation process. To be more exact, I encountered the following error:

$ ./build light strip
mkdir -p tmp/liba tmp/bobcat/ tmp/libso

Creating shared library libbobcat.so
g++ --std=c++14 -O2 -Wall -fdiagnostics-color=never -isystem tmp -fPIC -lpthread -shared -Wl,--as-needed,-z,defs,-soname,libbobcat.so.4 -o tmp/libso/libbobcat.so.4.04.00 */os/*.o 
process/os/60start2.o: In function `FBB::Process::start(FBB::ProcessEnums::IOMode, FBB::Process::ProcessType, unsigned long, unsigned long)':
start2.cc:(.text+0xda): undefined reference to `pthread_create'
sharedcondition/os/71condition1.o: In function `FBB::SharedCondition::Condition::Condition()':
condition1.cc:(.text+0x2f): undefined reference to `pthread_condattr_setpshared'
sharedmutex/os/73sharedmutex1.o: In function `FBB::SharedMutex::SharedMutex()':
sharedmutex1.cc:(.text+0x1d): undefined reference to `pthread_mutexattr_init'
sharedmutex1.cc:(.text+0x2a): undefined reference to `pthread_mutexattr_setpshared'
collect2: error: ld returned 1 exit status
Fatal: system - failure of system call (status 256)

After trying out some different things, I changed the -lpthread flag to -pthread. This works, at least on my architecture (Linux Mint 17.2, kernel: x86_64 Linux 3.16.0-38-generic). I expect this to work on other systems as well (But of course, please do test). See more information about the difference between the two flags here: http://stackoverflow.com/questions/23250863/difference-between-pthread-and-lpthread-while-compiling#23251828

🙂

~Wiebe-Marten

@Qqwy
Copy link
Author

Qqwy commented Nov 30, 2016

I have tried building master using the build libraries strip command as well (selecting all options except 'milter'), which went fine using this change.

As discussed by mail, I'll check the results with LDFLAGS = "". (Again, building all except milter)

@Qqwy
Copy link
Author

Qqwy commented Nov 30, 2016

All right. With LDFLAGS = "" it also works fine.

@fbb-git
Copy link
Owner

fbb-git commented Nov 30, 2016 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants