Boost logo

Boost Users :

Subject: Re: [Boost-users] Many undefined references for libboost_filesystem
From: Alex Perry (Alex.Perry_at_[hidden])
Date: 2017-10-17 09:31:13



On 17 October 2017 08:38
Mahmood N [mailto:nt_mahmood_at_[hidden]] wrote:


>$(OBJDIR(/%.cpp.o : $(SRCDIR)%.cpp $(C_DEPS)
>       $(VERBOSE)$(CXX) $(CXXFLAGS) -o $@ -c $<

Whilst this isn't really anything to do with boost per se I feel your pain having inherited various "clever" makefile solutions in my career.

That looks like the compile line (ie building the .o files) rather than the link line - however having $(VERBOSE) in front looks promising

I imagine that is set to @ which is an "echo off" style feature in make - ie only outputs the output of the command to stdout and not the actual invocation.

If you switch that off you can probably get make to output the actual commands it is using - then you can see what exactly is happening rather than having to guess.

How $(VERBOSE) gets set will be specific to that particular makefile / nest of makefiles - possibly there is some command line parameter checked when you call them which sets this for you (DEBUG=ON used to be a common convention).

If you can't determine that then try forcing VERBOSE to be blank or if all else fails edit the makefile to remove $(VERBOSE) from the calling of the linker (which is probably done using $(CXX) without the -o flag)


One other thing that can help with debugging makefiles is add a debug target

.PHONY: debug
# to debug variables
# copy this to a makefile and use via command line
# make V="CFLAGS ANOVAR" debug
debug:
        $(foreach v,$(V), \
          $(warning $v = $($v)))


Which is just adding a target "debug" to make which outputs the make variables you pass in by V

make V="VERBOSE BOOST_LIB" debug

So you are telling make to build target "debug" and that will simply output the name and value of the variables you have passed.

There are limitations to this technique since some variables in make can alter their values depending on stage of processing (basically the difference between A := VALUE and A = VALUE in a makefile) but sometimes it saves a lot of time and head scratching.

HTH
Alex


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net