How to build chef-server from official sources on github?

Hi Team,

I am trying to build the chef-server from source code present on github. But even after following all steps i am not able to see the package generated at omnibus/pkg. Any help would be really appreciated.

I'd need to see a build log (at least the tail of it) to understand what the actual failure was. Also, I am curious what you're attempting to do? Unless you've patched the source to remove trademarked words (I.E. "Chef", "Opscode") then you're likely not building something compliant with the trademark policy. Are you aware of the Cinc project? That might be a much easier solution to whatever you're looking to do.

If you're committed to building from source, can you attach the build logs? Thanks!

Thank you so much for you reply.
I have an idea for open source project for which i am trying to build source code from scratch.

Now for the Build,
I did little more search in the source code and came to the point i can build this source code using command "bundle exec omnibus build chef-server" using omnibus.

But now it is failing to build "cpanminus" while executing the "bundle exec omnibus build chef-server".
Platform used: CentOS Linux 7

Following is the log:

[root@mydevmachine4 omnibus]# bundle exec omnibus build chef-server


     [Builder: cpanminus] I | 2021-07-14T05:18:29+00:00 |   PATH="/opt/opscode/bin:/opt/opscode/embedded/bin:/usr/local/rvm/gems/ruby-2.7.2/bin:/usr/local/rvm/gems/ruby-2.7.2@global/bin:/usr/local/rvm/rubies/ruby-2.7.2/bin:/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/rvm/bin:/root/bin"
     [Builder: cpanminus] I | 2021-07-14T05:18:29+00:00 |   PKG_CONFIG_PATH="/opt/opscode/embedded/lib/pkgconfig"
     [Builder: cpanminus] I | 2021-07-14T05:18:29+00:00 | $ cpanm Module::Build
     [Builder: cpanminus] I | 2021-07-14T05:18:45+00:00 | Execute: `cpanm Module::Build': 215.1501s
     [Builder: cpanminus] I | 2021-07-14T05:18:45+00:00 | Build cpanminus: 217.6925s
The following shell command exited with status 1:

    $ CFLAGS=-I/opt/opscode/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector CPPFLAGS=-I/opt/opscode/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector CXXFLAGS=-I/opt/opscode/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector LDFLAGS=-Wl,-rpath,/opt/opscode/embedded/lib -L/opt/opscode/embedded/lib LD_RUN_PATH=/opt/opscode/embedded/lib OMNIBUS_INSTALL_DIR=/opt/opscode PATH=/opt/opscode/bin:/opt/opscode/embedded/bin:/usr/local/rvm/gems/ruby-2.7.2/bin:/usr/local/rvm/gems/ruby-2.7.2@global/bin:/usr/local/rvm/rubies/ruby-2.7.2/bin:/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/rvm/bin:/root/bin PKG_CONFIG_PATH=/opt/opscode/embedded/lib/pkgconfig cpanm Module::Build

Output:

    --> Working on Module::Build
Fetching http://www.cpan.org/authors/id/L/LE/LEONT/Module-Build-0.4231.tar.gz ... OK
Configuring Module-Build-0.4231 ... OK
==> Found dependencies: TAP::Harness
--> Working on TAP::Harness
Fetching http://www.cpan.org/authors/id/L/LE/LEONT/Test-Harness-3.42.tar.gz ... OK
Configuring Test-Harness-3.42 ... OK
Building and testing Test-Harness-3.42 ... FAIL

Error:

    perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = (unset),
	LC_CTYPE = "UTF-8",
	LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
! Installing TAP::Harness failed. See /root/.cpanm/work/1626239909.8162/build.log for details. Retry with --force to force install it.
! Installing the dependencies failed: Installed version (3.26) of TAP::Harness is not in range '3.29'
! Bailing out the installation for Module-Build-0.4231.


/usr/local/rvm/gems/ruby-2.7.2/bundler/gems/omnibus-87db446ee0b9/lib/omnibus/util.rb:139:in `rescue in shellout!'
  /usr/local/rvm/gems/ruby-2.7.2/bundler/gems/omnibus-87db446ee0b9/lib/omnibus/util.rb:134:in `shellout!'
  /usr/local/rvm/gems/ruby-2.7.2/bundler/gems/omnibus-87db446ee0b9/lib/omnibus/builder.rb:871:in `shellout!'
  /usr/local/rvm/gems/ruby-2.7.2/bundler/gems/omnibus-87db446ee0b9/lib/omnibus/builder.rb:85:in `block in command'
  /usr/local/rvm/gems/ruby-2.7.2/bundler/gems/omnibus-87db446ee0b9/lib/omnibus/builder.rb:1061:in `instance_eval'
  /usr/local/rvm/gems/ruby-2.7.2/bundler/gems/omnibus-87db446ee0b9/lib/omnibus/builder.rb:1061:in `run'
  /usr/local/rvm/gems/ruby-2.7.2/bundler/gems/omnibus-87db446ee0b9/lib/omnibus/builder.rb:889:in `block (3 levels) in execute'
  /usr/local/rvm/gems/ruby-2.7.2/bundler/gems/omnibus-87db446ee0b9/lib/omnibus/builder.rb:911:in `with_retries'
  /usr/local/rvm/gems/ruby-2.7.2/bundler/gems/omnibus-87db446ee0b9/lib/omnibus/builder.rb:888:in `block (2 levels) in execute'
  /usr/local/rvm/gems/ruby-2.7.2/bundler/gems/omnibus-87db446ee0b9/lib/omnibus/instrumentation.rb:23:in `measure'
  /usr/local/rvm/gems/ruby-2.7.2/bundler/gems/omnibus-87db446ee0b9/lib/omnibus/builder.rb:887:in `block in execute'
  /usr/local/rvm/gems/ruby-2.7.2/bundler/gems/omnibus-87db446ee0b9/lib/omnibus/builder.rb:962:in `with_clean_env'
  /usr/local/rvm/gems/ruby-2.7.2/bundler/gems/omnibus-87db446ee0b9/lib/omnibus/builder.rb:886:in `execute'
  /usr/local/rvm/gems/ruby-2.7.2/bundler/gems/omnibus-87db446ee0b9/lib/omnibus/builder.rb:778:in `block (2 levels) in build'
  /usr/local/rvm/gems/ruby-2.7.2/bundler/gems/omnibus-87db446ee0b9/lib/omnibus/builder.rb:777:in `each'
  /usr/local/rvm/gems/ruby-2.7.2/bundler/gems/omnibus-87db446ee0b9/lib/omnibus/builder.rb:777:in `block in build'
  /usr/local/rvm/gems/ruby-2.7.2/bundler/gems/omnibus-87db446ee0b9/lib/omnibus/instrumentation.rb:23:in `measure'
  /usr/local/rvm/gems/ruby-2.7.2/bundler/gems/omnibus-87db446ee0b9/lib/omnibus/builder.rb:776:in `build'
  /usr/local/rvm/gems/ruby-2.7.2/bundler/gems/omnibus-87db446ee0b9/lib/omnibus/software.rb:1224:in `execute_build'
  /usr/local/rvm/gems/ruby-2.7.2/bundler/gems/omnibus-87db446ee0b9/lib/omnibus/software.rb:1107:in `build_me'
  /usr/local/rvm/gems/ruby-2.7.2/bundler/gems/omnibus-87db446ee0b9/lib/omnibus/project.rb:1078:in `block (2 levels) in build'
  /usr/local/rvm/gems/ruby-2.7.2/bundler/gems/omnibus-87db446ee0b9/lib/omnibus/project.rb:1077:in `each'
  /usr/local/rvm/gems/ruby-2.7.2/bundler/gems/omnibus-87db446ee0b9/lib/omnibus/project.rb:1077:in `block in build'
  /usr/local/rvm/gems/ruby-2.7.2/bundler/gems/omnibus-87db446ee0b9/lib/omnibus/licensing.rb:62:in `block in create_incrementally'
  /usr/local/rvm/gems/ruby-2.7.2/bundler/gems/omnibus-87db446ee0b9/lib/omnibus/licensing.rb:57:in `tap'
  /usr/local/rvm/gems/ruby-2.7.2/bundler/gems/omnibus-87db446ee0b9/lib/omnibus/licensing.rb:57:in `create_incrementally'
  /usr/local/rvm/gems/ruby-2.7.2/bundler/gems/omnibus-87db446ee0b9/lib/omnibus/project.rb:1076:in `build'
  /usr/local/rvm/gems/ruby-2.7.2/bundler/gems/omnibus-87db446ee0b9/lib/omnibus/cli.rb:89:in `build'
  /usr/local/rvm/gems/ruby-2.7.2/gems/thor-1.1.0/lib/thor/command.rb:27:in `run'
  /usr/local/rvm/gems/ruby-2.7.2/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command'
  /usr/local/rvm/gems/ruby-2.7.2/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch'
  /usr/local/rvm/gems/ruby-2.7.2/bundler/gems/omnibus-87db446ee0b9/lib/omnibus/cli/base.rb:33:in `dispatch'
  /usr/local/rvm/gems/ruby-2.7.2/gems/thor-1.1.0/lib/thor/base.rb:485:in `start'
  /usr/local/rvm/gems/ruby-2.7.2/bundler/gems/omnibus-87db446ee0b9/lib/omnibus/cli.rb:42:in `execute!'
  /usr/local/rvm/gems/ruby-2.7.2/bundler/gems/omnibus-87db446ee0b9/bin/omnibus:16:in `<top (required)>'
  /usr/local/rvm/gems/ruby-2.7.2/bin/omnibus:23:in `load'
  /usr/local/rvm/gems/ruby-2.7.2/bin/omnibus:23:in `<top (required)>'
  /usr/local/rvm/gems/ruby-2.7.2/gems/bundler-2.2.23/lib/bundler/cli/exec.rb:63:in `load'
  /usr/local/rvm/gems/ruby-2.7.2/gems/bundler-2.2.23/lib/bundler/cli/exec.rb:63:in `kernel_load'
  /usr/local/rvm/gems/ruby-2.7.2/gems/bundler-2.2.23/lib/bundler/cli/exec.rb:28:in `run'
  /usr/local/rvm/gems/ruby-2.7.2/gems/bundler-2.2.23/lib/bundler/cli.rb:474:in `exec'
  /usr/local/rvm/gems/ruby-2.7.2/gems/bundler-2.2.23/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
  /usr/local/rvm/gems/ruby-2.7.2/gems/bundler-2.2.23/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
  /usr/local/rvm/gems/ruby-2.7.2/gems/bundler-2.2.23/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
  /usr/local/rvm/gems/ruby-2.7.2/gems/bundler-2.2.23/lib/bundler/cli.rb:30:in `dispatch'
  /usr/local/rvm/gems/ruby-2.7.2/gems/bundler-2.2.23/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
  /usr/local/rvm/gems/ruby-2.7.2/gems/bundler-2.2.23/lib/bundler/cli.rb:24:in `start'
  /usr/local/rvm/gems/ruby-2.7.2/gems/bundler-2.2.23/exe/bundle:49:in `block in <top (required)>'
  /usr/local/rvm/gems/ruby-2.7.2/gems/bundler-2.2.23/lib/bundler/friendly_errors.rb:128:in `with_friendly_errors'
  /usr/local/rvm/gems/ruby-2.7.2/gems/bundler-2.2.23/exe/bundle:37:in `<top (required)>'
  /usr/local/rvm/gems/ruby-2.7.2/bin/bundle:23:in `load'
  /usr/local/rvm/gems/ruby-2.7.2/bin/bundle:23:in `<main>'
  /usr/local/rvm/gems/ruby-2.7.2/bin/ruby_executable_hooks:24:in `eval'
  /usr/local/rvm/gems/ruby-2.7.2/bin/ruby_executable_hooks:24:in `<main>'

The actual error here appears to be something related to the install of TAP::Harness:

I am not a Perl expert, so the best advice I can give you is to talk about how the Cinc project does these builds. We use Docker containers preconfigured with the Omnibus build toolchain, and within these we're able to patch Chef Server to remove the trademarked words and build Cinc server. You might want to try your build inside one of our containers.

Also, since this project you're working on is going to involve you finding your own way to do wordmark replacements, duplicating the work the Cinc project is doing already -- I'd invite you to collaborate with us and, if you need to make changes to the source, possibly fork the cinc-server project (which is free and open source, unlike Chef server which is not free, but open source) and maintain your changes there. That way, you're getting the benefit of a working build process as well as wordmark replacements from us, and we can possibly benefit from any knowledge or changes you have.

Please feel free to join us in the #community-distros channel on the Chef Slack, or send me a DM if you prefer and I can provide details on what we're working on.

Thank you so much for the reply.

I checked Cinc project which really helped in the diagnosis of my issue.
Will definitely get in touch with you.

I am able to resolve the issue with " [Builder: cpanminus Failed to build" while executing "bundle exec omnibus build chef-server" command.

Followings are the things i followed:
rebuilt the omnibus-software-master source code, here to bypass the cpanminus test execution i added "cpanm Module::Build --force" in the cpanminus.rb file.
And updated the Gemfile (available in chef-server omnibus) to point to local omnibus-software-master in-place of github.