Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to build to chroot using Eclipse CDT?

I've got a chroot environment with everything needed for building a complex C++ project, using make (it's for a specific Linux distribution).

I would like to use Eclipse CDT (outside the chroot environment) in this project but make it so that Eclipse, when building, goes into the chroot enviroment and builds in there.

Is it possible?

like image 297
muriloq Avatar asked Feb 25 '23 00:02

muriloq


1 Answers

Yes thats possible. Just select the 'External builder' within the Builder Settings Tab under C/C++ Build. I selected a script that executes the following commands:

sudo chroot $HOME/mychroot/  bash -c 'cd /myproject-location/; make clean; make'

To avoid a password check i added the following line to my /etc/sudoers file:

%sudo   ALL= NOPASSWD: /usr/sbin/chroot

To avoid wrong build failure/syntax error reporting you have to add the include files from within your chroot environment to the eclipse cdt project.

like image 94
Jotschi Avatar answered Mar 06 '23 08:03

Jotschi