Why doesn't Codelite create a make file? - c++

I'm using Solus Linux with G++ and whenever I build the default console project in CodeLite I get the following output
/bin/sh -c '/usr/bin/make -j4 -e -f Makefile'
/bin/sh: /usr/bin/make: No such file or directory
====0 errors, 0 warnings====
I checked and make does not exist in /usr/bin in-fact, the most promising thing I found in this directory was a file called codelite-make
Here are the options I selected at project creation
Category: Console
Type: Simple executable (g++)
Compiler: GCC
Debugger: GNU gdb debugger
Build System: CodeLite Make Generator
Any help is greatly appreciated

You need to use your package manager for your linux OS to install make and now glibc and possibly other parts of your toolchain. CodeLite does not provide these.

Related

Compilation errors with M1 MacBook Pro and cmake

I have just got my new M1 MacBook Pro and am trying to compile a code base required for my university work. Here are the steps I have taken:
I set Terminal to always open using Rosetta.
Installed homebrew using /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Installed cmake using brew install cmake
Run cmake <path to source> (this works fine)
Run make (this fails)
Here is the error I get:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/stdlib.h:97:15: fatal error:
'stdlib.h' file not found
#include_next <stdlib.h>
I have tried uninstalling and re-installing Xcode and CommandLineTools to no avail.
When using the cmake gui app, I get a different error. I have it set to use CommandLineTools/SDKs/MacOsX11.0.sdk.
When running make after generating and configuring the build files using this cmake gui setup, I get this error:
-- The C compiler identification is AppleClang 12.0.0.12000032
-- The CXX compiler identification is AppleClang 12.0.0.12000032
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - broken
CMake Error at /Applications/CMake.app/Contents/share/cmake-3.18/Modules/CMakeTestCCompiler.cmake:66 (message):
The C compiler
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /Users/freyamurphy/nori/build/ext_build/src/tbb_p-build/CMakeFiles/CMakeTmp
If I run the command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc test.c (Simple hello world program) I get this error:
test.c:1:10: fatal error: 'stdio.h' file not found
#include "stdio.h"
But using cc test.c everything works fine. (This runs usr/bin/cc).
Seems to me there is perhaps an issue with Xcode. Has anyone had any similar issues or could give me some advice? It would be much appreciated.
Have you reopen Terminal after xcode installed? It's needed to set the environment variable SDKROOT.
Close and run again Terminal or open a new tab in Terminal.
Or run the following command in the current Terminal
export SDKROOT=$(xcrun --sdk macosx --show-sdk-path)
Also be sure the proper xcode toolchain is selected
# list available xcode toolchains
xcode-select -p
# select one of listed above
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

CMake can not find g++ compiler on Windows

I have a CMake project I want to compile with g++. The project compiles and runs on Linux. Now I am trying to get it working on Windows.
For that reason, I installed MinGW and added it to the PATH and I am using Git Bash. In order to force CMake to use g++ I added these env variables:
CC = C:\MinGW\bin\gcc
CXX = C:\MinGW\bin\g++
But when I run CMake it does not detect any compilers and tells me:
-- The C compiler identification is unkown
-- The CXX compiler identification is unkown
I created a super basic example on github which I would like to get running on Windows + MinGw: https://github.com/j-o-d-o/Basic-CMake-Project
How can I use the env variables in windows to force CMake to use g++ and gcc compiler?
I needed to add -G "MinGW Makefiles" to the CMake command.
I check if I am on Windows and if yes, I add the parameter to the CMake command in the shell script.
I also need to use mingw32-make instead of make when I am on Windows.
There are some other issues now, but it resolves the issue/question I have posted.

QT GCC Error During Cross Compile Setup

