Clang to find its own headers

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Clang to find its own headers

Don Hinton via cfe-dev

Hi!

 

Forgive my noobish question, I’m new to actually touching the Clang/LLVM codebase.

 

Where is it coded how Clang finds its own headers from under ’lib/clang/7.0.0/include’? I’m helping with the packaging of LLVM on Windows for Vcpkg and the resulting Clang install doesn’t work, it fails to finds its own headers. Are Clang installs relocatable? Vcpkg builds packages out of source into a staging directory. If both Debug and Release builds go fine, it does a few extra checks and copies the result of the ’install’ target which went to the staging dir to its final location. I don’t know if this workflow causes the problem or the layout is different than what Clang would expect.

 

Where should I start looking?

 

Cheers,

Máté

 

ps.: all this is in order to make POCL compile on Windows. As far as I saw there’s nothing prohibiting it (the ICD might), it’s just that the latest Windows install guide still mentions Clang 3.6. I already had to patch llvm-config.exe to report correct paths with the install layout enforced by Vcpkg, but the heders are still a problem.

 


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Clang to find its own headers

Don Hinton via cfe-dev
On 2019-01-10 11:27, Máté Ferenc Nagy-Egri via cfe-dev wrote:

> Hi!
>
> Forgive my noobish question, I’m new to actually touching the Clang/LLVM
> codebase.
>
> Where is it coded how Clang finds its own headers from under
> ’lib/clang/7.0.0/include’? I’m helping with the packaging of LLVM on
> Windows for Vcpkg and the resulting Clang install doesn’t work, it fails
> to finds its own headers. Are Clang installs relocatable? Vcpkg builds
> packages out of source into a staging directory. If both Debug and
> Release builds go fine, it does a few extra checks and copies the result
> of the ’install’ target which went to the staging dir to its final
> location. I don’t know if this workflow causes the problem or the layout
> is different than what Clang would expect.

On Posix Clang expects the internal include files to be present relative
to the binary: ../lib/clang/<version>/include. Where "<version>" is the
version of Clang. Not sure if the same is true on Windows.

--
/Jacob Carlborg

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Clang to find its own headers

Don Hinton via cfe-dev

It might be true. clang.exe resides in

 

<vcpkg_root>/installed/<triplet>/tools/llvm/

 

whereas the includes are in

 

<vcpkg_root>/installed/<triplet>/lib/clang/<version>/include

 

so the way to reach them is ../../lib/clang/<version>/include

 

Can I change this with configuring Clang? I don’t see any CMake param to LLVM that would controll this. Is this hardcoded? Where must I patch it?

 

Feladó: [hidden email]
Elküldve: 2019. január 10., csütörtök 11:58
Címzett: [hidden email]
Tárgy: Re: Clang to find its own headers

 

On 2019-01-10 11:27, Máté Ferenc Nagy-Egri via cfe-dev wrote:


> Hi!
>
> Forgive my noobish question, I’m new to actually touching the Clang/LLVM
> codebase.
>
> Where is it coded how Clang finds its own headers from under
> ’lib/clang/7.0.0/include’? I’m helping with the packaging of LLVM on
> Windows for Vcpkg and the resulting Clang install doesn’t work, it fails
> to finds its own headers. Are Clang installs relocatable? Vcpkg builds
> packages out of source into a staging directory. If both Debug and
> Release builds go fine, it does a few extra checks and copies the result
> of the ’install’ target which went to the staging dir to its final
> location. I don’t know if this workflow causes the problem or the layout
> is different than what Clang would expect.

On Posix Clang expects the internal include files to be present relative
to the binary: ../lib/clang/<version>/include. Where "<version>" is the
version of Clang. Not sure if the same is true on Windows.

--
/Jacob Carlborg

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

If you reply to this email, your message will be added to the discussion below:

http://clang-developers.42468.n3.nabble.com/Clang-to-find-its-own-headers-tp4063492p4063493.html

To start a new topic under Clang Developers, email [hidden email]
To unsubscribe from Clang Developers, click here.
NAML

 


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Clang to find its own headers

Don Hinton via cfe-dev
In reply to this post by Don Hinton via cfe-dev
The CMake variable is called CLANG_RESOURCE_DIR, defined here:


If unset, the driver computes the path:


On Thu, Jan 10, 2019 at 6:45 AM Máté Ferenc Nagy-Egri via cfe-dev <[hidden email]> wrote:

It might be true. clang.exe resides in

 

<vcpkg_root>/installed/<triplet>/tools/llvm/

 

whereas the includes are in

 

<vcpkg_root>/installed/<triplet>/lib/clang/<version>/include

 

so the way to reach them is ../../lib/clang/<version>/include

 

Can I change this with configuring Clang? I don’t see any CMake param to LLVM that would controll this. Is this hardcoded? Where must I patch it?

 

Feladó: [hidden email]
Elküldve: 2019. január 10., csütörtök 11:58
Címzett: [hidden email]
Tárgy: Re: Clang to find its own headers

 

On 2019-01-10 11:27, Máté Ferenc Nagy-Egri via cfe-dev wrote:


> Hi!
>
> Forgive my noobish question, I’m new to actually touching the Clang/LLVM
> codebase.
>
> Where is it coded how Clang finds its own headers from under
> ’lib/clang/7.0.0/include’? I’m helping with the packaging of LLVM on
> Windows for Vcpkg and the resulting Clang install doesn’t work, it fails
> to finds its own headers. Are Clang installs relocatable? Vcpkg builds
> packages out of source into a staging directory. If both Debug and
> Release builds go fine, it does a few extra checks and copies the result
> of the ’install’ target which went to the staging dir to its final
> location. I don’t know if this workflow causes the problem or the layout
> is different than what Clang would expect.

On Posix Clang expects the internal include files to be present relative
to the binary: ../lib/clang/<version>/include. Where "<version>" is the
version of Clang. Not sure if the same is true on Windows.

--
/Jacob Carlborg

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

If you reply to this email, your message will be added to the discussion below:

http://clang-developers.42468.n3.nabble.com/Clang-to-find-its-own-headers-tp4063492p4063493.html

To start a new topic under Clang Developers, email [hidden email]
To unsubscribe from Clang Developers, click here.
NAML

 

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Clang to find its own headers

Don Hinton via cfe-dev
In reply to this post by Don Hinton via cfe-dev
HI Máté,

Make sure you build both 'clang' and 'clang-headers', the latter actually copies the headers to the build directory.

The install should be relocatable, but make sure to also include the internal headers and put them into the following structure:
<install-dir>/bin/clang
<install-dir>/bin/clang++
<install-dir>/bin/... <-- other binaries/symlinks go here
<install-dir>/lib/<version>/include/ <-- headers should go here



On Thu, Jan 10, 2019 at 11:27 AM Máté Ferenc Nagy-Egri via cfe-dev <[hidden email]> wrote:

Hi!

 

Forgive my noobish question, I’m new to actually touching the Clang/LLVM codebase.

 

Where is it coded how Clang finds its own headers from under ’lib/clang/7.0.0/include’? I’m helping with the packaging of LLVM on Windows for Vcpkg and the resulting Clang install doesn’t work, it fails to finds its own headers. Are Clang installs relocatable? Vcpkg builds packages out of source into a staging directory. If both Debug and Release builds go fine, it does a few extra checks and copies the result of the ’install’ target which went to the staging dir to its final location. I don’t know if this workflow causes the problem or the layout is different than what Clang would expect.

 

Where should I start looking?

 

Cheers,

Máté

 

ps.: all this is in order to make POCL compile on Windows. As far as I saw there’s nothing prohibiting it (the ICD might), it’s just that the latest Windows install guide still mentions Clang 3.6. I already had to patch llvm-config.exe to report correct paths with the install layout enforced by Vcpkg, but the heders are still a problem.

 

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev


--
Regards,
Ilya Biryukov

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Clang to find its own headers

Don Hinton via cfe-dev
In reply to this post by Don Hinton via cfe-dev
If it's possible to change the distribution, I would suggest keeping the directory structure that clang expects, though.
This would allow to be consistent with how other distributions (Chromium's clang, LLVM releases) do that, allowing to swap clang compiled for those when needed.

On Thu, Jan 10, 2019 at 5:36 PM Petr Hosek via cfe-dev <[hidden email]> wrote:
The CMake variable is called CLANG_RESOURCE_DIR, defined here:


If unset, the driver computes the path:


On Thu, Jan 10, 2019 at 6:45 AM Máté Ferenc Nagy-Egri via cfe-dev <[hidden email]> wrote:

It might be true. clang.exe resides in

 

<vcpkg_root>/installed/<triplet>/tools/llvm/

 

whereas the includes are in

 

<vcpkg_root>/installed/<triplet>/lib/clang/<version>/include

 

so the way to reach them is ../../lib/clang/<version>/include

 

Can I change this with configuring Clang? I don’t see any CMake param to LLVM that would controll this. Is this hardcoded? Where must I patch it?

 

Feladó: [hidden email]
Elküldve: 2019. január 10., csütörtök 11:58
Címzett: [hidden email]
Tárgy: Re: Clang to find its own headers

 

On 2019-01-10 11:27, Máté Ferenc Nagy-Egri via cfe-dev wrote:


> Hi!
>
> Forgive my noobish question, I’m new to actually touching the Clang/LLVM
> codebase.
>
> Where is it coded how Clang finds its own headers from under
> ’lib/clang/7.0.0/include’? I’m helping with the packaging of LLVM on
> Windows for Vcpkg and the resulting Clang install doesn’t work, it fails
> to finds its own headers. Are Clang installs relocatable? Vcpkg builds
> packages out of source into a staging directory. If both Debug and
> Release builds go fine, it does a few extra checks and copies the result
> of the ’install’ target which went to the staging dir to its final
> location. I don’t know if this workflow causes the problem or the layout
> is different than what Clang would expect.

On Posix Clang expects the internal include files to be present relative
to the binary: ../lib/clang/<version>/include. Where "<version>" is the
version of Clang. Not sure if the same is true on Windows.

--
/Jacob Carlborg

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

If you reply to this email, your message will be added to the discussion below:

http://clang-developers.42468.n3.nabble.com/Clang-to-find-its-own-headers-tp4063492p4063493.html

To start a new topic under Clang Developers, email [hidden email]
To unsubscribe from Clang Developers, click here.
NAML

 

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev


--
Regards,
Ilya Biryukov

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev