ld: library not found for -lcrt0.o

I am trying to compile a program package for my computer called DSSP. It requires the boost library. I have boost on my computer and it should be working fine. When I type make I get the following errors.

1
2
3
4
5
6
7
[0] 02:20: dssp-2.0.4$make
linking mkdssp
clang: warning: argument unused during compilation: '-pthread'
ld: library not found for -lcrt0.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [mkdssp] Error 1


I have done a search around the internet and have not turned up anything. I do not know what lcrt0.o is, nor could I find useful information about it. Anyone have any ideas?
Update:

I've removed an option -pthread from the make file as well as the option which caused the library error for -lcrt0.o.

1
2
3
4
5
[0] 02:44: dssp-2.0.4$make
linking mkdssp
ld: library not found for -lboost_thread-mt
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [mkdssp] Error 1


The makefile is as follows (this is not in violation of the license agreement).

Note: I am using bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Makefile for mkdssp
#
#  Copyright Maarten L. Hekkelman, Radboud University 2008-2011.
# Distributed under the Boost Software License, Version 1.0.
#    (See accompanying file LICENSE_1_0.txt or copy at
#          http://www.boost.org/LICENSE_1_0.txt)
#
# This makefile includes a file called make.config. It will create a
# new one if it doesn't exist. In this make.config you can set site
# specific variables like the Boost library location.

firstTarget: mkdssp

include make.config

VERSION                         = 2.0.4

DEST_DIR                        ?= /usr/local/
LIB_DIR                         = $(BOOST_LIB_DIR)
INC_DIR                         = $(BOOST_INC_DIR)

MAN_DIR                         = $(DEST_DIR)man/man1/

BOOST_LIBS                      = thread regex filesystem program_options date_time iostreams math_c99 system
LIBS                            = $(BOOST_LIBS:%=boost_%$(BOOST_LIB_SUFFIX)) z bz2

DEFINES                         = USE_COMPRESSION LINUX VERSION='"$(VERSION)"'
CC                              = c++

CFLAGS                          = $(INC_DIR:%=-I%) -iquote src -g -Wall -Wno-multichar -pthread
LDOPTS                          = $(LIB_DIR:%=-L%) $(LIBS:%=-l%) -g 

OBJ_DIR                         = obj

ifeq ($(DEBUG),1)
OBJ_DIR                         := $(OBJ_DIR).dbg
CFLAGS                          += -g3
else
DEFINES                         += NDEBUG
CFLAGS                          += -O3
endif

CFLAGS                          += $(DEFINES:%=-D%)

DIST_NAME                       = dssp-$(VERSION)

VPATH += src

OBJECTS = $(OBJ_DIR)/mkdssp.o $(OBJ_DIR)/dssp.o $(OBJ_DIR)/primitives-3d.o $(OBJ_DIR)/structure.o $(OBJ_DIR)/utils.o

mkdssp: $(OBJECTS)
        @ echo linking $@
        @ $(CC) -o $@ $^ $(LDOPTS)
        @ echo OK


There is more to the makefile but it doesn't even pass this step so in order to save space I thought I'd post this and then deal with the rest of other problems arise.
I'm assuning you're using GNU Make.

Is BOOST_LIB_DIR set? What's it's value? You can check it by running:
 
make -pn | grep ^BOOST_LIB_DIR


You should be using the C++ linker, not the C linker. So the target should be:
1
2
mkdssp: $(OBJECTS)
        $(LINK.cc) -o $@ $^ $(LDOPTS)
Indented by a tab, not spaces.

CFLAGS sets C program options, CPPFLAGS sets C and C++, CXXFLAGS sets C++ only.

You're using CFLAGS, but you should be using CPPFLAGS instead. So you need to replace all instances.

It would be interesting to see the content of make.config.
Last edited on
I wanted to be a bit more descriptive so I've posted below the two changes I have made so far to the makefile and which error they eliminated.

1
2
3
4
5
6
7
[0] 14:00: dssp-2.0.4 2$make
linking mkdssp
clang: warning: argument unused during compilation: '-pthread'
ld: warning: directory not found for option '-L/usr/local/boost/libs'
ld: library not found for -lcrt0.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [mkdssp] Error 1


ORIGINAL
1
2
3
4
mkdssp: $(OBJECTS)
	@ echo linking $@
	@ $(CC) -static -o $@ $^ $(LDOPTS)
	@ echo OK


ALTERED
1
2
3
4
mkdssp: $(OBJECTS)
	@ echo linking $@
	@ $(CC) -o $@ $^ $(LDOPTS)
	@ echo OK


With the above change I now get the following error

1
2
3
4
5
[0] 14:03: dssp-2.0.4 2$make
linking mkdssp
clang: warning: argument unused during compilation: '-pthread'
ld: warning: directory not found for option '-L/usr/local/boost/libs'
OK


The above error was fixed by configuring in my .bashrc file the following settings

1
2
3
4
#Configureation for Boost                                                                                                       
export BOOST_LIB_DIR="/usr/local/boost_1_52_0/boost/libs"
export BOOST_INC_DIR="/usr/local/include/boost"
export boost="/usr/local/include/boost"


So as far as I can tell I've solved the problem. Though, I will admit I think the solution was just happened upon. In short, DSSP has quite a few little bugs to work out in order to install properly on OS X.
I wanted to be a bit more descriptive so I've posted below the two changes I have made so far to the makefile
So you've ignored my recommended changes? I've explained that the makefile is wrong and why and given you the fix.

Good luck.
I didn't ignore them, I tried to recreate my problems as I went through them so I could describe what was happened and instead of getting the same results I found one other fix and I solved the problem without needing to implement your changes.

Had I not been successful I would have used your changed and reported back.

Topic archived. No new replies allowed.