Bug 1169 - OS X static build fails
OS X static build fails
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: build system
pre-release
All All
: P5 normal
Assigned To: Mitch Watrous
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-05-20 15:25 UTC by Tom Henderson
Modified: 2011-06-03 15:42 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Henderson 2011-05-20 15:25:22 UTC
./waf configure -d optimized  --disable-python --enable-static
--enable-examples  --enable-tests --with-pybindgen=pybindgen/

[1343/1554] static_link:
build/optimized/src/point-to-point/model/point-to-point-net-device_1.o
build/optimized/src/point-to-point/model/point-to-point-channel_1.o
build/optimized/src/point-to-point/model/point-to-point-remote-channel_1.o
build/optimized/src/point-to-point/model/ppp-header_1.o
build/optimized/src/point-to-point/helper/point-to-point-helper_1.o ->
build/optimized/libns3-point-to-point.a
[1344/1554] static_link:
build/optimized/src/point-to-point/test/point-to-point-test_3.o ->
build/optimized/libns3-point-to-point-test.a
[1345/1554] static_link:  -> build/optimized/libns3-emu.a
ar: no archive members specified
usage:  ar -d [-TLsv] archive file ...
	ar -m [-TLsv] archive file ...
	ar -m [-abiTLsv] position archive file ...
	ar -p [-TLsv] archive [file ...]
	ar -q [-cTLsv] archive file ...
	ar -r [-cuTLsv] archive file ...
	ar -r [-abciuTLsv] position archive file ...
	ar -t [-TLsv] archive [file ...]
	ar -x [-ouTLsv] archive [file ...]
