I am using Netbeans and MacoSX and installed 64bit connector. On building I am getting following errors:
/usr/bin/make -f nbproject/Makefile-Debug.mk SUBPROJECTS= .build-conf
/usr/bin/make -f nbproject/Makefile-Debug.mk dist/Debug/GNU-MacOSX/inventory
mkdir -p build/Debug/GNU-MacOSX
rm -f build/Debug/GNU-MacOSX/addproduct.o.d
g++ -c -g -Iinclude -Iinclude -MMD -MP -MF build/Debug/GNU-MacOSX/addproduct.o.d -o build/Debug/GNU-MacOSX/addproduct.o addproduct.cpp
from addproduct.cpp:10:
In file included from include/mysql_connection.h:30,
include/cppconn/connection.h:31:29: warning: boost/variant.hpp: No such file or directory
In file included from addproduct.cpp:10:
include/mysql_connection.h:31:32: warning: boost/shared_ptr.hpp: No such file or directory
from addproduct.cpp:10:
In file included from include/mysql_connection.h:30,
include/cppconn/connection.h:41: error: 'boost' has not been declared
include/cppconn/connection.h:41: error: expected initializer before '<' token
include/cppconn/connection.h:43: error: 'ConnectPropertyVal' was not declared in this scope
include/cppconn/connection.h:43: error: template argument 2 is invalid
include/cppconn/connection.h:43: error: template argument 4 is invalid
include/cppconn/connection.h:43: error: invalid type in declaration before ';' token
In file included from addproduct.cpp:10:
include/mysql_connection.h:75: error: 'ConnectPropertyVal' is not a member of 'sql'
include/mysql_connection.h:75: error: 'ConnectPropertyVal' is not a member of 'sql'
include/mysql_connection.h:75: error: template argument 2 is invalid
include/mysql_connection.h:75: error: template argument 4 is invalid
include/mysql_connection.h:157: error: 'ConnectPropertyVal' is not a member of 'sql'
include/mysql_connection.h:157: error: 'ConnectPropertyVal' is not a member of 'sql'
include/mysql_connection.h:157: error: template argument 2 is invalid
include/mysql_connection.h:157: error: template argument 4 is invalid
include/mysql_connection.h:160: error: 'boost' has not been declared
include/mysql_connection.h:160: error: ISO C++ forbids declaration of 'shared_ptr' with no type
include/mysql_connection.h:160: error: expected ';' before '<' token
make[2]: *** [build/Debug/GNU-MacOSX/addproduct.o] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 538ms)
In Netbeans I am linking libmysqlcppconn.dylib only.
What files am I missing?
Why is it asking for BOOST? and which Boost Libs do I need to install?
mysql_connection.h includes #include <boost/shared_ptr.hpp>, you could either use latest versions of boost or modify below lines mysql_connection.h to use std::shared_ptr instead:
update
#include <boost/shared_ptr.hpp>
boost::shared_ptr< NativeAPI::NativeConnectionWrapper > proxy;
to
#include <memory>
std::shared_ptr< NativeAPI::NativeConnectionWrapper > proxy;
Have you read the documentation entitled "21.4.2. Installing MySQL Connector/C++ from Source"? Read the entire page carefully, then look for links specific to MacOSX...
Related
I am trying to migrate an old C/C++ sunstudio project to visual studio 2019. I need to build targets on a remote linux machine, so I cannot use the visual studio solution to build. After some unsuccessful attempts to use the old sunstudio makefiles, I have decided to use cmake to build the project.
The problem is that the code references includes with relative paths, like this:
(tkamain.cxx):
#include <ukernel/inc/U.h>
#include <monitor/inc/monitor.h>
I don't want to touch the code, so how can I setup CMake to build this project properly with these specific include statements?
The project structure looks like this.
tka
|-mod
||-monitor
||'-inc
||-feedutils
||'-inc
|'-ukernel
| '-inc
|-inc
||-foo.hxx
|'-bar.hxx
|-src
||-foo.cxx
||-bar.cxx
||-tkamain.cxx
|'-CMakeLists.txt (CMakeB)
'-CMakeLists.txt (CMakeA)
The CMakeLists.txt are newly created by me and are probably not correctly set up yet.
The CMakeA file contains this:
project(tka)
add_subdirectory(src)
The CMakeB file contains this:
include_directories(${PROJECT_SOURCE_DIR}/inc)
include_directories(${PROJECT_SOURCE_DIR}/mod)
add_executable(tkamain tkamain.cxx)
The commands in CMakeB seem not to be sufficient for my purposes, what am I missing? Or do I need more CMakeLists.txt files?
The errors I am getting look like this:
[ 50%] Building CXX object src/CMakeFiles/tkamain.dir/tkamain.cxx.o
/drive/new/home/mwe/.vs/tka/eb2f2a43-555a-3934-8996-0095b1bcc780/src/src/tkamain.cxx:11:27: error: ukernel/inc/U.h: No such file or directory
/drive/new/home/mwe/.vs/tka/eb2f2a43-555a-3934-8996-0095b1bcc780/src/src/tkamain.cxx:14:33: error: monitor/inc/monitor.h: No such file or directory
I have tried to give more specific include paths, like this, but that didn't help either:
include_directories(${PROJECT_SOURCE_DIR}/mod/ukernel/inc)
include_directories(${PROJECT_SOURCE_DIR}/mod/monitor/inc)
When I run make VERBOSE=1, I get the following:
/usr/local/bin/cmake -S/drive/new/home/mwe/.vs/tka/eb2f2a43-555a-3934-8996-0095b1bcc780/src -B/drive/new/home/mwe/.vs/tka/eb2f2a43-555a-3934-8996-0095b1bcc780/out/build/Linux-Debug-test --check-build-system CMakeFiles/Makefile.cmake 0
/usr/local/bin/cmake -E cmake_progress_start /drive/new/home/mwe/.vs/tka/eb2f2a43-555a-3934-8996-0095b1bcc780/out/build/Linux-Debug-test/CMakeFiles /drive/new/home/mwe/.vs/tka/eb2f2a43-555a-3934-8996-0095b1bcc780/out/build/Linux-Debug-test/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory `/drive/new/home/mwe/.vs/tka/eb2f2a43-555a-3934-8996-0095b1bcc780/out/build/Linux-Debug-test'
make -f src/CMakeFiles/tkamain.dir/build.make src/CMakeFiles/tkamain.dir/depend
make[2]: Entering directory `/drive/new/home/mwe/.vs/tka/eb2f2a43-555a-3934-8996-0095b1bcc780/out/build/Linux-Debug-test'
cd /drive/new/home/mwe/.vs/tka/eb2f2a43-555a-3934-8996-0095b1bcc780/out/build/Linux-Debug-test && /usr/local/bin/cmake -E cmake_depends "Unix Makefiles" /drive/new/home/mwe/.vs/tka/eb2f2a43-555a-3934-8996-0095b1bcc780/src /drive/new/home/mwe/.vs/tka/eb2f2a43-555a-3934-8996-0095b1bcc780/src/src /drive/new/home/mwe/.vs/tka/eb2f2a43-555a-3934-8996-0095b1bcc780/out/build/Linux-Debug-test /drive/new/home/mwe/.vs/tka/eb2f2a43-555a-3934-8996-0095b1bcc780/out/build/Linux-Debug-test/src /drive/new/home/mwe/.vs/tka/eb2f2a43-555a-3934-8996-0095b1bcc780/out/build/Linux-Debug-test/src/CMakeFiles/tkamain.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/drive/new/home/mwe/.vs/tka/eb2f2a43-555a-3934-8996-0095b1bcc780/out/build/Linux-Debug-test'
make -f src/CMakeFiles/tkamain.dir/build.make src/CMakeFiles/tkamain.dir/build
make[2]: Entering directory `/drive/new/home/mwe/.vs/tka/eb2f2a43-555a-3934-8996-0095b1bcc780/out/build/Linux-Debug-test'
[ 50%] Building CXX object src/CMakeFiles/tkamain.dir/tkamain.cxx.o
cd /drive/new/home/mwe/.vs/tka/eb2f2a43-555a-3934-8996-0095b1bcc780/out/build/Linux-Debug-test/src && /usr/bin/c++ -I/inc -g -o CMakeFiles/tkamain.dir/tkamain.cxx.o -c /drive/new/home/mwe/.vs/tka/eb2f2a43-555a-3934-8996-0095b1bcc780/src/src/tkamain.cxx
/drive/new/home/mwe/.vs/tka/eb2f2a43-555a-3934-8996-0095b1bcc780/src/src/tkamain.cxx:11:27: error: ukernel/inc/U.h: No such file or directory
/drive/new/home/mwe/.vs/tka/eb2f2a43-555a-3934-8996-0095b1bcc780/src/src/tkamain.cxx:12:30: error: ukernel/inc/Ulib.h: No such file or directory
/drive/new/home/mwe/.vs/tka/eb2f2a43-555a-3934-8996-0095b1bcc780/src/src/tkamain.cxx:13:31: error: ukernel/inc/UExit.h: No such file or directory
/drive/new/home/mwe/.vs/tka/eb2f2a43-555a-3934-8996-0095b1bcc780/src/src/tkamain.cxx:14:33: error: monitor/inc/monitor.h: No such file or directory
/drive/new/home/mwe/.vs/tka/eb2f2a43-555a-3934-8996-0095b1bcc780/src/src/tkamain.cxx:31:26: error: tkacontrol.hxx: No such file or directory
/drive/new/home/mwe/.vs/tka/eb2f2a43-555a-3934-8996-0095b1bcc780/src/src/tkamain.cxx:24: error: expected ',' or ';' before 'U_OS'
/drive/new/home/mwe/.vs/tka/eb2f2a43-555a-3934-8996-0095b1bcc780/src/src/tkamain.cxx: In function 'int main(int, char**)':
/drive/new/home/mwe/.vs/tka/eb2f2a43-555a-3934-8996-0095b1bcc780/src/src/tkamain.cxx:37: error: 'UkInit' was not declared in this scope
/drive/new/home/mwe/.vs/tka/eb2f2a43-555a-3934-8996-0095b1bcc780/src/src/tkamain.cxx:39: error: 'TkaControl' was not declared in this scope
/drive/new/home/mwe/.vs/tka/eb2f2a43-555a-3934-8996-0095b1bcc780/src/src/tkamain.cxx:39: error: 'tkaControl' was not declared in this scope
/drive/new/home/mwe/.vs/tka/eb2f2a43-555a-3934-8996-0095b1bcc780/src/src/tkamain.cxx:39: error: expected type-specifier before 'TkaControl'
/drive/new/home/mwe/.vs/tka/eb2f2a43-555a-3934-8996-0095b1bcc780/src/src/tkamain.cxx:39: error: expected ';' before 'TkaControl'
/drive/new/home/mwe/.vs/tka/eb2f2a43-555a-3934-8996-0095b1bcc780/src/src/tkamain.cxx:41: error: 'UExitHandler' was not declared in this scope
/drive/new/home/mwe/.vs/tka/eb2f2a43-555a-3934-8996-0095b1bcc780/src/src/tkamain.cxx:41: error: expected ';' before 'exithandler'
/drive/new/home/mwe/.vs/tka/eb2f2a43-555a-3934-8996-0095b1bcc780/src/src/tkamain.cxx:43: error: 'Monitor2Startup' was not declared in this scope
/drive/new/home/mwe/.vs/tka/eb2f2a43-555a-3934-8996-0095b1bcc780/src/src/tkamain.cxx:45: error: 'evalarg_error' was not declared in this scope
/drive/new/home/mwe/.vs/tka/eb2f2a43-555a-3934-8996-0095b1bcc780/src/src/tkamain.cxx:46: error: 'UEXIT_STOP' was not declared in this scope
/drive/new/home/mwe/.vs/tka/eb2f2a43-555a-3934-8996-0095b1bcc780/src/src/tkamain.cxx:46: error: 'UExitMsg' was not declared in this scope
/drive/new/home/mwe/.vs/tka/eb2f2a43-555a-3934-8996-0095b1bcc780/src/src/tkamain.cxx:49: error: 'UkMain' was not declared in this scope
/drive/new/home/mwe/.vs/tka/eb2f2a43-555a-3934-8996-0095b1bcc780/src/src/tkamain.cxx:50: error: 'Monitor2Exit' was not declared in this scope
/drive/new/home/mwe/.vs/tka/eb2f2a43-555a-3934-8996-0095b1bcc780/src/src/tkamain.cxx:59: error: 'UEXIT_STOP' was not declared in this scope
/drive/new/home/mwe/.vs/tka/eb2f2a43-555a-3934-8996-0095b1bcc780/src/src/tkamain.cxx:59: error: 'UExitMsg' was not declared in this scope
make[2]: *** [src/CMakeFiles/tkamain.dir/tkamain.cxx.o] Error 1
make[2]: Leaving directory `/drive/new/home/mwe/.vs/tka/eb2f2a43-555a-3934-8996-0095b1bcc780/out/build/Linux-Debug-test'
make[1]: *** [src/CMakeFiles/tkamain.dir/all] Error 2
make[1]: Leaving directory `/drive/new/home/mwe/.vs/tka/eb2f2a43-555a-3934-8996-0095b1bcc780/out/build/Linux-Debug-test'
make: *** [all] Error 2
With this:
# CMakeA
cmake_minimum_required(VERSION 3.8)
project(tka)
add_subdirectory(src)
# CMakeB
add_executable(tkamain tkamain.cxx)
target_include_directories(tkamain PUBLIC ${PROJECT_SOURCE_DIR}/inc)
target_include_directories(tkamain PUBLIC ${PROJECT_SOURCE_DIR}/mod)
When I run "cmake VERBOSE=1" I got the following output:
[ 50%] Building CXX object src/CMakeFiles/tkamain.dir/tkamain.cxx.o
cd /home/lma/tmp/stackoverflow/tka/src && /usr/bin/c++ -I/home/lma/tmp/stackoverflow/tka/inc -I/home/lma/tmp/stackoverflow/tka/mod -o CMakeFiles/tkamain.dir/tkamain.cxx.o -c /home/lma/tmp/stackoverflow/tka/src/tkamain.cxx
/home/lma/tmp/stackoverflow/tka/src/tkamain.cxx:1:10: fatal error: ukernel/inc/U.h: No such file or directory
#include <ukernel/inc/U.h>
^~~~~~~~~~~~~~~~~
compilation terminated.
As you can see, there's both directive
-I/home/lma/tmp/stackoverflow/tka/inc
-I/home/lma/tmp/stackoverflow/tka/mod
I propose you to start with the 2 little CMakeLists.txt I sent
And clean also all you cmake intermediate file.
I am trying to run some code copied from Windows Dev Center, but keep encountering an error over some unresolved identifiers. This maybe sound silly, but why would these lines cause this error:
CONDITION_VARIABLE BufferNotEmpty;
CONDITION_VARIABLE BufferNotFull;
And "not declared in this scope" on other lines similar to this:
SleepConditionVariableCS (&BufferNotFull, &BufferLock, INFINITE);
When I've included all the headers (or at least i think) necessary?
#include <mutex>
#include <condition_variable>
#include <cstdint>
#include <windows.h>
#include <stdlib.h>
#include <stdio.h>
#include <WinBase.h>
Running NetBeans with project configured to C++11 in case that changes anything. Thanks in advance if anyone has any suggestions!
EDIT:
Error output:
cd 'C:\Users\Linda\Documents\NetBeansProjects\CppApplication_2'
C:\MinGW\msys\1.0\bin\make.exe -f Makefile CONF=Debug
"/C/MinGW/msys/1.0/bin/make.exe" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make.exe[1]: Entering directory `/c/Users/Linda/Documents/NetBeansProjects/CppApplication_2'
"/C/MinGW/msys/1.0/bin/make.exe" -f nbproject/Makefile-Debug.mk dist/Debug/MinGW-Windows/cppapplication_2.exe
make.exe[2]: Entering directory `/c/Users/Linda/Documents/NetBeansProjects/CppApplication_2'
mkdir -p build/Debug/MinGW-Windows
rm -f "build/Debug/MinGW-Windows/conditional_var.o.d"
g++ -std=c++11 -c -g -std=c++11 -MMD -MP -MF "build/Debug/MinGW-Windows/conditional_var.o.d" -o build/Debug/MinGW-Windows/conditional_var.o conditional_var.cpp
conditional_var.cpp:20:1: error: 'CONDITION_VARIABLE' does not name a type
CONDITION_VARIABLE BufferNotEmpty;
^
conditional_var.cpp:21:1: error: 'CONDITION_VARIABLE' does not name a type
CONDITION_VARIABLE BufferNotFull;
^
conditional_var.cpp: In function 'DWORD ProducerThreadProc(PVOID)':
conditional_var.cpp:43:40: error: 'BufferNotFull' was not declared in this scope
SleepConditionVariableCS (&BufferNotFull, &BufferLock, INFINITE);
^
conditional_var.cpp:43:76: error: 'SleepConditionVariableCS' was not declared in this scope
SleepConditionVariableCS (&BufferNotFull, &BufferLock, INFINITE);
^
conditional_var.cpp:64:33: error: 'BufferNotEmpty' was not declared in this scope
WakeConditionVariable (&BufferNotEmpty);
^
conditional_var.cpp:64:47: error: 'WakeConditionVariable' was not declared in this scope
WakeConditionVariable (&BufferNotEmpty);
^
conditional_var.cpp: In function 'DWORD ConsumerThreadProc(PVOID)':
conditional_var.cpp:82:40: error: 'BufferNotEmpty' was not declared in this scope
SleepConditionVariableCS (&BufferNotEmpty, &BufferLock, INFINITE);
^
conditional_var.cpp:82:77: error: 'SleepConditionVariableCS' was not declared in this scope
SleepConditionVariableCS (&BufferNotEmpty, &BufferLock, INFINITE);
^
conditional_var.cpp:111:33: error: 'BufferNotFull' was not declared in this scope
WakeConditionVariable (&BufferNotFull);
^
conditional_var.cpp:111:46: error: 'WakeConditionVariable' was not declared in this scope
WakeConditionVariable (&BufferNotFull);
^
conditional_var.cpp: In function 'int main()':
conditional_var.cpp:124:35: error: 'BufferNotEmpty' was not declared in this scope
InitializeConditionVariable (&BufferNotEmpty);
^
conditional_var.cpp:124:49: error: 'InitializeConditionVariable' was not declared in this scope
InitializeConditionVariable (&BufferNotEmpty);
^
conditional_var.cpp:125:35: error: 'BufferNotFull' was not declared in this scope
InitializeConditionVariable (&BufferNotFull);
^
conditional_var.cpp:141:45: error: 'WakeAllConditionVariable' was not declared in this scope
WakeAllConditionVariable (&BufferNotFull);
^
make.exe[2]: *** [build/Debug/MinGW-Windows/conditional_var.o] Error 1
make.exe[2]: Leaving directory `/c/Users/Linda/Documents/NetBeansProjects/CppApplication_2'
make.exe[1]: *** [.build-conf] Error 2
make.exe[1]: Leaving directory `/c/Users/Linda/Documents/NetBeansProjects/CppApplication_2'
make.exe": *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 4s)
What happens if you add
#include <SDKDDKVer.h>
Before the #include <windows.h>?
The CONDITION_VARIABLE definition should be brought in by <windows.h>, but only if building against Vista-or-newer. <sdkddkver.h> should ensure you're always building against the newest target supported by the SDK.
If that doesn't help, or if <sdkddkver.h> isn't found, then it means that your build environment is using a very old, very stale SDK. I don't know what NetBeans/mingw uses for its Windows SDK, so it's quite plausible that they use a stale version.
If this proves to be the case then I think your best option would be to use Visual Studio 2015 or 2017 Community Edition along with the current Windows 10 SDK.
I'm trying to make my first program with cuda.
So I make this simple HelloWorld with guide of various pages.
#include <cstdlib>
#include <cstdio>
#include <cuda.h>
using namespace std;
__global__ void mykernel(void) {
}
int main(void) {
mykernel<<<1,1>>>();
printf("CPU Hello World!\n");
return 0;
}
But I am getting this output:
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory `/home/sebastian/Dropbox/Universidad/Trabajo_de_Grado_pregrado/Codigos/HelloWordCuda'
"/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/GNU-Linux-x86/hellowordcuda
make[2]: Entering directory `/home/sebastian/Dropbox/Universidad/Trabajo_de_Grado_pregrado/Codigos/HelloWordCuda'
mkdir -p build/Debug/GNU-Linux-x86
rm -f "build/Debug/GNU-Linux-x86/hellowordcuda.o.d"
g++ -c -g -I/usr/local/cuda-7.5/include -MMD -MP -MF "build/Debug/GNU-Linux-x86/hellowordcuda.o.d" -o build/Debug/GNU-Linux-x86/hellowordcuda.o hellowordcuda.cpp
hellowordcuda.cpp:19:1: error: ‘__global__’ does not name a type
__global__ void mykernel(void) {
^
hellowordcuda.cpp: In function ‘int main()’:
hellowordcuda.cpp:24:1: error: ‘mykernel’ was not declared in this scope
mykernel<<<1,1>>>();
^
hellowordcuda.cpp:24:11: error: expected primary-expression before ‘<’ token
mykernel<<<1,1>>>();
^
hellowordcuda.cpp:24:17: error: expected primary-expression before ‘>’ token
mykernel<<<1,1>>>();
^
hellowordcuda.cpp:24:19: error: expected primary-expression before ‘)’ token
mykernel<<<1,1>>>();
^
make[2]: *** [build/Debug/GNU-Linux-x86/hellowordcuda.o] Error 1
make[2]: Leaving directory `/home/sebastian/Dropbox/Universidad/Trabajo_de_Grado_pregrado/Codigos/HelloWordCuda'
make[1]: *** [.build-conf] Error 2
make[1]: Leaving directory `/home/sebastian/Dropbox/Universidad/Trabajo_de_Grado_pregrado/Codigos/HelloWordCuda'
make: *** [.build-impl] Error 2
I'm sorry for making a question so simple but I just don't find any answer for this.
Thanks a lot, any help would be greatly appreciated!
There are two things you need to do to make this work:
use the CUDA compiler driver nvcc to steer compilation of the code
rename hellowordcuda.cpp to hellowordcuda.cu when passing the code to nvcc
The second point is necessary because nvcc uses the file extension to steer compilation, and if you code has a .cc or .cpp file extension, it will just pass the code to the host compiler and the same compilation errors will result
In guide also below lines are mentioned,
$ nvcc hello.cu
$ a.out
Hello World!
Please change g++ to nvcc in your Makefile.
It appears you're building directly with g++. You need to use NVidia's compiler (nvcc) to use CUDA, and make sure it knows to process the file as CUDA C. This can be achieved by changing the extension to .cu, or by playing around with compilation options which specify the file & processing type. I recommend the former.
I am attempting to compile fbexport (Firebird export/import tool) under FreeBSD10. GCC, binutils are installed. In make.conf:
CC=gcc47
CXX=g++47
CPP=cpp47
USE_GCC=any
But cd /tmp/fbexport-1.90 && make generate error:
# make
g++ -c -O1 -DIBPP_LINUX -DIBPP_GCC -Iibpp -o fbcopy/args.o fbcopy/args.cpp
make: exec(g++) failed (No such file or directory)
*** Error code 1
Stop.
make: stopped in /tmp/fbexport-1.90
Then I changed Makefile and replaced g++ with g++47, but error:
# make exe/fbexport
g++47 -c -O1 -DIBPP_LINUX -DIBPP_GCC -Iibpp -o fbexport/ParseArgs.o fbexport/ParseArgs.cpp
g++47 -c -O1 -DIBPP_LINUX -DIBPP_GCC -Iibpp -o fbexport/FBExport.o fbexport/FBExport.cpp
fbexport/FBExport.cpp: In member function 'std::string FBExport::CreateHumanString(IBPP::Statement&, int)':
fbexport/FBExport.cpp:339:31: error: 'gcvt' was not declared in this scope
fbexport/FBExport.cpp: In member function 'bool FBExport::CreateString(IBPP::Statement&, int, std::string&)':
fbexport/FBExport.cpp:452:31: error: 'gcvt' was not declared in this scope
*** Error code 1
Stop.
make: stopped in /tmp/fbexport-1.90
So, need some help.
I am trying to install the gcc-4.8.2 compiler on a remote Debian 7 system, to which I have no root privileges, but only a ssh access. I figured out that the simplest way would be to compile the compiler from source.
I am following this short installation manual from the GCC webpage.
Basically I did the most simple installation, which is summarized at the bottom of the page:
tar xzf gcc-4.8.2.tar.gz
cd gcc-4.8.2
./contrib/download_prerequisites
cd ..
mkdir objdir
cd objdir
$PWD/../gcc-4.8.2/configure --prefix=$HOME/gcc-4.8.2 --enable-languages=c++
make
with the small exception that I did not run the ./contrib/download_prerequisites script on the remote machine because of firewall restrictions. Instead I ran it on my local machine, then compressed the entire folder back into gcc-4.8.2.tar.gz and scp'd it to the remote machine. There I re-created the symbolic links to the prerequisite libraries (gmp,...) and ran make. After several seconds I receive incredible errors:
In file included from ./tm.h:19:0,
from ../../gcc-4.8.2/gcc/c/c-lang.c:24:
./options.h:4078:2: error: #error too many masks for ix86_isa_flags
In file included from ../../gcc-4.8.2/gcc/tree.h:26:0,
from ../../gcc-4.8.2/gcc/c/c-lang.c:25:
../../gcc-4.8.2/gcc/statistics.h:25:2: error: #error GATHER_STATISTICS must be defined
In file included from ../../gcc-4.8.2/gcc/system.h:268:0,
from ../../gcc-4.8.2/gcc/c/c-lang.c:22:
../../gcc-4.8.2/gcc/hwint.h:16:39: error: division by zero in #if
../../gcc-4.8.2/gcc/hwint.h:16:39: error: division by zero in #if
../../gcc-4.8.2/gcc/hwint.h:16:39: error: division by zero in #if
../../gcc-4.8.2/gcc/hwint.h:16:39: error: division by zero in #if
../../gcc-4.8.2/gcc/hwint.h:16:39: error: division by zero in #if
../../gcc-4.8.2/gcc/hwint.h:16:39: error: division by zero in #if
../../gcc-4.8.2/gcc/hwint.h:16:39: error: division by zero in #if
../../gcc-4.8.2/gcc/hwint.h:16:39: error: division by zero in #if
../../gcc-4.8.2/gcc/hwint.h:16:39: error: division by zero in #if
../../gcc-4.8.2/gcc/hwint.h:16:39: error: division by zero in #if
../../gcc-4.8.2/gcc/hwint.h:16:39: error: division by zero in #if
../../gcc-4.8.2/gcc/hwint.h:16:39: error: division by zero in #if
In file included from ../../gcc-4.8.2/gcc/tree.h:29:0,
from ../../gcc-4.8.2/gcc/c/c-lang.c:25:
../../gcc-4.8.2/gcc/real.h:103:9: error: #error "REAL_WIDTH > 6 not supported"
In file included from ../../gcc-4.8.2/gcc/c-family/c-common.h:24:0,
from ../../gcc-4.8.2/gcc/c/c-tree.h:23,
from ../../gcc-4.8.2/gcc/c/c-lang.c:26:
../../gcc-4.8.2/gcc/../libcpp/include/cpplib.h:265:3: error: #error "Cannot find a least-32-bit signed integer type"
In file included from ../../gcc-4.8.2/gcc/c/c-lang.c:22:0:
../../gcc-4.8.2/gcc/system.h:500:34: error: declaration of C function ‘const char* strsignal(int)’ conflicts with
In file included from /usr/include/c++/4.7/cstring:44:0,
from ../../gcc-4.8.2/gcc/system.h:205,
from ../../gcc-4.8.2/gcc/c/c-lang.c:22:
/usr/include/string.h:566:14: error: previous declaration ‘char* strsignal(int)’ here
In file included from ../../gcc-4.8.2/gcc/system.h:645:0,
from ../../gcc-4.8.2/gcc/c/c-lang.c:22:
../../gcc-4.8.2/gcc/../include/libiberty.h:110:36: error: new declaration ‘char* basename(const char*)’
In file included from /usr/include/c++/4.7/cstring:44:0,
from ../../gcc-4.8.2/gcc/system.h:205,
from ../../gcc-4.8.2/gcc/c/c-lang.c:22:
/usr/include/string.h:603:28: error: ambiguates old declaration ‘const char* basename(const char*)’
In file included from ../../gcc-4.8.2/gcc/tree.h:27:0,
from ../../gcc-4.8.2/gcc/c/c-lang.c:25:
../../gcc-4.8.2/gcc/vec.h: In static member function ‘static void va_heap::reserve(vec<T, va_heap, vl_embed>*&, unsigned int, bool)’:
../../gcc-4.8.2/gcc/vec.h:295:7: error: ‘GATHER_STATISTICS’ was not declared in this scope
../../gcc-4.8.2/gcc/vec.h:303:7: error: ‘GATHER_STATISTICS’ was not declared in this scope
../../gcc-4.8.2/gcc/vec.h: In static member function ‘static void va_heap::release(vec<T, va_heap, vl_embed>*&)’:
../../gcc-4.8.2/gcc/vec.h:317:7: error: ‘GATHER_STATISTICS’ was not declared in this scope
In file included from ../../gcc-4.8.2/gcc/tree.h:29:0,
from ../../gcc-4.8.2/gcc/c/c-lang.c:25:
../../gcc-4.8.2/gcc/real.h: At global scope:
../../gcc-4.8.2/gcc/real.h:51:21: error: ‘SIZEOF_LONG’ was not declared in this scope
../../gcc-4.8.2/gcc/real.h:51:21: error: ‘SIZEOF_LONG’ was not declared in this scope
../../gcc-4.8.2/gcc/real.h:76:31: error: ‘SIZEOF_LONG’ was not declared in this scope
../../gcc-4.8.2/gcc/real.h:76:31: error: ‘SIZEOF_LONG’ was not declared in this scope
../../gcc-4.8.2/gcc/real.h:76:31: error: ‘SIZEOF_LONG’ was not declared in this scope
../../gcc-4.8.2/gcc/real.h:76:31: error: ‘SIZEOF_LONG’ was not declared in this scope
In file included from ../../gcc-4.8.2/gcc/c-family/c-common.h:24:0,
from ../../gcc-4.8.2/gcc/c/c-tree.h:23,
from ../../gcc-4.8.2/gcc/c/c-lang.c:26:
../../gcc-4.8.2/gcc/../libcpp/include/cpplib.h:267:35: error: expected initializer before ‘cppchar_t’
../../gcc-4.8.2/gcc/../libcpp/include/cpplib.h:268:9: error: ‘CPPCHAR_SIGNED_T’ does not name a type
../../gcc-4.8.2/gcc/../libcpp/include/cpplib.h:777:8: error: ‘cppchar_t’ does not name a type
../../gcc-4.8.2/gcc/../libcpp/include/cpplib.h:788:8: error: ‘cppchar_t’ does not name a type
../../gcc-4.8.2/gcc/../libcpp/include/cpplib.h:966:8: error: ‘cppchar_t’ does not name a type
make[3]: *** [c/c-lang.o] Error 1
make[3]: Leaving directory `/home/mdrozdik/gccbuild/gcc'
make[2]: *** [all-stage1-gcc] Error 2
make[2]: Leaving directory `/home/mdrozdik/gccbuild'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/home/mdrozdik/gccbuild'
make: *** [all] Error 2
I am compiling with gcc 4.7.2-5 on Debian.
On the local machine there is Ubuntu 13.10 with gcc 4.7.3 and the build seems fine so far (still running).
Please, what could be the cause of these errors?
EDIT:
I checked the /home/mdrozdik/gccbuild/libcpp/config.log file. It is very longm but in two places there are these errors:
configure:3086: gcc -V >&5
gcc: error: unrecognized command line option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:3097: $? = 4
configure:3086: gcc -qversion >&5
gcc: error: unrecognized command line option '-qversion'
gcc: fatal error: no input files
compilation terminated.
configure:3097: $? = 4
But the log continues for several pages nevertheless.
I had a similar problem (gcc 4.8.3) and this solved it: g++ 4.7.1 compilation error : conflicting types for ‘strsignal’
The solution was to unset a bunch of C compiler flags (CPATH, etc.)
https://stackoverflow.com/users/1224886/tsbertalan reported this worked for him (and it's what I used):
unset LIBRARY_PATH CPATH C_INCLUDE_PATH PKG_CONFIG_PATH CPLUS_INCLUDE_PATH INCLUDE