Discussion:
[Scons-users] Missing dependencies
Spencer Yost
2017-11-30 18:21:49 UTC
Permalink
I am hoping somebody has tackled this before:

While I can obviously use the depends() function to ensure my target rebuilds if the dependency changed, I would like some sort of mechanism to automatically build the dependency if it is missing.

Is there functionality in Scons for this that I am missing and or misunderstanding? If not, has someone already built a little extension to handle this already?

In my specific use case, I'm looking for a shared library that has not been built yet. This is a common enough use case that I would like to handle it automatically if possible.


Spencer Yost
Bill Deegan
2017-11-30 20:18:00 UTC
Permalink
Spencer,

That should happen automatically.
Can you post an example SConstruct to show the issue you're having?

-Bill
Post by Spencer Yost
While I can obviously use the depends() function to ensure my target
rebuilds if the dependency changed, I would like some sort of mechanism to
automatically build the dependency if it is missing.
Is there functionality in Scons for this that I am missing and or
misunderstanding? If not, has someone already built a little extension to
handle this already?
In my specific use case, I'm looking for a shared library that has not
been built yet. This is a common enough use case that I would like to
handle it automatically if possible.
Spencer Yost
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
Spencer Yost
2017-11-30 21:50:36 UTC
Permalink
Let me back up and explain so you can make sure I know what I am doing.

programdir/SConscript:
~~~~~~~~~~~~~~~~~~~

