Bug 1199

Summary: waf install doesn't work on x86_64
Product: ns-3 Reporter: Vedran Miletić <vedran>
Component: build systemAssignee: Gustavo J. A. M. Carneiro <gjcarneiro>
Status: RESOLVED FIXED    
Severity: normal CC: ns-bugs
Priority: P5    
Version: pre-release   
Hardware: All   
OS: All   
Attachments: Patch against 3.11

Description Vedran Miletić 2011-06-26 08:12:28 UTC
Hi,

while making RPM package for ns-3 for Fedora, I encountered some issues with build system on x86_64, specifically (copy-paste from ns-3-users):

- build/release/ns3/config-store-config.h doesn't get installed, while
build/release/ns3/core-config.h does (fixed, will attach a patch in a moment)
- waf sets libdir to lib on x86_64, while it should be lib64 (partially fixed, libs get installed in proper location but also in improper one; don't know how to fully fix it)
- pkgconfig files have:
prefix=/usr (good)
libdir=/usr/lib (not good on x86_64)
includedir=/usr/include (not good, should be include/ns3)
(fixed)
- python bindings don't get installed properly, *.so files get copied
into /usr/lib instead of copying contents of
build/release/bindings/python to /usr/lib64/python2.7/site-packages/ (will file a separate bug for this)
Comment 1 Vedran Miletić 2011-06-26 08:22:43 UTC
Created attachment 1174 [details]
Patch against 3.11
Comment 2 Gustavo J. A. M. Carneiro 2011-07-05 13:38:40 UTC
I made a commit:

changeset:   7345:850237ab2111
tag:         tip
user:        Gustavo J. A. M. Carneiro  <gjc@inescporto.pt>
date:        Tue Jul 05 18:30:43 2011 +0100
summary:     Bug 1199 - waf install doesn't work on x86_64

I did my own patch, which is slightly cleaner and shorter.

One thing I have commented out is this:

def configure(conf):
    [...]
    #if os.path.exists('/usr/lib64'):
    #    conf.env.LIBDIR = os.path.join(conf.env.PREFIX, "lib64")

You see, on Debian and derivatives, even in x86_64 the libraries are installed by default in /usr/lib, and /usr/lib64 is a symbolic link.  But I checked that the .pc files contents have /usr/lib instead of /usr/lib64.

Right now, you can make ns-3 install in /usr/lib64 like this:
  ./waf --prefix /usr --libdir /usr/lib64

If you can figure out some heuristic that works (better than os.path.exists("/usr/lib64")), we can include in ns-3 to make then defaults work, but right now I consider this sort of fixed.
Comment 3 Vedran Miletić 2011-07-07 14:11:36 UTC
This is almost perfect, and --libdir option does exactly what is needed here. However, if --libdir is set to /usr/lib64, that setting isn't respected in .pc files, it remains set to /usr/lib. I understand it makes sense on Debian and derivates, but unfortunately not on Fedora.
Comment 4 Gustavo J. A. M. Carneiro 2011-07-07 19:21:24 UTC
(In reply to comment #3)
> This is almost perfect, and --libdir option does exactly what is needed here.
> However, if --libdir is set to /usr/lib64, that setting isn't respected in .pc
> files, it remains set to /usr/lib. I understand it makes sense on Debian and
> derivates, but unfortunately not on Fedora.

Are you sure the .pc files are not correct?  I thought I had this fixed too; I'll have to recheck...
Comment 5 Vedran Miletić 2011-07-08 03:32:32 UTC
Yes. I don't have access to Fedora x86_64 machine at the moment, but I'm sure.
Comment 6 Gustavo J. A. M. Carneiro 2011-07-08 05:48:50 UTC
This seems ok from here.  Maybe you need to remove the previous .pc files before generating new ones?

gjc@gjc-laptop:ns-3-dev$ ./waf configure --prefix /tmp/ --libdir /tmp/lib64
gjc@gjc-laptop:ns-3-dev$ ./waf
gjc@gjc-laptop:ns-3-dev$ rm -f build/debug/*.pc
gjc@gjc-laptop:ns-3-dev$ ./waf
Waf: Entering directory `/home/gjc/projects/ns/ns-3-allinone/ns-3-dev/build'
[1275/1311] pcfile: build/debug/libns3-core.pc
[...]
gjc@gjc-laptop:ns-3-dev$ cat build/debug/libns3-core.pc 

prefix=/tmp
libdir=/tmp/lib64
includedir=/tmp/include/ns3

Name: libns3-core
Description: ns-3 module ns3-core
Version: devel
Libs: -L${libdir} -Wl,-Bdynamic -lns3-core
Cflags: -I${includedir}
Comment 7 Vedran Miletić 2011-07-08 09:33:14 UTC
Could be, will check.
Comment 8 Vedran Miletić 2011-07-11 09:30:40 UTC
Yes, it works. Thanks for fixing it.