Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » How to let eclipse execute ./configure; make; make install on a project?
How to let eclipse execute ./configure; make; make install on a project? [message #1750080] Thu, 15 December 2016 21:25 Go to next message
nibbli nibbli is currently offline nibbli nibbliFriend
Messages: 3
Registered: December 2016
Junior Member
I learned that doing a RMB -> Reconfigure Project on a project will execute a "./configure" with the build parameters from the active build configuration - ok. RMB -> Build Project on a project will execute a "make all" which is fine, too. RMB -> Build Target on the "install" build target of the project will do the "make install" part.

But so far i was unable to find way to automate these three steps. Especially when a project B depends on a project A (aka A is marked as a reference in Bs properties) and i do RMB -> Build Project (or something else) on project B, the three steps should be automatically executed on project A before the three steps are automatically executed on project B.

Hope, this makes any sense.
Re: How to let eclipse execute ./configure; make; make install on a project? [message #1750191 is a reply to message #1750080] Sat, 17 December 2016 05:12 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
I assume that RMB = "right mouse button".
I take it you are using autotools.
If so, './configure' builds the makefile.
You normally only need to do this once assuming it is successful.

To change the project build order: http://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Ftasks%2Ftasks-14.htm

As for running install from Eclipse, do you really want to do that?
It's a bad idea if it needs root or admin privileges.
However, if an install always follows a successful build, you could write a script.
Change the build command from 'make' to the script.

You could also change the build command to 'make; make install' but the install will happen regardless of the make success. A script is better as it's easier to halt the shell on errors. You could also have the script run the configure script if you really want to run it on every build.

Another way you could go is to modify the configure script to generate a makefile where the first target does everything ('make' executes 'make all' because 'all' is usually the first target). This can be a chicken and egg problem though.



Re: How to let eclipse execute ./configure; make; make install on a project? [message #1750316 is a reply to message #1750191] Mon, 19 December 2016 20:06 Go to previous messageGo to next message
nibbli nibbli is currently offline nibbli nibbliFriend
Messages: 3
Registered: December 2016
Junior Member
Yes, RMB is "right mouse button" and I do use the Autotools plugin on CentOS 7.

The ./configure step of project B depends on a successful make install step of project A because the installed files are needed and are passed to the configure script with a --with-xxx=/path parameter. I circumvent the privilege separation with a custom --prefix=/path parameter.

On to the try changing the Build command of the project:
1) make; make install is a problem because make; not found in PATH
2) make ; make install is a problem because make: *** No rule to make target `;'. Stop.
3) Filling in the path to a custom script (with the three steps in it chained by &&) seems to work but it looks like I loose every functionality and visibility in the Eclipse IDE. For example the console output and the configure build parameters from the active build configuration. I might rather do everything in a real console, then. Also, Eclipse seems to append all to that Build command for some reason.

I don't know, maybe I just don't get the purpose of the IDE. What i'd like to do is Menu Project -> Build Project and the project builds with all dependencies beforehand.

A custom project build order might suffice but one can only chose whole projects there not specific build targets or the configure step.
Re: How to let eclipse execute ./configure; make; make install on a project? [message #1750319 is a reply to message #1750316] Mon, 19 December 2016 21:37 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
OK. The build command is executed directly without using a shell. Not surprising.
This worked for me:
Make command: bash -c "pwd; ls; echo '---'; env"

15:58:30 **** Build of configuration Debug for project Hello ****
bash -c "pwd; ls; echo '---'; env" all 
/home/dvavra/proj/Hello/Debug
makefile
objects.mk
sources.mk
src
---
XDG_VTNR=1
LIBOVERLAY_SCROLLBAR=0
PERLBREW_VERSION=0.76
:
:
15:58:30 Build Finished (took 168ms)


But apparently "all" (the current target) is also appended which caused an unshown error so a script is in order but it has to be run with bash (or another shell). Remember that the current working directory is the build configuration directory.

Make command: bash './Build.sh'
Produced the same output as above.

Quote:
What i'd like to do is Menu Project -> Build Project and the project builds with all dependencies beforehand.

So specify the build order using the Build Order dialog. Why does that bother you? It has to be specified somewhere. Yes, you can only specify whole projects but there is only one build per project. You probably want Project --> Build All since Project -> Build Project only builds the selected project. You can also specify a project set using Working Set .

If you don't like the way it is implemented in Eclipse (can't please everybody) then you'll have to find a way to do it outside of Eclipse. You can still trigger it with the Eclipse menu though. You could also ask for an enhancement but you'll have to wait until it is implemented.




Re: How to let eclipse execute ./configure; make; make install on a project? [message #1750321 is a reply to message #1750319] Mon, 19 December 2016 22:22 Go to previous messageGo to next message
nibbli nibbli is currently offline nibbli nibbliFriend
Messages: 3
Registered: December 2016
Junior Member
First, I have to understand the implementation before not liking it. Again, I don't even know, if my intended use case is useful or makes any sense.

Because almost all free projects out there are build with ./configure; make; make install, I thought Eclipse has specific support for that. Silly me.

Anyway, appreciate your effort.

[Updated on: Mon, 19 December 2016 22:28]

Report message to a moderator

Re: How to let eclipse execute ./configure; make; make install on a project? [message #1750377 is a reply to message #1750321] Tue, 20 December 2016 14:11 Go to previous message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
Quote:
most all free projects out there are buil[t] with ./configure; make; make install,

I disagree. In general, mostly only when autotools has been used which also means with Linux. It's common with GNU software but there are other methods .
http://stackoverflow.com/questions/10961439/why-always-configure-make-make-install-as-3-seperate-steps
You can still do this by changing the build command in your projects but it's not clear why it should be generally provided.

You have never said why you want to run the configure script for every build. The only reason for doing so is when the configuration changes thus the need for a new Makefile. How often can it change? I would think it only needs to be done once for most cases. I can see running Make if the code is changing. If you are adding/removing code modules, it's rather easy to have Make discover them using wildcard searches.

Quote:
I have to understand the implementation before not liking it.

What's to understand? Project->Build All builds all projects in the workspace. There is no facility to test if a build is necessary so Build All will literally build everything. If they need to be built in some order you can specify it.

You sound like you want a pre-Make with auto-discovery of build order. Try writing one. Now try writing one that will generally fit all or most users. You may then see how difficult it is. However, if you're successful, consider joining the development team and share your efforts.



Previous Topic:Technical error
Next Topic:Cross compile include library error
Goto Forum:
  


Current Time: Fri Apr 26 15:11:08 GMT 2024

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

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

Back to the top