travis CI did not work with C compiler on GitHub? - c

travis CI did not work with C compiler.
.travis.yml :
sudo: required
language: c
os:
- linux
compiler:
- gcc
GitHib repo link:
Algorithms
travis CI error:
travis_time:end:0dcb3648:start=1438359476527442359,finish=1438359476614557866,duration=87115507
[0K$ cd piyush-maurya/algorithms
$ git checkout -qf 37da548d8f6e1ced6df4b3e22e2b5afd5435c2a2
travis_fold:end:git.checkout
[0K$ export CC=gcc
$ gcc --version
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
travis_time:start:2b2b89e2
[0K$ ./configure && make && make test
/home/travis/build.sh: line 41: ./configure: No such file or directory
travis_time:end:2b2b89e2:start=1438359476633265005,finish=1438359476641026855,duration=7761850
[0K
[31;1mThe command "./configure && make && make test" exited with 127.[0m
Done. Your build exited with 1.
error links:
travis CI error log

You haven't specified how to build the project. For a C project, the default is the standard autotools-style ./configure && make, but your project doesn't have a configure script (or a Makefile).
You can just add something like
build: cc file1.c file2.c …
To call the C compiler directly, but if you want the project to be useful to other people you should provide a Makefile (or use a build system like autotools, CMake, waf, etc.), then just do
build: make

Related

Python installation cannot run C compiled programs on Debian 9

I'm trying to install Python 3.7 on my Linux machine, but it's telling me it's unable to run C compiled programs:
root#kvm-RPJared2:~/Python-3.7.3# sudo ./configure --enable-optimizations
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for python3.7... no
checking for python3... python3
checking for --enable-universalsdk... no
checking for --with-universal-archs... no
checking MACHDEP... checking for --without-gcc... no
checking for --with-icc... no
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... configure: error: in `/root/Python-3.7.3':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
root#kvm-RPJared2:~/Python-3.7.3# gcc --version
gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
As you can see, I already have GCC installed, so I'm a bit lost on how to solve this issue.
Edit: I've already tried to download directly from git using apt-get, but the program is running into trouble with invalidated GPG keys. I've also tried using make as a different su, and that runs into the same error as I've shown above. If anyone has answers to either the apt-get issue (--allow-inauthenticated hasn't worked either) or the error I've pasted above, please help me out!

MacOS "configure: error: cannot run C compiled programs"

I am pretty new to the MacOS environment and I previously had some issue compiling C scripts. I had the following issue:
fatal error: stdio.h: No such file or directory
#include <stdio.h>
^
compilation terminated.
I tried to re-install xcode-select --install but keep telling me
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
I updated everything and nothing. Apparently it is because I don't have the /usr/includes file. I found a way to compile my software by using
/Library/Developer/CommandLineTools/usr/bin/g++ XXXX.cpp
However, now I am trying to ./compile and make another software but I don't know how to use this gcc interpreter by default. When I try to ./configure I got this error
configure: error: cannot run C compiled programs. If you meant to
cross compile, use '--host'. See 'config.log' for more details
So when I do look into config.log :
configure:3224: checking for gcc
configure:3240: found /usr/local/bin/gcc
configure:3251: result: gcc
configure:3282: checking for C compiler version
configure:3291: gcc --version >&5
gcc (GCC) 4.9.2 20141029 (prerelease)
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
configure:3302: $? = 0
configure:3291: gcc -v >&5
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-apple-darwin14.0.0/4.9.2/lto-wrapper
Target: x86_64-apple-darwin14.0.0
Configured with: ../gcc-4.9-20141029/configure --enable-languages=c++,fortran
Thread model: posix
gcc version 4.9.2 20141029 (prerelease) (GCC)
configure:3302: $? = 0
configure:3291: gcc -V >&5
gcc: error: unrecognized command line option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:3302: $? = 1
configure:3291: gcc -qversion >&5
gcc: error: unrecognized command line option '-qversion'
gcc: fatal error: no input files
compilation terminated.
configure:3302: $? = 1
configure:3322: checking whether the C compiler works
configure:3344: gcc conftest.c >&5
configure:3348: $? = 0
configure:3396: result: yes
configure:3399: checking for C compiler default output file name
configure:3401: result: a.out
configure:3407: checking for suffix of executables
configure:3414: gcc -o conftest conftest.c >&5
configure:3418: $? = 0
configure:3440: result:
configure:3462: checking whether we are cross compiling
configure:3470: gcc -o conftest conftest.c >&5
conftest.c:15:19: fatal error: stdio.h: No such file or directory
#include <stdio.h>
^
compilation terminated.
configure:3474: $? = 1
configure:3481: ./conftest
./configure: line 3483: ./conftest: No such file or directory
configure:3485: $? = 127
configure:3492: error: in `/Users/XXXX/phyml':
configure:3494: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
Do you have any ideas of how I can fix it ?
Thanks a lot !
It's really easy to miss the answer from melpomene in the small comments to this question so let me post this here for everyone to see. This error usually means you're missing compiler tools (headers actually) that have been removed from Xcode.
You can find them in /Library/Developer/CommandLineTools/Packages/ since their name might be different depending on your version of macOS in the future.
Assuming you're running macOS Mojave (10.14), you need to run:
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
And an macOS-style package installer will start, asking you for your adminstrator password. This is an official Apple package and although it might be weird to install something out of a random directory, you can trust it. You don't have to take my word for it though. Apple buried this change in the Xcode 10 release notes and you can find their explanation here: https://developer.apple.com/documentation/xcode_release_notes/xcode_10_release_notes#3035623
I'll reproduce this here in case this link ever goes away or gets changed:
The Command Line Tools package installs the macOS system headers inside the macOS SDK. Software that compiles with the installed tools will search for headers within the macOS SDK provided by either Xcode at:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk
or the Command Line Tools at:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
depending on which is selected using xcode-select.
The command line tools will search the SDK for system headers by default. However, some software may fail to build correctly against the SDK and require macOS headers to be installed in the base system under /usr/include. If you are the maintainer of such software, we encourage you to update your project to work with the SDK or file a bug report for issues that are preventing you from doing so. As a workaround, an extra package is provided which will install the headers to the base system. In a future release, this package will no longer be provided. You can find this package at:
/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

> To make sure that you're using the intended version of the command line tools, run xcode-select -s or xcode select -s /Library/Developer/CommandLineTools after installing.

Compiling C Program to WebAssembly Program with "Error: No available targets are compatible with this triple" on Ubuntu 16.10

Following this tutorial, I tried to compile a C program to WebAssembly by using the following command.
emcc hello.c -s WASM=1 -o hello.html
But I ecounter the "No available targets are compatible with this triple." problem.
$ emcc hello.c -s WASM=1 -o hello.html
WARNING root: LLVM version appears incorrect (seeing "(https://github.com/kripken/emscripten-fastcomp-clang/", expected "3.4")
INFO root: (Emscripten: Running sanity checks)
WARNING root: Assigning a non-existent settings attribute "WASM"
WARNING root: - did you mean one of ASM_JS?
WARNING root: - perhaps a typo in emcc's -s X=Y notation?
WARNING root: - (see src/settings.js for valid values)
/home/casper/Desktop/test/emsdk/clang/fastcomp/build_incoming_64/bin/lli: error creating EE: No available targets are compatible with this triple.
FAIL: Running the generated program failed!
How to solve it?
EMCC Version
$ emcc --version
emcc (Emscripten GCC-like replacement) 1.22.1 ()
Copyright (C) 2014 the Emscripten authors (see AUTHORS.txt)
This is free and open source software under the MIT license.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Basic Information
OS : Ubuntu 16.10
emcc Location: /usr/bin/emcc
You're running emcc version 1.22.1 which dates back from 8/7/2014, before WebAssembly was started.
emsdk in the instruction you followed must have installed a very recent emscripten version (this is what sdk-incoming-64bit from these instructions does: incoming is the latest branch), but an older emscripten is found in your system.
Run:
which emcc
echo $PATH
What do they say? I suspect you have an old emscripten lying in there. You probably also want to check and/or delete your ~/.emscripten file which may also contain obsolete information.
You can alter your path, delete the older emscripten, or invoke the SDK's emscripten using its absolute path (though this may fail later if other scripts pick up older versions along the path).
Don't forget (from the tutorial's instructions) to activate the SDK you've installed:
./emsdk activate --build=Release sdk-incoming-64bit binaryen-master-64bit
And run:
source ./emsdk_env.sh
This last command needs to be run for every shell session. If you open a new shell you need to re-source then SDK.

Gycwin: c compiler cannot create executables - tidalcycles installation

I'm trying to install tidalcycles (http://tidalcycles.org/getting_started.html), but i had problems running the cabal install tidal command.
Originally i had an issue due to windows10 compatibility, so I installed Cygwin and i tried to run the command from his shell. But then this occurs:
Andrea#Pc_di_Andrea ~
$ cabal install tidal
Resolving dependencies...
Configuring old-time-1.1.0.3...
Configuring network-2.6.2.1...
Failed to install old-time-1.1.0.3
Build log ( C:\Users\Andrea\AppData\Roaming\cabal\logs\old-time-1.1.0.3.log):
Configuring old-time-1.1.0.3...
configure: WARNING: unrecognized options: --with-compiler
checking for gcc... C:\PROGRA~1\HASKEL~1\802E01~1.1\mingw\bin\gcc.exe
checking whether the C compiler works... no
configure: error: in `/tmp/cabal-tmp-8957/old-time-1.1.0.3':
configure: error: C compiler cannot create executables
See `config.log' for more details
cabal: Leaving directory 'C:\cygwin\tmp\cabal-tmp-8957\old-time-1.1.0.3'
Failed to install network-2.6.2.1
Build log ( C:\Users\Andrea\AppData\Roaming\cabal\logs\network-2.6.2.1.log ):
Configuring network-2.6.2.1...
configure: WARNING: unrecognized options: --with-compiler
checking build system type... i686-pc-cygwin
checking host system type... i686-pc-cygwin
checking for gcc... C:\PROGRA~1\HASKEL~1\802E01~1.1\mingw\bin\gcc.exe
checking whether the C compiler works... no
configure: error: in `/tmp/cabal-tmp-8956/network-2.6.2.1':
configure: error: C compiler cannot create executables
See `config.log' for more details
cabal: Leaving directory 'C:\cygwin\tmp\cabal-tmp-8956\network-2.6.2.1'
cabal.exe: Error: some packages failed to install:
hosc-0.15 depends on network-2.6.2.1 which failed to install.
mersenne-random-pure64-0.2.0.5 depends on old-time-1.1.0.3 which failed to
install.
network-2.6.2.1 failed during the configure step. The exception was:
ExitFailure 77
old-time-1.1.0.3 failed during the configure step. The exception was:
ExitFailure 77
tidal-0.8 depends on old-time-1.1.0.3 which failed to install.
websockets-0.9.6.2 depends on network-2.6.2.1 which failed to install.
So, it says that the
configure: error: C compiler cannot create executables
is the problem. I'm running the 32bit version, and the c compiler should be installed, since i get this reply from the system:
Andrea#Pc_di_Andrea ~
$ echo; gcc --version; echo; g++ --version;
gcc (GCC) 5.4.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
g++ (GCC) 5.4.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
I'm a total newbie to this 'cygwin enviroment' and I apologize if my question is not appropriate, but I read some guides about this c compiler problem and i didn't understand what i'm doing wrong, at all.
Found the problem: I didn't complete Haskell installation editing the cabal config.file, with
extra-prog-path: C:\Program Files\Haskell Platform\8.0.1\msys\usr\bin
extra-lib-dirs: C:\Program Files\Haskell Platform\8.0.1\mingw\lib
extra-include-dirs: C:\Program Files\Haskell Platform\8.0.1\mingw\include+
as this source https://www.haskell.org/platform/ says.

linking clang address sanitizer on FreeBSD 10.1 Release

I'm trying to get address sanitizer working on FreeBSD 10.1 Release, but whenever I try to compile a program with -fsanitize=address I get undefined references to _asan_stack_malloc_1 etc, etc. I found
https://forums.freebsd.org/threads/gcc-clang-address-sanitizer.47985/ on google but the suggestion of adding -L/usr/local/lib -I/usr/local/include didn't resolve the linking issue. I tried the llvm binaries for FreeBSD but when I go to compile with that clang I get /usr/bin/../lib/clang/3.6.0/lib/freebsd/libclang_rt.asan-x86_64.a , no such file or directory. . Either way I'm not sure what library I need to link or where it is.
Below is the program I tried compiling and here is the command I used,
clang -fsanitize=address san.c
#include <stdio.h>
int main(void)
{
return 0;
}
As an alternative to building LLVM, as suggested in this answer on Unix SE, you can install llvm37 from ports, which supports AddressSanitizer, and build with that:
# pkg install llvm37
$ clang37 -fsanitize=address san.c
To use asan on FreeBSD you can build llvm with asan support as shown below or you can install from packages/ports like in Kevinoid's answer.
Step one, grab the latest stable llvm source.
fetch http://llvm.org/releases/3.9.0/llvm-3.9.0.src.tar.xz
Now uncompress the llvm source directory.
tar -xvf llvm-3.9.0.src.tar.xz
Next change directory to llvm and grab the clang source files.
cd llvm-3.9.0.src/tools && fetch http://llvm.org/releases/3.9.0/cfe-3.9.0.src.tar.xz
Uncompress clang.
tar -xvf cfe-3.9.0.src.tar.xz
Enter the projects directory and grab compiler-rt.
cd ../projects && fetch http://llvm.org/releases/3.9.0/compiler-rt-3.9.0.src.tar.xz
Uncompress compiler-rt.
tar -xvf compiler-rt-3.9.0.src.tar.xz
Goto the root llvm directory and make a build directory for cmake.
cd ../ && mkdir build && cd build
Use cmake to setup the llvm build.
cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON [-DLLVM_ENABLE_WERROR=ON] [-DLLVM_TARGETS_TO_BUILD=X86] -DBUILD_SHARED_LIBS=ON ../
Build llvm and go grab some tea, it will take a bit.
make -j12
If the build worked you should be left with clang with asan support. Make sure to remove the old compiler, /usr/bin/clang, /usr/bin/clang++ and /usr/bin/cc.
Then install the new clang by doing sudo make install. Finally you will probably want to link /usr/bin/cc to /usr/local/bin/clang by running sudo ln /usr/local/bin/clang /usr/bin/cc.
After doing all these steps you should be able to compile code with the -fsanitize=address compile option.

Resources