Welcome, Guest. Please login or register.

Author Topic: Development Environment using Vagrant?  (Read 1724 times)

malber-jss

  • Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Development Environment using Vagrant?
« on: September 05, 2016, 09:00:35 PM »
I was trying to setup a development environment using Vagrant. Will the Vagrant config below work? The shared folder is based on the source code being checkout on the local / host system. Thanks for any help...

Vagrant.configure(2) do |config|
  config.vm.guest = :freebsd
  config.vm.box = "freebsd/FreeBSD-10.3-RELEASE"
  config.ssh.shell = "sh"
  config.ssh.forward_agent = true
  config.vm.base_mac = "080027D14C66"
  config.vm.network "private_network", ip: "192.168.33.10"
  
  config.vm.synced_folder ".", "/vagrant", :nfs => true, id: "vagrant-root", disabled: false
  
  config.vm.synced_folder "./t1n1wall-code/branches/freebsd10", "/var/freebsd10", :nfs => true, id: "t1n1wall-root", disabled: false

  config.vm.provider "virtualbox" do |vb|
    vb.name = "pfSense FreeBSD-10.3"
    vb.customize ["modifyvm", :id, "--memory", "2048"]
    vb.customize ["modifyvm", :id, "--cpus", "2"]
    vb.customize ["modifyvm", :id, "--hwvirtex", "on"]
    vb.customize ["modifyvm", :id, "--audio", "none"]
    vb.customize ["modifyvm", :id, "--nictype1", "virtio"]
    vb.customize ["modifyvm", :id, "--nictype2", "virtio"]
  end

  config.vm.provision "shell" do |s|
    s.inline = <<-SHELL
      # pkg install --yes git
    SHELL
  end
end


malber-jss

  • Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Development Environment using Vagrant?
« Reply #1 on: November 19, 2016, 10:09:04 PM »
Updated Vagrant File:
# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure(2) do |config|
  config.vm.box = "freebsd/FreeBSD-10.3-RELEASE"

  config.ssh.shell = "sh"
  config.ssh.forward_agent = true
  config.vm.base_mac = "080027D14C66"
  config.vm.network "private_network", ip: "192.168.33.10"

  config.vm.synced_folder ".", "/vagrant", type: "rsync", rsync__exclude: ".git/"

  config.vm.synced_folder "../src/branches/freebsd10/build/scripts", "/home/vagrant/scripts", type: "rsync", rsync__exclude: ".git/"

  config.vm.provider "virtualbox" do |vb|
    vb.name = "t1n1wall FreeBSD-10"
    vb.customize ["modifyvm", :id, "--memory", "2048"]
    vb.customize ["modifyvm", :id, "--cpus", "2"]
    vb.customize ["modifyvm", :id, "--hwvirtex", "on"]
    vb.customize ["modifyvm", :id, "--audio", "none"]
    vb.customize ["modifyvm", :id, "--nictype1", "virtio"]
    vb.customize ["modifyvm", :id, "--nictype2", "virtio"]
  end

  config.vm.provision "shell", inline: <<-SHELL
    pkg install -y -g 'bash-4.*'
    /usr/bin/svnlite export --force svn://svn.freebsd.org/base/releng/10.3 /usr/src
  SHELL
end

Once the VM is up and running and assuming branch/freebsd10...

$ vagrant ssh

% sudo -s

# chmod +x scripts/go.sh

# scripts/go.sh

# ./1makebuildenv.sh
# ./2makebinaries.sh
# ./3patchtools.sh
# ./4crunch.sh

Then I get:

