# How can I setup LLVM 7 as default C / C++ compiler in Bionic

**URL:** <https://travis-ci.community/t/how-can-i-setup-llvm-7-as-default-c-c-compiler-in-bionic/4678>\
**Category:** Bionic\
**Created:** [August 11, 2019, 2:27am UTC](https://travis-ci.community/t/how-can-i-setup-llvm-7-as-default-c-c-compiler-in-bionic/4678 "2019-08-11T02:27:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![slee047](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/slee047/32/2494_2.png) [@slee047](https://travis-ci.community/u/slee047)\
**Post date:** [August 11, 2019, 2:27am UTC](https://travis-ci.community/t/how-can-i-setup-llvm-7-as-default-c-c-compiler-in-bionic/4678/1 "2019-08-11T02:27:41Z")

</div>

Hi all, as title, I have a Travis project that kept failing due to this error:

```auto
if [! -r node -o ! -L node]; then ln -fs out/Release/node node; fi
-> cd /home/travis/build/slee047/node-packer
-> cp "/tmp/nodec_tests_tmpdir/node-10.16.2-1.6.0/out/Release/node" "/home/travis/build/slee047/node-packer/a.out"
internal/modules/cjs/loader.js:638
    throw err;
    ^
Error: Cannot find module '/ __enclose_io_memfs__ /bin/coffee'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Function.Module.runMain (internal/modules/cjs/loader.js:835:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
Traceback (most recent call last):
tests/coffeescript_1:59:in `<main>': unhandled exception

```

The log is here:  
[https://travis-ci.org/slee047/node-packer/jobs/570121416](https://travis-ci.org/slee047/node-packer/jobs/570121416)

and the config is here:

[https://travis-ci.org/slee047/node-packer/jobs/570121416/config](https://travis-ci.org/slee047/node-packer/jobs/570121416/config)

On top of Bionic (GCC7), I have tested using Xenial (GCC 5) but still fails. Therefore, I would like to try LLVM because it is possible for Mac version (With up to XCode 10 only, XCode 11 will result in early failure due to another separate issue) to be compiled successfully.

I believe the recent build failures are to be related with this bug:

[https://github.com/slee047/node-packer/issues/11](https://github.com/slee047/node-packer/issues/11)

---

<div class="post-metadata">

**Author:** ![native-api](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/native-api/32/430_2.png) [@native-api](https://travis-ci.community/u/native-api)\
**Post date:** [August 11, 2019, 8:14am UTC](https://travis-ci.community/t/how-can-i-setup-llvm-7-as-default-c-c-compiler-in-bionic/4678/2 "2019-08-11T08:14:12Z")

</div>

That depends on your build system. Most build systems in Linux accept the standard way, setting `CC` and `CXX` envvars.

In the case of LLVM 7, that’ll be:

```auto
addons:
  apt:
    packages:
      - clang-7

env:
  # may need to be under 'global:' or 'matrix:' if 'env:' is on top level,
  # see https://docs.travis-ci.com/user/environment-variables/
  # Or just 'export' them in the script
   - CC=clang-7
     CXX=clang++-7

```

* * *

Though the specific error you gave looks like a problem with your code at first glance: earlier in the log, there’s a warning referencing a #define that suggests that the name of the “module” that’s not found is something that you yourself pass.

---

<div class="post-metadata">

**Author:** ![slee047](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/slee047/32/2494_2.png) [@slee047](https://travis-ci.community/u/slee047)\
**Post date:** [August 11, 2019, 11:47am UTC](https://travis-ci.community/t/how-can-i-setup-llvm-7-as-default-c-c-compiler-in-bionic/4678/3 "2019-08-11T11:47:52Z")

</div>

> [@native-api](#):
>
> CXX=clang+±7

Thanks, apparently it is using clang but it still fails. I guess it is some other non-Travis related issue that happens only in Linux (BTW, the original author has provided 2 CIs, AppVeyor is used for Windows exclusively and there is no error there). What I am trying to do is to sideload / patch the bundled Node.js with a newer version regularly as it updates into my forked github repo.

[https://travis-ci.org/slee047/node-packer/builds/570427117](https://travis-ci.org/slee047/node-packer/builds/570427117)