I have been working this problem for more than a week. I installed the free version of QT off the QT site. I am trying to set up a cross compile environment for a Beaglebone Black ARM 8 platform. I have set up the compiler options using GNU ARM 6.3.0 GNU compiler -- The same compiler that is on my BBB. I successfully created the cross-compile environment and the Beaglebone device. The connect test worked correctly as well.
Here is the simple C++ application that I am trying to compile,
#include <iostream>
using namespace std;
int main()
{
cout << "Hello World!" << endl;
return 0;
}
Here is what my QT gcc compile options look like,
Here is my kit setup,
Here is my device setup,
When I build the default QT simple application I get these errors,
Running Windows Runtime device detection.
C:/Qt/5.11.0/winrt_armv7_msvc2015/bin/winrtrunner.exe --list-devices
Found 2 Windows Runtime devices.
Running "C:\Program Files (x86)\CMake\bin\cmake.exe -E server "--pipe=\.\pipe{2e664e46-cacb-46ae-b680-ed9c235dc502}" --experimental" in C:\Users\Stephen\AppData\Local\Temp\QtCreator-WLEKuI\qtc-cmake-IDzcFnnJ.
Starting to parse CMake project, using: "-DCMAKE_CXX_COMPILER:STRING=C:/SysGCC/beaglebone-6.3.0/bin/arm-linux-gnueabihf-g++.exe", "-DCMAKE_C_COMPILER:STRING=C:/SysGCC/beaglebone-6.3.0/bin/arm-linux-gnueabihf-gcc.exe", "-DCMAKE_PREFIX_PATH:STRING=", "-DQT_QMAKE_EXECUTABLE:STRING=".
The C compiler identification is GNU 6.3.0
The CXX compiler identification is GNU 6.3.0
Check for working C compiler: C:/SysGCC/beaglebone-6.3.0/bin/arm-linux-gnueabihf-gcc.exe
Check for working C compiler: C:/SysGCC/beaglebone-6.3.0/bin/arm-linux-gnueabihf-gcc.exe -- broken
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.10/Modules/CMakeTestCCompiler.cmake:52 (message):
The C compiler
"C:/SysGCC/beaglebone-6.3.0/bin/arm-linux-gnueabihf-gcc.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/Stephen/AppData/Local/Temp/QtCreator-WLEKuI/qtc-cmake-IDzcFnnJ/CMakeFiles/CMakeTmp
Run Build Command:"C:/PROGRA~2/Ninja/ninja.exe" "cmTC_c3136"
[1/2] Building C object CMakeFiles/cmTC_c3136.dir/testCCompiler.c.obj
[2/2] Linking C executable cmTC_c3136.exe
FAILED: cmTC_c3136.exe
cmd.exe /C "cd . && C:\SysGCC\beaglebone-6.3.0\bin\arm-linux-gnueabihf-gcc.exe CMakeFiles/cmTC_c3136.dir/testCCompiler.c.obj -o cmTC_c3136.exe -Wl,--out-implib,libcmTC_c3136.dll.a -Wl,--major-image-version,0,--minor-image-version,0 && cd ."
c:/sysgcc/beaglebone-6.3.0/bin/../lib/gcc/arm-linux-gnueabihf/6/../../../../arm-linux-gnueabihf/bin/ld.exe: unrecognized option '--major-image-version'
c:/sysgcc/beaglebone-6.3.0/bin/../lib/gcc/arm-linux-gnueabihf/6/../../../../arm-linux-gnueabihf/bin/ld.exe: use the --help option for usage information
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
The build seems to issues a command to the GCC compiler suite to an executable called ld.exe. I verified the path to ld.exe and it is indeed in the directory and handles my "ld --version" command.The error messages show ld.exe '--major-image-version' and fails. ld.exe does not support --major-image-version. Not sure why it is issuing this command to ld.exe.
I know these compilers work as I have manually compiled this program using g++ 6.3.0 compiler. Any suggestions?
A make argument is wrong. Specifically:
unrecognized option '--major-image-version'
You should remove the argument "--major-image-version" from your project's Makefile LFLAGS.
On windows there are 3 makefiles, Makefile, Makefile.debug and Makefile.release
Remove the argument from the one matching your current build config.

Why do I get `undefined symbol: _Py_RefTotal` when debugging a program using a custom-built Python installation? (with Bazel)