sh /usr/src/bin/sh/mktokens
rm -f .depend
CC='gcc46' mkdep -f .depend -a    -DSHELL -I. -I/usr/src/bin/sh -std=gnu99    alias.c arith_yacc.c arith_yylex.c cd.c /usr/src/bin/sh/bltin/echo.c error.c eval.c exec.c expand.c histedit.c input.c jobs.c /usr/src/bin/sh/../kill/kill.c mail.c main.c memalloc.c miscbltin.c mystring.c options.c output.c parser.c /usr/src/bin/sh/../../usr.bin/printf/printf.c redir.c show.c /usr/src/bin/sh/../test/test.c trap.c var.c builtins.c nodes.c syntax.c
echo sh: /usr/lib/libc.a /usr/lib/libedit.a /usr/lib/libtermcap.a >> .depend
gcc46 -O2 -pipe   -DSHELL -I. -I/usr/src/bin/sh -std=gnu99  -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -Wno-uninitialized -Wno-pointer-sign  -c alias.c -o alias.o
gcc46 -O2 -pipe   -DSHELL -I. -I/usr/src/bin/sh -std=gnu99  -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -Wno-uninitialized -Wno-pointer-sign  -c arith_yacc.c -o arith_yacc.o
gcc46 -O2 -pipe   -DSHELL -I. -I/usr/src/bin/sh -std=gnu99  -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -Wno-uninitialized -Wno-pointer-sign  -c arith_yylex.c -o arith_yylex.o
gcc46 -O2 -pipe   -DSHELL -I. -I/usr/src/bin/sh -std=gnu99  -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -Wno-uninitialized -Wno-pointer-sign  -c cd.c -o cd.o
gcc46 -O2 -pipe   -DSHELL -I. -I/usr/src/bin/sh -std=gnu99  -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -Wno-uninitialized -Wno-pointer-sign  -c /usr/src/bin/sh/bltin/echo.c -o echo.o
gcc46 -O2 -pipe   -DSHELL -I. -I/usr/src/bin/sh -std=gnu99  -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -Wno-uninitialized -Wno-pointer-sign  -c error.c -o error.o
gcc46 -O2 -pipe   -DSHELL -I. -I/usr/src/bin/sh -std=gnu99  -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -Wno-uninitialized -Wno-pointer-sign  -c eval.c -o eval.o
gcc46 -O2 -pipe   -DSHELL -I. -I/usr/src/bin/sh -std=gnu99  -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -Wno-uninitialized -Wno-pointer-sign  -c exec.c -o exec.o
gcc46 -O2 -pipe   -DSHELL -I. -I/usr/src/bin/sh -std=gnu99  -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -Wno-uninitialized -Wno-pointer-sign  -c expand.c -o expand.o
gcc46 -O2 -pipe   -DSHELL -I. -I/usr/src/bin/sh -std=gnu99  -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -Wno-uninitialized -Wno-pointer-sign  -c histedit.c -o histedit.o
histedit.c: In function 'histedit':
histedit.c:127:9: error: '_el_fn_sh_complete' undeclared (first use in this function)
histedit.c:127:9: note: each undeclared identifier is reported only once for each function it appears in
*** Error code 1

Stop.
make[1]: stopped in /usr/src/bin/sh
*** Error code 1

Stop.
make: stopped in /usr/t1n1wall/build10/tmp/crunchgen


Any suggestions on what I'm missing? Thanks

andywhite

  • Administrator
  • Full Member
  • *****
  • Posts: 119
  • Karma: +0/-0
    • View Profile
Re: Development Environment using Vagrant?
« Reply #2 on: November 21, 2016, 09:00:05 PM »
Hi !

step 4 is where it builds a single binary called t1n1box, which combines a bunch of binaries into a single binary.

The error you have , is where it's building the shell (sh) , and looks like maybe it's missing a library , or path to libraries.

not sure if that helps you though  :(

andywhite

  • Administrator
  • Full Member
  • *****
  • Posts: 119
  • Karma: +0/-0
    • View Profile
Re: Development Environment using Vagrant?
« Reply #3 on: November 21, 2016, 10:08:26 PM »
I tried you vagrant file, can't sudo as thats missing from the 10.3 image it installs, so not sure how that step works for you , unless you installed sudo.  also had problems with installing bash through pkg...