Most of the nested makefile.staf files use
LIBS = STAF
LIBS = $(LIB_STAF)
Every attempt at linking fails because it sets -lSTAF when the name is realy libSTAF or libSTAF.so
We build STAF every day for all supported platforms using the make files that are checked into CVS (and provided in the STAFxxx-src.zip/tar files), so I'm not sure what the problem is that you're experiencing. What are the exact steps that you are using to build STAF?
Note, unless you are doing very specific things when building on unix, you don't want to put the prefix or suffix. It is the compilers/linkers responsibility to figure out the appropriate prefixes/suffixes.
The steps are
export PROJECTS='staf conprov_tcp'
I had to change all occurances of
LIBS = STAF
LIBS = $(LIB_STAF)
Unfortunately this isn't Unix, its a Posix environment running under Nonstop Kernel.
If I don't set a lib prefix or suffix then both the main executable
and the staf lib end up being named STAF and the the OS loader resolves
the libnme STAF in the liblist to the main exeecutable named STAF and fails the process creation
Could you post the contents of your build/makefile.nsk and build/makefile.cpp
Did you create a build/makefile.nsk file in the source tree? What are its contents?
Are you setting the OS_SHARED_LIB_PREFIX and OS_SHARED_LIB_SUFFIX variables in your makefile.nsk file? You probably shouldn't be as the defaults are lib for the prefix and dll for the suffix as set in the master makefile.
When the env vars DLL/LIB_STAF/LIB_STAF_FP are created via
DLL = $(OS_SHARED_LIB_PREFIX)Name$(OS_SHARED_LIB_SUFFIX)
LIB_STAF = $(subst Name,STAF,$(DLL))
LIB_STAF_FP = $(REL)/lib/$(LIB_STAF)
if the prefix and suffix are empty
LIBS = STAF is equivalent to LIBS = $(LIB_STAF)
Using $(LIB_STAF) everywhere enables the ability to set a name prefix/suffix
on a platform where the explicit name is required.
In your build/makefile.nsk, why are you setting OS_SHARED_LIB_PREFIX and OS_SHARED_LIB_SUFFIX ? The STAF master makefile already defaults them to lib and .so, respectively.
In your build/makefile.cpp file:
- Why did you comment out how CC_SHAREDLIBNAMEFLAGS should be set and provide your own setting?
- Why did you comment out the line after comment "We must link with a shread library via the corresponding definition side-deck" and why did you comment out the last line that assigns MOVE_SIDE_DECK ?
Your attached makefiles seem largely ok. The only thing that I noticed is that in makefile.nsk you set OS_SHARED_LIB_PREFIX to the empty string. Yet, in makefile.cpp in the definition of CC_SHAREDLIBNAMEFLAGS you have the prefix set to "lib". They should be the same.
I'm still a bit at a loss as to why you would need to specify -llibSTAF.so instead of just -lSTAF, as the compiler/linker should be doing the proper conversion for you (as welll as searching all -L directories). Perhaps go into the master makefile and in the definition of LINK_IT and SHARED_LIB_IT, remove the "@" in front of the @$(CC_LINK_IT) and @$(CC_SHARED_LIB_IT) lines. That should dump out the actual commands getting sent to the compiler/linker which may shed some light on things.
And lastly, can you provide a link to some online documentation about the compiler and OS you are using. I'm not very familar with NSK and don't have a clue if it's "cpp" is based of some other existing compiler, or if it's something specifically designed for NSK.
>In your build/makefile.cpp file:
>- Why did you comment out how CC_SHAREDLIBNAMEFLAGS should be set and
>provide your own setting?
I put it back to
CC_SHAREDLIBNAMEFLAGS = -DSTAF_SHARED_LIB_PREFIX=$(OS_SHARED_LIB_PREFIX) \
>- Why did you comment out the line after comment "We must link with a
> shared library via the corresponding definition side-deck" and why did you
> comment out the last line that assigns MOVE_SIDE_DECK ?
I dont remember commenting it out but if its un-commented I get
#We must link with a shared library via the corresponding definition side-deck.
ALL_LIB_LIST = $(foreach lib, $(ALL_LIB_LIST_RAW),$(REL)/lib/$(OS_SHARED_LIB_PREFIX)$(lib).x)
*** Linking shared library STAF.so ***
c89: error: Invalid input file extension"/home/jshepherd/STAF333/rel/nsk/staf/re
c89: error: Invalid input file extension"rld.x".
Could you respond to the comments made by crnkin_wok on 2009-11-04 13:27? Thanks.
Leaving the prefix/suffix alone does work ok.
If you want the prefix/suffix to be something else you are hosed because of the
dependence on the linker expanding the short form of the name.