I have built Python2.7 with --enable-shared and ensured that the RPATHs are correctly setup.
If I run the binary using bazel run -c dbg --run_under="gdbserver localhost:9999" and connect to it with CLion, it works, but then I do not find all of the source files I want.
I can run the binary with Run... under CLion, configuring it as bazel run.
However, if I run the binary with Debug... (still using bazel run) under CLion, I get the following error:
undefined symbol: _Py_RefTotal
How do I fix this?
I'm using Ubuntu 16.04, with system-distributed GDB (7.11.1). I built Python with the following flags (using https://stackoverflow.com/a/48175708/7829525 as a guide):
./configure --with-pydebug CFLAGS='-O0 -g' --enable-shared \
--prefix=~/.local/python/2.7.12-dbg \
LDFLAGS=-Wl,-rpath=~/.local/python/2.7.12-dbg/lib \
--with-ensurepip=upgrade
make -j install
Found that the issue was that the Bazel CLion plugin by default does not incorporate the parent's environment when debugging.
Here's the repro project I used for the following pics:
https://github.com/EricCousineau-TRI/repro/tree/b900846766fd1d4f8a8cdad268298767a917cacc/bug/clion_python_debug_shared
To fix this, you should ensure that incorporate your parent's environment into the debug executable:
This was done with CLion 2017.2.3, Bazel Plugin 2018.01.02.0.1, Bazel 0.10.1.
Note that if you're using GDB Python extensions (http://droettboom.com/blog/2015/11/20/gdb-python-extensions/), you may want to rebuild GDB with this version of Python:
git clone git://sourceware.org/git/binutils-gdb.git
git checkout gdb-7.11.1-release
./configure LIBS='-lpython2.7' LDFLAGS="-L~/.local/python/2.7.12-dbg/lib" --prefix ~/.local/python/2.7.12-dbg --with-python
make -j VERBOSE=1
make -C gdb install

Compiling gcc-4.8.1: "libmpc.so.2 cannot open shared object file download prerequisites"

Many people appear to have encountered this problem. The GNU website strongly recommends running
./contrib/download_prerequisites
in the source directory to avoid problems with linking MPC, MPFR and GMP. The following link contains the instructions I've followed: http://gcc.gnu.org/wiki/InstallingGCC which I've listed here:
tar xzf gcc-4.8.1.tar.gz
cd gcc-4.8.1
./contrib/download_prerequisites
cd ..
mkdir objdir
cd objdir
$PWD/../gcc-4.8.1/configure --prefix=$HOME/gcc-4.8.1-install
make
make install
The FAQ at this url: http://gcc.gnu.org/wiki/FAQ#configure_suffix claims that the compilation will have no problem finding MPC related files so long as they are located in a subdirectory of the gcc-4.8.1 source directory. Running
./contrib/downlaod_prerequisites
downloads MPC in the correct location, yet I still get this error after running make:
checking for x86_64-unknown-linux-gnu-gcc... /home/xxxx/gcc-4.8.1-build/./gcc/xgcc -B/home/xxxx/gcc-4.8.1-build/./gcc/ -B/home/xxxx/gcc-4.8.1-install/x86_64-unknown-linux-gnu/bin/ -B/home/xxxx/gcc-4.8.1-install/x86_64-unknown-linux-gnu/lib/ -isystem /home/xxxx/gcc-4.8.1-install/x86_64-unknown-linux-gnu/include -isystem /home/xxxx/gcc-4.8.1-install/x86_64-unknown-linux-gnu/sys-include
checking for suffix of object files... configure: error: in `/home/xxxx/gcc-4.8.1-build/x86_64-unknown-linux-gnu/libgcc':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
Opening /home/xxxx/gcc-4.8.1-build/x86_64-unknown-linux-gnu/libgcc/config.log reveals the following error:
/home/mgiamou/gcc-4.8.1-build/./gcc/cc1: error while loading shared libraries: libmpc.so.2: cannot open shared object file: No such file or directory
The GNU FAQs (http://gcc.gnu.org/wiki/FAQ#configure_suffix) say that this error is symptomatic of not having properly installed MPC. Any help would be much appreciated.
I didn't have the latest version of binutils installed. Be sure to have the latest version whenever installing the latest gcc.