Skip to content
This repository has been archived by the owner on Jul 30, 2020. It is now read-only.

Fix ./waf install #84

Closed
htfy96 opened this issue Nov 26, 2017 · 4 comments
Closed

Fix ./waf install #84

htfy96 opened this issue Nov 26, 2017 · 4 comments

Comments

@htfy96
Copy link

htfy96 commented Nov 26, 2017

Since default ./waf install only copies app into /usr/bin with broken libclang.so, we need to provide a customized build() in wscript.

Probably we can replace absolute rpath with relative one (e.g. libs/) and copies app, libclang.so and clang_resource_dir to /opt/cquery.

Current package on Arch Linux patched wscript to perform the above instructions, but I think it would be better to have these steps builtin in scripts. The directory structure is as follows:

/opt/cquery
├── clang_resource_dir
│   ├── include
│   └── README.md
├── cquery // with rpath=lib/
└── lib
    ├── BugpointPasses.so
    ├── libc++abi.so
    ├── libc++abi.so.1
    ├── libc++abi.so.1.0
    ├── libclang.so
    ├── libclang.so.4
    ├── libclang.so.4.0
    ├── libc++.so
    ├── libc++.so.1
    ├── libc++.so.1.0
    ├── libgomp.so
    ├── libiomp5.so
    ├── libLTO.so
    ├── libLTO.so.4
    ├── libLTO.so.4.0.0
    ├── libomp.so
    ├── libunwind.so
    ├── libunwind.so.1
    ├── libunwind.so.1.0
    └── LLVMHello.so

➜  cat /usr/bin/cquery 
#!/usr/bin/bash
cd /opt/cquery
./cquery $@
@jacobdufault
Copy link
Owner

IMHO I prefer not using ./waf install but I’m happy to merge any fixes so the Arch Linux script is simpler. Some wscript changes just got merged which change how libclang is used (#64) but I don't expect they will affect this issue in particular.

@MaskRay
Copy link
Contributor

MaskRay commented Nov 26, 2017

On Linux, the clang executable uses DT_RUNPATH to encode the search path of shared libraries .so it depends on.

% readelf -d Dev/llvm/build/bin/clang | grep RUNPATH
 0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib]

I'm not sure how Mac OS X and Windows work.

Ideally, the build directory reflects the file hierarchy that will be installed to the install prefix:

build
  bin
    cquery  (renamed from build/app)
  clang_resource_dir
  lib
    libclang.so.4
    libclang.so
    libclang.so.4.0

Then https://aur.archlinux.org/packages/cquery-git/ PKGBUILD can be simplified by just coping the directory contents to the system root.

@MaskRay
Copy link
Contributor

MaskRay commented Dec 12, 2017

What about:

build
  release
    bin
      cquery
    share          # not exist
      cquery
          clang_resource_dir
    lib                           # not exist
      cquery       
        libclang.so.4     # --bundled-clang=4.0.0
        libclang.so    # --bundled-clang=4.0.0
        libclang.so.4.0    # --bundled-clang=4.0.0

@MaskRay
Copy link
Contributor

MaskRay commented Dec 17, 2017

It appears to be fixed in recent waf improvement.

@MaskRay MaskRay closed this as completed Dec 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants