Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Rpath on Windows
Rpath on Windows [message #1771880] Thu, 31 August 2017 15:18 Go to next message
Marco Di Fresco is currently offline Marco Di FrescoFriend
Messages: 3
Registered: August 2017
Junior Member
Hi all,
I am developing a software composed by an executable and various shared libraries; all parts have their own Eclipse project.

All parts are cross-platform and each project has different build configurations for both Linux and Windows (Debug-Linux, Release-Linux. Debug-Windows, Release-Windows).

In order to run and test the executable under Eclipse, I told the project where to find the libraries: under Project properties -> C/C++ Build -> Settings -> Tool Settings -> Cross G++ Linker -> Miscellaneous I have put: -Wl,-rpath '${workspace_loc:/library-name/Debug-Linux/}' (of course it ends in ....-Windows/}' for the Windows build configurations).

The problem is that it works under Linux, but not under Windows as it complains that it can't find the libraries. If I manually copy the generated executable and libraries on a same folder, the executable works fine, but it is not very practical to do so every time I want to test a change on the libraries.

Why doesn't it works? Does rpath have a different syntax under Windows? Do I have to use a different function?

Thanks in advance.


P.S. under each compile profile I have put the appropriate configurations under Project properties -> C/C++ Build -> Settings -> Tool Settings -> Cross G++ Compiler -> Includes and Project properties -> C/C++ Build -> Settings -> Cross G++ Linker -> Libraries and indeed all the projects compile fine and, as I said, everything run fine if all executable and libraries are placed on the same folder.
Re: Rpath on Windows [message #1771908 is a reply to message #1771880] Thu, 31 August 2017 23:39 Go to previous messageGo to next message
David Vavra is currently offline David VavraFriend
Messages: 626
Registered: October 2012
Senior Member
What does the link command look like in the console log for each case?
I don't have an easy way to test this but some questions:


o) expand the "${workspace_loc:/library-name/ ... " and do a directory listing of it from a command line.
Are the libraries there?

o) Are you missing a comma after -rpath? See: https://stackoverflow.com/a/6562437/3312726

Re: Rpath on Windows [message #1771924 is a reply to message #1771908] Fri, 01 September 2017 07:09 Go to previous messageGo to next message
Marco Di Fresco is currently offline Marco Di FrescoFriend
Messages: 3
Registered: August 2017
Junior Member
Hi David,
thank you for your answer.

The link command is the following:
Building target: huvas-server
Invoking: Cross G++ Linker
g++ -L"C:\Users\Marco\git\libhuvas\Debug-Windows" -L"C:\Users\Marco\git\huvas-utils\Debug-Windows" -L"C:\Users\Marco\git\huvas-log\Debug-Windows" -Wl,-rpath 'C:\Users\Marco\git\libhuvas\Debug-Windows' -Wl,-rpath 'C:\Users\Marco\git\huvas-log\Debug-Windows' -Wl,-rpath 'C:\Users\Marco\git\huvas-utils\Debug-Windows' -o "huvas-server"  ./src/Configuration.o ./src/Console.o ./src/Network.o ./src/huvas-server.o   -lhuvas -lhuvas-utils -lhuvas-log
Finished building target: huvas-server


The compilation complete correctly.

The error message I get if I run it under Eclipse is the following:
<terminated> (exit value: -1.073.741.515)


Under ${workspace_loc:/library-name/Debug-Windows the library is there (in fact if I take it from there and copy it on the same folder of the executable, the executable run fine.

There is no missing comma; in fact I copied the whole line from the Linux compile profile and to the Windows profile and just changed Debug-Linux to Debug-Windows.
Re: Rpath on Windows [message #1771947 is a reply to message #1771924] Fri, 01 September 2017 12:14 Go to previous messageGo to next message
David Vavra is currently offline David VavraFriend
Messages: 626
Registered: October 2012
Senior Member
In that case, see: https://stackoverflow.com/questions/3272383/linking-with-r-and-rpath-switches-on-windows
Re: Rpath on Windows [message #1772076 is a reply to message #1771947] Tue, 05 September 2017 10:08 Go to previous message
Marco Di Fresco is currently offline Marco Di FrescoFriend
Messages: 3
Registered: August 2017
Junior Member
Thank for the link.

I have evaluated various solutions and I ended up making symbolic links (opened a command prompt with administrative privileges and used mklink) from the libraries Debug/Release folders to the executable Debug/Release folder and now the executable can be launched from within Eclipse.

Thank you very much.
Previous Topic:Unable to build project
Next Topic:Support for multithread stack in Debug view
Goto Forum:
  


Current Time: Mon Dec 11 09:40:47 GMT 2017

Powered by FUDForum. Page generated in 0.01893 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software