Basically, I am compiling an executable that requires Node.js, Ruby and C or C++ or both (I am not sure) as I am forking a project here: https://github.com/slee047/node-packer
I have been consistently failing in macOS test case because it is not using GCC-7 despite I have tried to install it via homebrew. This is what the system show when I run gcc --version:
Configured with: --prefix=/Applications/Xcode-11.0.app/Contents/Developer/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1 Apple clang version 11.0.0 (clang-1100.0.32.5) Target: x86_64-apple-darwin18.5.0 Thread model: posix InstalledDir: /Applications/Xcode-11.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
By default gcc and g++ on OSX point to the AppleClang compiler. Like you do on Linux you can choose a specific compiler executable.
before_install:
- |
if [[ ${TRAVIS_OS_NAME} == "osx" ]]; then
eval "CC=gcc-7 && CXX=g++-7"
fi
Note: In your script you are installing LLVM on OSX, not GCC.
Is this what you intended? Then you’ll have to call the compiler not with gcc and g++, but with clang-7 and clang++-7.
If you want to use GCC-7 on both Linux and OSX, than you can drop the test for the OS.
Suggestion: Why use such extensive scripts to set versions?
The YAML configuration to install the dependencies, seems to me easier to read and maintain:
In an OSX job, did you notice this message from the llvm@7 formula in the log?
To use the bundled libc++ please add the following LDFLAGS:
LDFLAGS="-L/usr/local/opt/llvm@7/lib -Wl,-rpath,/usr/local/opt/llvm@7/lib"
llvm@7 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.
If you need to have llvm@7 first in your PATH run:
echo 'export PATH="/usr/local/opt/llvm@7/bin:$PATH"' >> ~/.bash_profile
For compilers to find llvm@7 you may need to set:
export LDFLAGS="-L/usr/local/opt/llvm@7/lib"
export CPPFLAGS="-I/usr/local/opt/llvm@7/include"
Eventually, I have found that the reason why I have failed to compile is due to the use of XCode 11 and some test cases may need some bug fix (Non-YAML / GCC / LLVM related).
I can pass the test in OSX now even with the much simplified YAML (Previously, I thought that it has something to do with the updates etc.)
Ok, I will take a look and see if this method helps or not (In XCode 11, it fails). Right now, I realized that I can compile this with default XCode 10.2 without installing gcc / g++ or llvm.
-> cd /tmp/nodec_tests_tmpdir/node-10.16.2-1.6.0
-> Running ["./configure "]
Did not find a new enough assembler, install one or build with
--openssl-no-asm.
Please refer to BUILDING.md
Failed running ["./configure "]
Searching “Did not find a new enough assembler” in the node-10.16.2 source code shows that it’s triggered by this check:
is_x86 = 'x64' in variables['target_arch'] or 'ia32' in variables['target_arch']
# supported asm compiler for AVX2. See https://github.com/openssl/openssl/
# blob/OpenSSL_1_1_0-stable/crypto/modes/asm/aesni-gcm-x86_64.pl#L52-L69
openssl110_asm_supported = \
('gas_version' in variables and float(variables['gas_version']) >= 2.23) or \
('xcode_version' in variables and float(variables['xcode_version']) >= 5.0) or \
('llvm_version' in variables and float(variables['llvm_version']) >= 3.3) or \
('nasm_version' in variables and float(variables['nasm_version']) >= 2.10)
if is_x86 and not openssl110_asm_supported:
error('''Did not find a new enough assembler, install one or build with
--openssl-no-asm.
Please refer to BUILDING.md''')
xcode_version should be 11.0, and my nasm -v prints the following:
NASM version 2.14.02 compiled on Dec 27 2018
So I think it could be a bug in XCode 11 or sort of, I don’t have this issue when I am using XCode 10.2 or lower in YAML. There is another compilation issues for Linux test cases though, but I shall leave that in Linux sub-forum.
That’s for linking to other libraries. To use the compiler as an executable, add it to PATH.
You can also request debug mode for your repo by sending an e-mail to support@travis-ci.com and/or debug that Python code to find out what the erroneous values are and where they come from.
Some timeout issue (Typically happens in only one of the 3 test cases)
Some invalid test cases (Or rather, cases in the test suite may have not updated). This happens in only one of my 3 test scenarios, but it can be considered as fixed.
Therefore, I will write in support instead. Thank you very much.