Waf: Leaving directory `/Users/duyapple/ns-3-allinone/ns-3-dev/build'
Build failed:  -> task failed (err #1):
	{task: static_link  -> libns3-emu.a}

Could be due to this line in src/wscript:

bld.add_subdirs(list(all_modules))  <-  enabled modules instead?
Comment 1 duy 2011-05-20 22:50:52 UTC
from wscript, it seems like --enable-static is only supported in linux. 

opt.add_option('--enable-static',
                   help=('Compile NS-3 statically: works only on linux, without python'),



maybe because of the  gcc 4.2.1?  I've looked into it but still have no idea where ar is coming from.  Let me know if I can try something.

I am not sure how to enable modules for 
 
bld.add_subdirs(list(all_modules))
Comment 2 John Abraham 2011-05-21 16:39:23 UTC
you are right. We just tried this option in the newer buildbots, apparently it was never meant for darwin originally or may be it was supported for darwin later

   401         elif env['CXX_NAME'] == 'gcc' and \
   402                 (env['PLATFORM'].startswith('darwin') or \
   403                      env['PLATFORM'].startswith('cygwin')):
   404                 conf.report_optional_feature("static", "Static build", True, '')
   405                 env['ENABLE_STATIC_NS3'] = True

I will lower the priority of this bug , but will keep it open
Comment 3 Mitch Watrous 2011-05-23 16:08:51 UTC
Using the latest ns-3-dev, which contains RC2 but not RC3, if I try to enable one a singe module like this:

   ./waf configure -d optimized  --disable-python --enable-static
      --enable-examples  --enable-tests --with-pybindgen=pybindgen/
      --enable-modules=core

This works for these modules:

    core
    internet
    mpi
    bridge

but fails for this module:

    emu

So there is something special about the emu module.
Comment 4 Tom Henderson 2011-05-23 17:20:45 UTC
(In reply to comment #3)
> Using the latest ns-3-dev, which contains RC2 but not RC3, if I try to enable
> one a singe module like this:
> 
>    ./waf configure -d optimized  --disable-python --enable-static
>       --enable-examples  --enable-tests --with-pybindgen=pybindgen/
>       --enable-modules=core
> 
> This works for these modules:
> 
>     core
>     internet
>     mpi
>     bridge
> 
> but fails for this module:
> 
>     emu
> 
> So there is something special about the emu module.

There are no object files to pass to ar, so it fails.  Running under "./waf -vvv" shows:

14:12:37 Logs Task 
	{task: static_link address_1.o,application_1.o,buffer_1.o,byte-tag-list_1.o,channel_1.o,channel-list_1.o,chunk_1.o,header_1.o,nix-vector_1.o,node_1.o,node-list_1.o,net-device_1.o,packet_1.o,packet-metadata_1.o,packet-tag-list_1.o,socket_1.o,socket-factory_1.o,tag_1.o,tag-buffer_1.o,trailer_1.o,address-utils_1.o,data-rate_1.o,drop-tail-queue_1.o,error-model_1.o,ethernet-header_1.o,ethernet-trailer_1.o,flow-id-tag_1.o,inet-socket-address_1.o,inet6-socket-address_1.o,ipv4-address_1.o,ipv6-address_1.o,mac48-address_1.o,mac64-address_1.o,llc-snap-header_1.o,output-stream-wrapper_1.o,packetbb_1.o,packet-burst_1.o,packet-socket_1.o,packet-socket-address_1.o,packet-socket-factory_1.o,pcap-file_1.o,pcap-file-wrapper_1.o,queue_1.o,radiotap-header_1.o,simple-channel_1.o,simple-net-device_1.o,application-container_1.o,net-device-container_1.o,node-container_1.o,packet-socket-helper_1.o,trace-helper_1.o -> libns3-network.a}
14:12:37 envhash 'UHN%y\x933\xfa(]\xcf\x807\x11|\x11' ['/usr/bin/ar', 'rcs', '[]', '[]']
14:12:37 task task 
	{task: static_link  -> libns3-emu.a} must run as it was never run before or the task code changed
[686/729] static_link:  -> build/debug/libns3-emu.a
14:12:37 runner system command -> ['/usr/bin/ar', 'rcs', 'debug/libns3-emu.a']
ar: no archive members specified
usage:  ar -d [-TLsv] archive file ...
	ar -m [-TLsv] archive file ...
	ar -m [-abiTLsv] position archive file ...
	ar -p [-TLsv] archive [file ...]
	ar -q [-cTLsv] archive file ...
	ar -r [-cuTLsv] archive file ...
	ar -r [-abciuTLsv] position archive file ...
	ar -t [-TLsv] archive [file ...]
	ar -x [-ouTLsv] archive [file ...]
Waf: Leaving directory `/Users/tomh/ns-3-allinone/ns-3-dev/build'
Build failed:  -> task failed (err #1): 
	{task: static_link  -> libns3-emu.a}

I don't know whether the solution lies in either
1) put a check in somewhere to avoid trying to run ar against zero object files, if the situation ever arises
2) prevent libns3-emu.a from being created if ENABLE_EMU is false
Comment 5 Mitch Watrous 2011-05-23 17:36:32 UTC
(In reply to comment #4)
> (In reply to comment #3)
> > Using the latest ns-3-dev, which contains RC2 but not RC3, if I try to enable
> > one a singe module like this:
> > 
> >    ./waf configure -d optimized  --disable-python --enable-static
> >       --enable-examples  --enable-tests --with-pybindgen=pybindgen/
> >       --enable-modules=core
> > 
> > This works for these modules:
> > 
> >     core
> >     internet
> >     mpi
> >     bridge
> > 
> > but fails for this module:
> > 
> >     emu
> > 
> > So there is something special about the emu module.
> 
> There are no object files to pass to ar, so it fails.  Running under "./waf
> -vvv" shows:
> 
> 14:12:37 Logs Task 
>     {task: static_link
> address_1.o,application_1.o,buffer_1.o,byte-tag-list_1.o,channel_1.o,channel-list_1.o,chunk_1.o,header_1.o,nix-vector_1.o,node_1.o,node-list_1.o,net-device_1.o,packet_1.o,packet-metadata_1.o,packet-tag-list_1.o,socket_1.o,socket-factory_1.o,tag_1.o,tag-buffer_1.o,trailer_1.o,address-utils_1.o,data-rate_1.o,drop-tail-queue_1.o,error-model_1.o,ethernet-header_1.o,ethernet-trailer_1.o,flow-id-tag_1.o,inet-socket-address_1.o,inet6-socket-address_1.o,ipv4-address_1.o,ipv6-address_1.o,mac48-address_1.o,mac64-address_1.o,llc-snap-header_1.o,output-stream-wrapper_1.o,packetbb_1.o,packet-burst_1.o,packet-socket_1.o,packet-socket-address_1.o,packet-socket-factory_1.o,pcap-file_1.o,pcap-file-wrapper_1.o,queue_1.o,radiotap-header_1.o,simple-channel_1.o,simple-net-device_1.o,application-container_1.o,net-device-container_1.o,node-container_1.o,packet-socket-helper_1.o,trace-helper_1.o
> -> libns3-network.a}
> 14:12:37 envhash 'UHN%y\x933\xfa(]\xcf\x807\x11|\x11' ['/usr/bin/ar', 'rcs',
> '[]', '[]']
> 14:12:37 task task 
>     {task: static_link  -> libns3-emu.a} must run as it was never run before or
> the task code changed
> [686/729] static_link:  -> build/debug/libns3-emu.a
> 14:12:37 runner system command -> ['/usr/bin/ar', 'rcs', 'debug/libns3-emu.a']
> ar: no archive members specified
> usage:  ar -d [-TLsv] archive file ...
>     ar -m [-TLsv] archive file ...
>     ar -m [-abiTLsv] position archive file ...
>     ar -p [-TLsv] archive [file ...]
>     ar -q [-cTLsv] archive file ...
>     ar -r [-cuTLsv] archive file ...
>     ar -r [-abciuTLsv] position archive file ...
>     ar -t [-TLsv] archive [file ...]
>     ar -x [-ouTLsv] archive [file ...]
> Waf: Leaving directory `/Users/tomh/ns-3-allinone/ns-3-dev/build'
> Build failed:  -> task failed (err #1): 
>     {task: static_link  -> libns3-emu.a}
> 
> I don't know whether the solution lies in either
> 1) put a check in somewhere to avoid trying to run ar against zero object
> files, if the situation ever arises
> 2) prevent libns3-emu.a from being created if ENABLE_EMU is false

I found the place in src/emu/wscript where it tries to create an empty emu module:

    def build(bld):
        module = bld.create_ns3_module('emu', ['network'])
        module.source = [
            ]
        headers = bld.new_task_gen('ns3header')
        headers.module = 'emu'
        headers.source = [
            'doc/emu.h',
            ]
    
        if not bld.env['ENABLE_EMU']:
            return
    
        module.source.extend([
                'model/emu-net-device.cc',
                'model/emu-encode-decode.cc',
                'helper/emu-helper.cc',
                ])
        ...

I am going to try to make waf not build the emu library if emu is not enabled.

Although this might introduce some coupling between the top level wscript and the emu module.
Comment 6 Mitch Watrous 2011-06-03 15:42:43 UTC
Bug fixed.

Changeset:  8359b3ac1ab0