MYLIBS = ['libshared1.so', 'libshared2.so']
MYLIBPATH = 'variantDir/usr/lib'
executable=Program(hello.c,LIBS=[MYLIBS], LIBPATH=[MYLIBPATH])
for eachLib in MYLIBS:
Depends(executable, os.path.join(MYLIBPATH,eachLib)

This is stripped down obviously: I have install functions/custom builders and more. But you get the idea. And this works in terms of linking/building and does accurately reflect the need to rebuild "executable" if MYLIB changes.

But how do I get SCons to build MYLIB if it is missing? I have an SConscript for MYLIB. Your surprise that this doesn't work leads me to believe that my fear was correct: I am stuck having to read all 1700+ SConscript files in my library packages (over 2000 counting executables, automated unit tests, etc) when I start the building the executable. I can't deal with the huge delay reading that many SConscript files just in case I need to build to build one shared library in the course of building just one executable.

I was hoping something along the lines of:

for eachLib in MYLIBS:
fullSCPath=findRightSConscript(eachLib)
SConscript(fullSCPath,blah,etc,so on)
Depends(executable, os.path.join(MYLIBPATH,eachLib)


But that doesn't work

Thanks in advance!!

Spencer Yost
Post by Bill Deegan
Spencer,
That should happen automatically.
Can you post an example SConstruct to show the issue you're having?
-Bill
Post by Spencer Yost
While I can obviously use the depends() function to ensure my target rebuilds if the dependency changed, I would like some sort of mechanism to automatically build the dependency if it is missing.
Is there functionality in Scons for this that I am missing and or misunderstanding? If not, has someone already built a little extension to handle this already?
In my specific use case, I'm looking for a shared library that has not been built yet. This is a common enough use case that I would like to handle it automatically if possible.
Spencer Yost
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
Bill Deegan
2017-11-30 22:29:02 UTC
Permalink
Spencer,

Try this:
MYLIBS = ['shared1', 'shared2']
MYLIBPATH = 'variantDir/usr/lib'
executable=Program(hello.c,LIBS=[MYLIBS], LIBPATH=[MYLIBPATH])
Post by Spencer Yost
Let me back up and explain so you can make sure I know what I am doing.
~~~~~~~~~~~~~~~~~~~
MYLIBS = ['libshared1.so', 'libshared2.so']
MYLIBPATH = 'variantDir/usr/lib'
executable=Program(hello.c,LIBS=[MYLIBS], LIBPATH=[MYLIBPATH])
Depends(executable, os.path.join(MYLIBPATH,eachLib)
This is stripped down obviously: I have install functions/custom builders
and more. But you get the idea. And this works in terms of
linking/building and does accurately reflect the need to rebuild
"executable" if MYLIB changes.
But how do I get SCons to build MYLIB if it is missing? I have an
SConscript for MYLIB. Your surprise that this doesn't work leads me to
believe that my fear was correct: I am stuck having to read all 1700+
SConscript files in my library packages (over 2000 counting executables,
automated unit tests, etc) when I start the building the executable. I
can't deal with the huge delay reading that many SConscript files just in
case I need to build to build one shared library in the course of building
just one executable.
fullSCPath=findRightSConscript(eachLib)
SConscript(fullSCPath,blah,etc,so on)
Depends(executable, os.path.join(MYLIBPATH,eachLib)
But that doesn't work
Thanks in advance!!
Spencer Yost
Spencer,
That should happen automatically.
Can you post an example SConstruct to show the issue you're having?
-Bill
Post by Spencer Yost
While I can obviously use the depends() function to ensure my target
rebuilds if the dependency changed, I would like some sort of mechanism to
automatically build the dependency if it is missing.
Is there functionality in Scons for this that I am missing and or
misunderstanding? If not, has someone already built a little extension to
handle this already?
In my specific use case, I'm looking for a shared library that has not
been built yet. This is a common enough use case that I would like to
handle it automatically if possible.
Spencer Yost
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
Bill Deegan
2017-11-30 22:31:28 UTC
Permalink
Or even:

executable=Program(hello.c,LIBS=['shared1', 'shared2'], LIBPATH=[
'variantDir/usr/lib'])

Also are you using VariantDir() or SConscript('blah',variant_dir='...')

You may want to take a read through the user guide.
Here's the section on linking with Libraries..
http://scons.org/doc/production/HTML/scons-user/ch04s02.html

-Bill
Post by Bill Deegan
Spencer,
MYLIBS = ['shared1', 'shared2']
MYLIBPATH = 'variantDir/usr/lib'
executable=Program(hello.c,LIBS=[MYLIBS], LIBPATH=[MYLIBPATH])
Post by Spencer Yost
Let me back up and explain so you can make sure I know what I am doing.
~~~~~~~~~~~~~~~~~~~
MYLIBS = ['libshared1.so', 'libshared2.so']
MYLIBPATH = 'variantDir/usr/lib'
executable=Program(hello.c,LIBS=[MYLIBS], LIBPATH=[MYLIBPATH])
Depends(executable, os.path.join(MYLIBPATH,eachLib)
This is stripped down obviously: I have install functions/custom
builders and more. But you get the idea. And this works in terms of
linking/building and does accurately reflect the need to rebuild
"executable" if MYLIB changes.
But how do I get SCons to build MYLIB if it is missing? I have an
SConscript for MYLIB. Your surprise that this doesn't work leads me to
believe that my fear was correct: I am stuck having to read all 1700+
SConscript files in my library packages (over 2000 counting executables,
automated unit tests, etc) when I start the building the executable. I
can't deal with the huge delay reading that many SConscript files just in
case I need to build to build one shared library in the course of building
just one executable.
fullSCPath=findRightSConscript(eachLib)
SConscript(fullSCPath,blah,etc,so on)
Depends(executable, os.path.join(MYLIBPATH,eachLib)
But that doesn't work
Thanks in advance!!
Spencer Yost
Spencer,
That should happen automatically.
Can you post an example SConstruct to show the issue you're having?
-Bill
Post by Spencer Yost
While I can obviously use the depends() function to ensure my target
rebuilds if the dependency changed, I would like some sort of mechanism to
automatically build the dependency if it is missing.
Is there functionality in Scons for this that I am missing and or
misunderstanding? If not, has someone already built a little extension to
handle this already?
In my specific use case, I'm looking for a shared library that has not
been built yet. This is a common enough use case that I would like to
handle it automatically if possible.
Spencer Yost
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
Spencer Yost
2017-12-19 01:12:49 UTC
Permalink
Sorry for the delay in responding, but I wanted to respond back to list to let everyone know this worked. I did not appreciate that the target and dependency names have to match exactly apparently for the automatic creation to take place, even if they only differ by existence of a file suffix.

Thanks!

Spencer Yost
Post by Bill Deegan
Spencer,
MYLIBS = ['shared1', 'shared2']
MYLIBPATH = 'variantDir/usr/lib'
executable=Program(hello.c,LIBS=[MYLIBS], LIBPATH=[MYLIBPATH])
Post by Spencer Yost
Let me back up and explain so you can make sure I know what I am doing.
~~~~~~~~~~~~~~~~~~~
MYLIBS = ['libshared1.so', 'libshared2.so']
MYLIBPATH = 'variantDir/usr/lib'
executable=Program(hello.c,LIBS=[MYLIBS], LIBPATH=[MYLIBPATH])
Depends(executable, os.path.join(MYLIBPATH,eachLib)
This is stripped down obviously: I have install functions/custom builders and more. But you get the idea. And this works in terms of linking/building and does accurately reflect the need to rebuild "executable" if MYLIB changes.
But how do I get SCons to build MYLIB if it is missing? I have an SConscript for MYLIB. Your surprise that this doesn't work leads me to believe that my fear was correct: I am stuck having to read all 1700+ SConscript files in my library packages (over 2000 counting executables, automated unit tests, etc) when I start the building the executable. I can't deal with the huge delay reading that many SConscript files just in case I need to build to build one shared library in the course of building just one executable.
fullSCPath=findRightSConscript(eachLib)
SConscript(fullSCPath,blah,etc,so on)
Depends(executable, os.path.join(MYLIBPATH,eachLib)
But that doesn't work
Thanks in advance!!
Spencer Yost
Post by Bill Deegan
Spencer,
That should happen automatically.
Can you post an example SConstruct to show the issue you're having?
-Bill
Post by Spencer Yost
While I can obviously use the depends() function to ensure my target rebuilds if the dependency changed, I would like some sort of mechanism to automatically build the dependency if it is missing.
Is there functionality in Scons for this that I am missing and or misunderstanding? If not, has someone already built a little extension to handle this already?
In my specific use case, I'm looking for a shared library that has not been built yet. This is a common enough use case that I would like to handle it automatically if possible.
Spencer Yost
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
Bill Deegan
2017-12-19 02:27:35 UTC
Permalink
Post by Spencer Yost
Sorry for the delay in responding, but I wanted to respond back to list to
let everyone know this worked. I did not appreciate that the target and
dependency names have to match exactly apparently for the automatic
creation to take place, even if they only differ by existence of a file
suffix.
Can you give an example of what you mean above?
Post by Spencer Yost
Thanks!
Spencer Yost
Spencer,
MYLIBS = ['shared1', 'shared2']
MYLIBPATH = 'variantDir/usr/lib'
executable=Program(hello.c,LIBS=[MYLIBS], LIBPATH=[MYLIBPATH])
Post by Spencer Yost
Let me back up and explain so you can make sure I know what I am doing.
~~~~~~~~~~~~~~~~~~~
MYLIBS = ['libshared1.so', 'libshared2.so']
MYLIBPATH = 'variantDir/usr/lib'
executable=Program(hello.c,LIBS=[MYLIBS], LIBPATH=[MYLIBPATH])
Depends(executable, os.path.join(MYLIBPATH,eachLib)
This is stripped down obviously: I have install functions/custom
builders and more. But you get the idea. And this works in terms of
linking/building and does accurately reflect the need to rebuild
"executable" if MYLIB changes.
But how do I get SCons to build MYLIB if it is missing? I have an
SConscript for MYLIB. Your surprise that this doesn't work leads me to
believe that my fear was correct: I am stuck having to read all 1700+
SConscript files in my library packages (over 2000 counting executables,
automated unit tests, etc) when I start the building the executable. I
can't deal with the huge delay reading that many SConscript files just in
case I need to build to build one shared library in the course of building
just one executable.
fullSCPath=findRightSConscript(eachLib)
SConscript(fullSCPath,blah,etc,so on)
Depends(executable, os.path.join(MYLIBPATH,eachLib)
But that doesn't work
Thanks in advance!!
Spencer Yost
Spencer,
That should happen automatically.
Can you post an example SConstruct to show the issue you're having?
-Bill
Post by Spencer Yost
While I can obviously use the depends() function to ensure my target
rebuilds if the dependency changed, I would like some sort of mechanism to
automatically build the dependency if it is missing.
Is there functionality in Scons for this that I am missing and or
misunderstanding? If not, has someone already built a little extension to
handle this already?
In my specific use case, I'm looking for a shared library that has not
been built yet. This is a common enough use case that I would like to
handle it automatically if possible.
Spencer Yost
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
Spencer Yost
2017-12-19 06:11:09 UTC
Permalink
You had suggested the following, and it worked. The only difference was subtracting the extension(shared1 instead of shared1.so). Note: I did not use version 3.X against my problem:

===========
Spencer,

Try this:
MYLIBS = ['shared1', 'shared2']
MYLIBPATH = 'variantDir/usr/lib'
executable=Program(hello.c,LIBS=[MYLIBS], LIBPATH=[MYLIBPATH])

Spencer Yost
Post by Bill Deegan
Post by Spencer Yost
Sorry for the delay in responding, but I wanted to respond back to list to let everyone know this worked. I did not appreciate that the target and dependency names have to match exactly apparently for the automatic creation to take place, even if they only differ by existence of a file suffix.
Can you give an example of what you mean above?
Post by Spencer Yost
Thanks!
Spencer Yost
Post by Bill Deegan
Spencer,
MYLIBS = ['shared1', 'shared2']
MYLIBPATH = 'variantDir/usr/lib'
executable=Program(hello.c,LIBS=[MYLIBS], LIBPATH=[MYLIBPATH])
Post by Spencer Yost
Let me back up and explain so you can make sure I know what I am doing.
~~~~~~~~~~~~~~~~~~~
MYLIBS = ['libshared1.so', 'libshared2.so']
MYLIBPATH = 'variantDir/usr/lib'
executable=Program(hello.c,LIBS=[MYLIBS], LIBPATH=[MYLIBPATH])
Depends(executable, os.path.join(MYLIBPATH,eachLib)
This is stripped down obviously: I have install functions/custom builders and more. But you get the idea. And this works in terms of linking/building and does accurately reflect the need to rebuild "executable" if MYLIB changes.
But how do I get SCons to build MYLIB if it is missing? I have an SConscript for MYLIB. Your surprise that this doesn't work leads me to believe that my fear was correct: I am stuck having to read all 1700+ SConscript files in my library packages (over 2000 counting executables, automated unit tests, etc) when I start the building the executable. I can't deal with the huge delay reading that many SConscript files just in case I need to build to build one shared library in the course of building just one executable.
fullSCPath=findRightSConscript(eachLib)
SConscript(fullSCPath,blah,etc,so on)
Depends(executable, os.path.join(MYLIBPATH,eachLib)
But that doesn't work
Thanks in advance!!
Spencer Yost
Post by Bill Deegan
Spencer,
That should happen automatically.
Can you post an example SConstruct to show the issue you're having?
-Bill
Post by Spencer Yost
While I can obviously use the depends() function to ensure my target rebuilds if the dependency changed, I would like some sort of mechanism to automatically build the dependency if it is missing.
Is there functionality in Scons for this that I am missing and or misunderstanding? If not, has someone already built a little extension to handle this already?
In my specific use case, I'm looking for a shared library that has not been built yet. This is a common enough use case that I would like to handle it automatically if possible.
Spencer Yost
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
Bill Deegan
2017-12-19 14:58:39 UTC
Permalink
Ah gotcha.
Would you have expected that even though the file is named libshared1.so
that having LIBS=['shared1.so'] would work?
(instead of LIBS=['shared1']

-Bill
Post by Spencer Yost
You had suggested the following, and it worked. The only difference was
subtracting the extension(shared1 instead of shared1.so). Note: I did
===========
Spencer,
MYLIBS = ['shared1', 'shared2']
MYLIBPATH = 'variantDir/usr/lib'
executable=Program(hello.c,LIBS=[MYLIBS], LIBPATH=[MYLIBPATH])
Spencer Yost
Post by Spencer Yost
Sorry for the delay in responding, but I wanted to respond back to list
to let everyone know this worked. I did not appreciate that the target
and dependency names have to match exactly apparently for the automatic
creation to take place, even if they only differ by existence of a file
suffix.
Can you give an example of what you mean above?
Post by Spencer Yost
Thanks!
Spencer Yost
Spencer,
MYLIBS = ['shared1', 'shared2']
MYLIBPATH = 'variantDir/usr/lib'
executable=Program(hello.c,LIBS=[MYLIBS], LIBPATH=[MYLIBPATH])
Post by Spencer Yost
Let me back up and explain so you can make sure I know what I am doing.
~~~~~~~~~~~~~~~~~~~
MYLIBS = ['libshared1.so', 'libshared2.so']
MYLIBPATH = 'variantDir/usr/lib'
executable=Program(hello.c,LIBS=[MYLIBS], LIBPATH=[MYLIBPATH])
Depends(executable, os.path.join(MYLIBPATH,eachLib)
This is stripped down obviously: I have install functions/custom
builders and more. But you get the idea. And this works in terms of
linking/building and does accurately reflect the need to rebuild
"executable" if MYLIB changes.
But how do I get SCons to build MYLIB if it is missing? I have an
SConscript for MYLIB. Your surprise that this doesn't work leads me to
believe that my fear was correct: I am stuck having to read all 1700+
SConscript files in my library packages (over 2000 counting executables,
automated unit tests, etc) when I start the building the executable. I
can't deal with the huge delay reading that many SConscript files just in
case I need to build to build one shared library in the course of building
just one executable.
fullSCPath=findRightSConscript(eachLib)
SConscript(fullSCPath,blah,etc,so on)
Depends(executable, os.path.join(MYLIBPATH,eachLib)
But that doesn't work
Thanks in advance!!
Spencer Yost
Spencer,
That should happen automatically.
Can you post an example SConstruct to show the issue you're having?
-Bill
Post by Spencer Yost
While I can obviously use the depends() function to ensure my target
rebuilds if the dependency changed, I would like some sort of mechanism to
automatically build the dependency if it is missing.
Is there functionality in Scons for this that I am missing and or
misunderstanding? If not, has someone already built a little extension to
handle this already?
In my specific use case, I'm looking for a shared library that has not
been built yet. This is a common enough use case that I would like to
handle it automatically if possible.
Spencer Yost
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
Spencer Yost
2017-12-19 18:42:07 UTC
Permalink
When you put it that way, no. :-)

But seriously, I simply must have subconsciously assumed that scons would have tried a couple different variations (with the suffix the builder is responsible for, and without, for example) to try to match up targets to dependencies.

I actually should've caught that, or at least thought to have tried that, myself. But I didn't - Thanks so much for the help!

Spencer Yost
Post by Bill Deegan
Ah gotcha.
Would you have expected that even though the file is named libshared1.so that having LIBS=['shared1.so'] would work?
(instead of LIBS=['shared1']
-Bill
Post by Spencer Yost
===========
Spencer,
MYLIBS = ['shared1', 'shared2']
MYLIBPATH = 'variantDir/usr/lib'
executable=Program(hello.c,LIBS=[MYLIBS], LIBPATH=[MYLIBPATH])
Spencer Yost
Post by Bill Deegan
Post by Spencer Yost
Sorry for the delay in responding, but I wanted to respond back to list to let everyone know this worked. I did not appreciate that the target and dependency names have to match exactly apparently for the automatic creation to take place, even if they only differ by existence of a file suffix.
Can you give an example of what you mean above?
Post by Spencer Yost
Thanks!
Spencer Yost
Post by Bill Deegan
Spencer,
MYLIBS = ['shared1', 'shared2']
MYLIBPATH = 'variantDir/usr/lib'
executable=Program(hello.c,LIBS=[MYLIBS], LIBPATH=[MYLIBPATH])
Post by Spencer Yost
Let me back up and explain so you can make sure I know what I am doing.
~~~~~~~~~~~~~~~~~~~
MYLIBS = ['libshared1.so', 'libshared2.so']
MYLIBPATH = 'variantDir/usr/lib'
executable=Program(hello.c,LIBS=[MYLIBS], LIBPATH=[MYLIBPATH])
Depends(executable, os.path.join(MYLIBPATH,eachLib)
This is stripped down obviously: I have install functions/custom builders and more. But you get the idea. And this works in terms of linking/building and does accurately reflect the need to rebuild "executable" if MYLIB changes.
But how do I get SCons to build MYLIB if it is missing? I have an SConscript for MYLIB. Your surprise that this doesn't work leads me to believe that my fear was correct: I am stuck having to read all 1700+ SConscript files in my library packages (over 2000 counting executables, automated unit tests, etc) when I start the building the executable. I can't deal with the huge delay reading that many SConscript files just in case I need to build to build one shared library in the course of building just one executable.
fullSCPath=findRightSConscript(eachLib)
SConscript(fullSCPath,blah,etc,so on)
Depends(executable, os.path.join(MYLIBPATH,eachLib)
But that doesn't work
Thanks in advance!!
Spencer Yost
Post by Bill Deegan
Spencer,
That should happen automatically.
Can you post an example SConstruct to show the issue you're having?
-Bill
Post by Spencer Yost
While I can obviously use the depends() function to ensure my target rebuilds if the dependency changed, I would like some sort of mechanism to automatically build the dependency if it is missing.
Is there functionality in Scons for this that I am missing and or misunderstanding? If not, has someone already built a little extension to handle this already?
In my specific use case, I'm looking for a shared library that has not been built yet. This is a common enough use case that I would like to handle it automatically if possible.
Spencer Yost
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
Bill Deegan
2017-12-19 20:10:22 UTC
Permalink
I thought there was some logic to strip off lib and .so (If I remember
correctly), perhaps if no SHLIBPREFIX it won't try to strip either..

take a look at _stripixes in SCons/Defaults.py

That said the "scons" way of naming libraries would generally be without
the prefix or suffix.
Post by Spencer Yost
When you put it that way, no. :-)
But seriously, I simply must have subconsciously assumed that scons would
have tried a couple different variations (with the suffix the builder is
responsible for, and without, for example) to try to match up targets to
dependencies.
I actually should've caught that, or at least thought to have
tried that, myself. But I didn't - Thanks so much for the help!
Spencer Yost
Ah gotcha.
Would you have expected that even though the file is named libshared1.so
that having LIBS=['shared1.so'] would work?
(instead of LIBS=['shared1']
-Bill
Post by Spencer Yost
You had suggested the following, and it worked. The only difference was
subtracting the extension(shared1 instead of shared1.so). Note: I did
===========
Spencer,
MYLIBS = ['shared1', 'shared2']
MYLIBPATH = 'variantDir/usr/lib'
executable=Program(hello.c,LIBS=[MYLIBS], LIBPATH=[MYLIBPATH])
Spencer Yost
Post by Spencer Yost
Sorry for the delay in responding, but I wanted to respond back to list
to let everyone know this worked. I did not appreciate that the target
and dependency names have to match exactly apparently for the automatic
creation to take place, even if they only differ by existence of a file
suffix.
Can you give an example of what you mean above?
Post by Spencer Yost
Thanks!
Spencer Yost
Spencer,
MYLIBS = ['shared1', 'shared2']
MYLIBPATH = 'variantDir/usr/lib'
executable=Program(hello.c,LIBS=[MYLIBS], LIBPATH=[MYLIBPATH])
Post by Spencer Yost
Let me back up and explain so you can make sure I know what I am doing.
~~~~~~~~~~~~~~~~~~~
MYLIBS = ['libshared1.so', 'libshared2.so']
MYLIBPATH = 'variantDir/usr/lib'
executable=Program(hello.c,LIBS=[MYLIBS], LIBPATH=[MYLIBPATH])
Depends(executable, os.path.join(MYLIBPATH,eachLib)
This is stripped down obviously: I have install functions/custom
builders and more. But you get the idea. And this works in terms of
linking/building and does accurately reflect the need to rebuild
"executable" if MYLIB changes.
But how do I get SCons to build MYLIB if it is missing? I have an
SConscript for MYLIB. Your surprise that this doesn't work leads me to
believe that my fear was correct: I am stuck having to read all 1700+
SConscript files in my library packages (over 2000 counting executables,
automated unit tests, etc) when I start the building the executable. I
can't deal with the huge delay reading that many SConscript files just in
case I need to build to build one shared library in the course of building
just one executable.
fullSCPath=findRightSConscript(eachLib)
SConscript(fullSCPath,blah,etc,so on)
Depends(executable, os.path.join(MYLIBPATH,eachLib)
But that doesn't work
Thanks in advance!!
Spencer Yost
Spencer,
That should happen automatically.
Can you post an example SConstruct to show the issue you're having?
-Bill
Post by Spencer Yost
While I can obviously use the depends() function to ensure my target
rebuilds if the dependency changed, I would like some sort of mechanism to
automatically build the dependency if it is missing.
Is there functionality in Scons for this that I am missing and or
misunderstanding? If not, has someone already built a little extension to
handle this already?
In my specific use case, I'm looking for a shared library that has not
been built yet. This is a common enough use case that I would like to
handle it automatically if possible.
Spencer Yost
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
Loading...