Cannot compile MySQL++ - mysql

I am trying to compile MySQL++ 3.1.0 with the command:
mingw32-make -f Makefile.mingw
After a set of files gets compiled (e.g. beemutex.cpp, cmdline.cpp, connection.cpp, ...), I get these errors:
g++ -c -o mysqlpp_sql_buffer.o -g -mthreads -DUNICODE -D_UNICODE -DMYSQLPP_NO_DLL -DHAVE_MYSQL_SSL_SET -I"C:\Program Files\MySQL\MySQL Server 5.5\include" -MT
mysqlpp_sql_buffer.o -MFmysqlpp_sql_buffer.o.d -MD -MP lib/sql_buffer.cpp
In file included from lib/sql_buffer.h:31:0,
from lib/sql_buffer.cpp:26:
lib/refcounted.h:258:2: error: 'size_t' does not name a type
lib/refcounted.h: In constructor 'mysqlpp::RefCountedPointer<T, Destroyer>::RefCountedPointer()':
lib/refcounted.h:89:2: error: class 'mysqlpp::RefCountedPointer<T, Destroyer>' does not have any field named 'refs_'
lib/refcounted.h: In constructor 'mysqlpp::RefCountedPointer<T, Destroyer>::RefCountedPointer(T*)':
lib/refcounted.h:100:2: error: class 'mysqlpp::RefCountedPointer<T, Destroyer>' does not have any field named 'refs_'
lib/refcounted.h:104:4: error: 'refs_' was not declared in this scope
lib/refcounted.h:104:16: error: expected type-specifier before 'size_t'
lib/refcounted.h:104:16: error: expected ';' before 'size_t'
lib/refcounted.h: In constructor 'mysqlpp::RefCountedPointer<T, Destroyer>::RefCountedPointer(const ThisType&)':
lib/refcounted.h:112:2: error: class 'mysqlpp::RefCountedPointer<T, Destroyer>' does not have any field named 'refs_'
lib/refcounted.h:115:8: error: 'refs_' was not declared in this scope
lib/refcounted.h: In destructor 'mysqlpp::RefCountedPointer<T, Destroyer>::~RefCountedPointer()':
lib/refcounted.h:125:7: error: 'refs_' was not declared in this scope
lib/refcounted.h: In member function 'void mysqlpp::RefCountedPointer<T, Destroyer>::swap(mysqlpp::RefCountedPointer<T, Destroyer>::ThisType&)':
lib/refcounted.h:246:13: error: 'refs_' was not declared in this scope
mingw32-make: *** [mysqlpp_sql_buffer.o] Error 1
Something could be wrong in my configuration, but I can't find what. It seems strange that it cannot find, e.g., size_t.
Thank you!
Platform:
Windows 7
MinGW 2011.09 / GCC 4.6.1
MySQL 5.5
mysql++ 3.1.0

Changing size_t() with std::size_t() in refcounted.h solved the problem. It now compiles.
I still have linking problems, but they should be different issues.

Related

Error during compilation C code generated by Cython bad reloc address 0x0 in section `.data'

I'm trying to compile C code generated from Python code (hello world) and I'm stuck on one error.
I'm using mingw32-w64. After many errors now I'm using this command
gcc -DMS_WIN64 -I Python38\include -o test.exe test.c -lpython38 -lm -L Python38\libs -shared -Wl,--enable-auto-image-base -Wl,--enable-auto-import
But I'm getting error
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0x28c): undefined reference to `__imp_PyExc_ImportError'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0x307): undefined reference to `__imp__Py_NoneStruct'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0x34c): undefined reference to `__imp_PyExc_AttributeError'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0x59c): undefined reference to `__imp_PyExc_RuntimeError'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0xb51): undefined reference to `__imp_PyExc_ImportError'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0xc23): undefined reference to `__imp_PyExc_NameError'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0xcb9): undefined reference to `__imp__Py_CheckRecursionLimit'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0xd22): undefined reference to `__imp__Py_CheckRecursionLimit'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0xd32): undefined reference to `__imp__Py_CheckRecursionLimit'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0xd40): undefined reference to `__imp__Py_CheckRecursionLimit'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0xd8a): undefined reference to `__imp_PyExc_SystemError'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0xfc4): undefined reference to `__imp__Py_FalseStruct'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0xfcd): undefined reference to `__imp__Py_TrueStruct'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0x101f): undefined reference to `__imp__Py_FalseStruct'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0x1037): undefined reference to `__imp__Py_FalseStruct'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0x1044): undefined reference to `__imp__Py_TrueStruct'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0x17c0): undefined reference to `__imp_PyModule_Type'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0x17d8): undefined reference to `__imp_PyModule_Type'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0x18d4): undefined reference to `__imp_PyBaseObject_Type'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0x1e92): undefined reference to `__imp_PyExc_DeprecationWarning'
C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o:test.c:(.text+0x1ee9): undefined reference to `__imp_PyExc_TypeError'
c:/users/ja/documents/winbuilds/bin/../lib64/gcc/x86_64-w64-mingw32/4.8.3/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\Ja\AppData\Local\Temp\ccqKHihT.o: bad reloc address 0x0 in section `.data'
collect2.exe: error: ld returned 1 exit status
Using Python 3.8.4 x86_64-w64-mingw32 Windows 10

ebtables.c:61:3: error: implicit declaration of function 'xt_compat_calc_jump' [-Werror=implicit-function-declaration]

I am getting the following exception while building the recovery for a lineageos project and need some help diagnosing and resolving the issue
Device tree:= https://github.com/darran-kelinske-fivestars/android_device_lenovo_tb8504f/tree/lineage-15.1
Vendor tree:= https://github.com/darran-kelinske-fivestars/android_vendor_lenovo_tb8504f/tree/lineage-15.1
Kernel source:= https://github.com/darran-kelinske-fivestars/android_kernel_lenovo_tb8504f/tree/lineage-15.1
ROM Source:= https://github.com/LineageOS/android
Command: source build/envsetup.sh && breakfast tb8504f && repo sync --force-sync -q -j6 && mka recoveryimage -j6 | tee recovery.log
../../../../../../kernel/lenovo/msm8917/net/bridge/netfilter/ebtables.c: In function 'ebt_standard_compat_from_user':
../../../../../../kernel/lenovo/msm8917/net/bridge/netfilter/ebtables.c:61:3: error: implicit declaration of function 'xt_compat_calc_jump' [-Werror=implicit-function-declaration]
v += xt_compat_calc_jump(NFPROTO_BRIDGE, v);
^
../../../../../../kernel/lenovo/msm8917/net/bridge/netfilter/ebtables.c: At top level:
../../../../../../kernel/lenovo/msm8917/net/bridge/netfilter/ebtables.c:76:15: error: variable 'ebt_standard_target' has initializer but incomplete type
static struct xt_target ebt_standard_target = {
^
../../../../../../kernel/lenovo/msm8917/net/bridge/netfilter/ebtables.c:77:2: error: unknown field 'name' specified in initializer
.name = "standard",
^
../../../../../../kernel/lenovo/msm8917/net/bridge/netfilter/ebtables.c:77:2: warning: excess elements in struct initializer
error, forbidden warning: ebtables.c:77
CC net/core/gen_estimator.o
/home/lineageos/kernel/lenovo/msm8917/scripts/Makefile.build:257: recipe for target 'net/bridge/netfilter/ebtables.o' failed
make[4]: *** [net/bridge/netfilter/ebtables.o] Error 1
/home/lineageos/kernel/lenovo/msm8917/scripts/Makefile.build:402: recipe for target 'net/bridge/netfilter' failed
make[3]: *** [net/bridge/netfilter] Error 2
/home/lineageos/kernel/lenovo/msm8917/scripts/Makefile.build:402: recipe for target 'net/bridge' failed
make[2]: *** [net/bridge] Error 2
make[2]: *** Waiting for unfinished jobs....
Full log:
https://pastebin.com/v2ZsfRuc
I resolved this issue by replacing the source in the include directory of this project with the include directory of another project.
I replaced the source with the source from this directory:
https://github.com/HighwayStar/android_kernel_lenovo_tb8704/tree/tab4-8plus-LA.UM.5.6.r1-0/include

Gradle error with Android-studio and googleMap api

I created a simple project to test Google Api under android studio , but I have this error I tried to correct it by adding maps.jar to librairies of project structure no way :
Information:Compilation completed with 12 errors and 0 warnings in 17 sec
Information:12 errors
Information:0 warnings
/home/phenix-dz/AndroidStudioProjects/Geolocalisation/Geolocalisation/src/main/java/com/example/geolocalisation/MainActivity.java
Error:Error:line (4)Gradle: error: package com.google.android.maps does not exist
Error:Error:line (5)Gradle: error: package com.google.android.maps does not exist
Error:Error:line (6)Gradle: error: package com.google.android.maps does not exist
Error:Error:line (9)Gradle: error: cannot find symbol class MapActivity
Error:Error:line (11)Gradle: error: cannot find symbol class MapView
Error:Error:line (12)Gradle: error: cannot find symbol class MapController
Error:Error:line (16)Gradle: error: cannot find symbol variable super
Error:Error:line (17)Gradle: error: cannot find symbol method setContentView(int)
Error:Error:line (19)Gradle: error: cannot find symbol class MapView
Error:Error:line (19)Gradle: error: cannot find symbol method findViewById(int)
Error:Error:line (14)Gradle: error: method does not override or implement a method from a supertype
Error:Error:line (25)Gradle: error: method does not override or implement a method from a supertype
also I tried to add this code :
apply plugin: "java"
dependencies {
compile files('/home/phenix-dz/android-studio/sdk/add-ons/google_apis-671458-mac-x86/libs/maps.jar')
}
in build.gradle file but it gives me a same error.
Thanks

Installing db-mysql

I just started getting into node.js and want to use node.js together with my existing PHP/MySQL stack running on MAMP.
Problem: My existing data are already in the MySQL database that starts with MAMP, and I want to access them from node.js. I have decided on using db-mysql driver and so to install it, I specified my MYSQL_CONFIG environment by typing in the terminal
export MYSQL_CONFIG=/Applications/MAMP/Library/bin/mysql_config
npm install db-mysql
Then comes the error messages:
> db-mysql#0.7.6 install /Users/x/mywebsite/node_modules/db-mysql
> node-waf configure build
Checking for program g++ or c++ : /usr/bin/g++
Checking for program cpp : /usr/bin/cpp
Checking for program ar : /usr/bin/ar
Checking for program ranlib : /usr/bin/ranlib
Checking for g++ : ok
Checking for node path : not found
Checking for node prefix : ok /usr/local
Checking for program mysql_config : /Applications/MAMP/Library/bin/mysql_config
Checking for library mysqlclient_r : Missing libmysqlclient_r
'configure' finished successfully (0.571s)
Waf: Entering directory `/Users/x/mywebsite/node_modules/db-mysql/build'
[ 1/12] cxx: lib/node-db/binding.cc -> build/Release/lib/node-db/binding_1.o
[ 2/12] cxx: lib/node-db/connection.cc -> build/Release/lib/node-db/connection_1.o
[ 3/12] cxx: lib/node-db/events.cc -> build/Release/lib/node-db/events_1.o
[ 4/12] cxx: lib/node-db/exception.cc -> build/Release/lib/node-db/exception_1.o
[ 5/12] cxx: lib/node-db/query.cc -> build/Release/lib/node-db/query_1.o
[ 6/12] cxx: lib/node-db/result.cc -> build/Release/lib/node-db/result_1.o
[ 7/12] cxx: src/connection.cc -> build/Release/src/connection_1.o
In file included from ../src/connection.cc:2:
../src/./connection.h:5:19: error: mysql.h: No such file or directory
In file included from ../src/./connection.h:8,
from ../src/connection.cc:2:
../src/././result.h:16: error: expected ‘,’ or ‘...’ before ‘&’ token
../src/././result.h:16: error: ISO C++ forbids declaration of ‘MYSQL_FIELD’ with no type
../src/././result.h:28: error: expected `)' before ‘*’ token
../src/././result.h:54: error: ISO C++ forbids declaration of ‘MYSQL’ with no type
../src/././result.h:54: error: expected ‘;’ before ‘*’ token
../src/././result.h:55: error: ISO C++ forbids declaration of ‘MYSQL_RES’ with no type
../src/././result.h:55: error: expected ‘;’ before ‘*’ token
In file included from ../src/connection.cc:2:
../src/./connection.h:43: error: ISO C++ forbids declaration of ‘MYSQL’ with no type
../src/./connection.h:43: error: expected ‘;’ before ‘*’ token
../src/connection.cc: In constructor ‘node_db_mysql::Connection::Connection()’:
../src/connection.cc:11: error: class ‘node_db_mysql::Connection’ does not have any field named ‘connection’
../src/connection.cc: In member function ‘virtual bool node_db_mysql::Connection::isAlive(bool)’:
../src/connection.cc:57: error: ‘class node_db_mysql::Connection’ has no member named ‘connection’
../src/connection.cc:57: error: ‘mysql_ping’ was not declared in this scope
../src/connection.cc: In member function ‘virtual void node_db_mysql::Connection::open()’:
../src/connection.cc:65: error: ‘class node_db_mysql::Connection’ has no member named ‘connection’
../src/connection.cc:65: error: ‘mysql_init’ was not declared in this scope
../src/connection.cc:66: error: ‘class node_db_mysql::Connection’ has no member named ‘connection’
../src/connection.cc:71: error: ‘class node_db_mysql::Connection’ has no member named ‘connection’
../src/connection.cc:71: error: ‘MYSQL_SET_CHARSET_NAME’ was not declared in this scope
../src/connection.cc:71: error: ‘mysql_options’ was not declared in this scope
../src/connection.cc:75: error: ‘class node_db_mysql::Connection’ has no member named ‘connection’
../src/connection.cc:75: error: ‘MYSQL_OPT_COMPRESS’ was not declared in this scope
../src/connection.cc:75: error: ‘mysql_options’ was not declared in this scope
../src/connection.cc:79: error: ‘class node_db_mysql::Connection’ has no member named ‘connection’
../src/connection.cc:79: error: ‘MYSQL_INIT_COMMAND’ was not declared in this scope
../src/connection.cc:79: error: ‘mysql_options’ was not declared in this scope
../src/connection.cc:83: error: ‘class node_db_mysql::Connection’ has no member named ‘connection’
[ 8/12] cxx: src/mysql.cc -> build/Release/src/mysql_1.o
../src/connection.cc:83: error: ‘MYSQL_OPT_READ_TIMEOUT’ was not declared in this scope
../src/connection.cc:83: error: ‘mysql_options’ was not declared in this scope
../src/connection.cc:90: error: ‘class node_db_mysql::Connection’ has no member named ‘connection’
../src/connection.cc:90: error: ‘MYSQL_OPT_SSL_VERIFY_SERVER_CERT’ was not declared in this scope
../src/connection.cc:90: error: ‘mysql_options’ was not declared in this scope
../src/connection.cc:93: error: ‘class node_db_mysql::Connection’ has no member named ‘connection’
../src/connection.cc:93: error: ‘MYSQL_OPT_CONNECT_TIMEOUT’ was not declared in this scope
../src/connection.cc:97: error: ‘class node_db_mysql::Connection’ has no member named ‘connection’
../src/connection.cc:97: error: ‘MYSQL_OPT_WRITE_TIMEOUT’ was not declared in this scope
../src/connection.cc:101: error: ‘class node_db_mysql::Connection’ has no member named ‘connection’
../src/connection.cc:108: error: ‘mysql_real_connect’ was not declared in this scope
../src/connection.cc:116: error: ‘class node_db_mysql::Connection’ has no member named ‘connection’
../src/connection.cc:116: error: ‘mysql_error’ was not declared in this scope
../src/connection.cc: In member function ‘virtual void node_db_mysql::Connection::close()’:
../src/connection.cc:122: error: ‘class node_db_mysql::Connection’ has no member named ‘connection’
../src/connection.cc:122: error: ‘mysql_close’ was not declared in this scope
../src/connection.cc: In member function ‘virtual std::string node_db_mysql::Connection::escape(const std::string&) const’:
../src/connection.cc:133: error: ‘const class node_db_mysql::Connection’ has no member named ‘connection’
../src/connection.cc:133: error: ‘mysql_real_escape_string’ was not declared in this scope
../src/connection.cc: In member function ‘virtual std::string node_db_mysql::Connection::version() const’:
../src/connection.cc:141: error: ‘const class node_db_mysql::Connection’ has no member named ‘connection’
../src/connection.cc:141: error: ‘mysql_get_server_info’ was not declared in this scope
../src/connection.cc: In member function ‘virtual node_db::Result* node_db_mysql::Connection::query(const std::string&) const’:
../src/connection.cc:150: error: ‘const class node_db_mysql::Connection’ has no member named ‘connection’
../src/connection.cc:150: error: ‘mysql_real_query’ was not declared in this scope
../src/connection.cc:151: error: ‘const class node_db_mysql::Connection’ has no member named ‘connection’
../src/connection.cc:151: error: ‘mysql_error’ was not declared in this scope
../src/connection.cc:154: error: ‘const class node_db_mysql::Connection’ has no member named ‘connection’
In file included from ../src/./mysql.h:7,
from ../src/mysql.cc:2:
../src/././connection.h:5:19: error: mysql.h: No such file or directory
In file included from ../src/././connection.h:8,
from ../src/./mysql.h:7,
from ../src/mysql.cc:2:
../src/./././result.h:16: error: expected ‘,’ or ‘...’ before ‘&’ token
../src/./././result.h:16: error: ISO C++ forbids declaration of ‘MYSQL_FIELD’ with no type
../src/./././result.h:28: error: expected `)' before ‘*’ token
../src/./././result.h:54: error: ISO C++ forbids declaration of ‘MYSQL’ with no type
../src/./././result.h:54: error: expected ‘;’ before ‘*’ token
../src/./././result.h:55: error: ISO C++ forbids declaration of ‘MYSQL_RES’ with no type
../src/./././result.h:55: error: expected ‘;’ before ‘*’ token
In file included from ../src/./mysql.h:7,
from ../src/mysql.cc:2:
../src/././connection.h:43: error: ISO C++ forbids declaration of ‘MYSQL’ with no type
../src/././connection.h:43: error: expected ‘;’ before ‘*’ token
Waf: Leaving directory `/Users/x/mywebsite/node_modules/db-mysql/build'
Build failed:
-> task failed (err #1):
{task: cxx connection.cc -> connection_1.o}
-> task failed (err #1):
{task: cxx mysql.cc -> mysql_1.o}
npm ERR! error installing db-mysql#0.7.6 Error: db-mysql#0.7.6 install: `node-waf configure build`
npm ERR! error installing db-mysql#0.7.6 `sh "-c" "node-waf configure build"` failed with 1
npm ERR! error installing db-mysql#0.7.6 at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/exec.js:49:20)
npm ERR! error installing db-mysql#0.7.6 at ChildProcess.emit (events.js:70:17)
npm ERR! error installing db-mysql#0.7.6 at maybeExit (child_process.js:359:16)
npm ERR! error installing db-mysql#0.7.6 at Process.onexit (child_process.js:395:5)
> db-mysql#0.7.6 preuninstall /Users/x/mywebsite/node_modules/db-mysql
> rm -rf build/*
npm ERR! db-mysql#0.7.6 install: `node-waf configure build`
npm ERR! `sh "-c" "node-waf configure build"` failed with 1
npm ERR!
npm ERR! Failed at the db-mysql#0.7.6 install script.
npm ERR! This is most likely a problem with the db-mysql package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-waf configure build
npm ERR! You can get their info via:
npm ERR! npm owner ls db-mysql
npm ERR! There is likely additional logging output above.
npm ERR!
npm ERR! System Darwin 11.2.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "db-mysql"
npm ERR! cwd /Users/x/mywebsite
npm ERR! node -v v0.6.2
npm ERR! npm -v 1.0.106
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/x/mywebsite/npm-debug.log
npm not ok
Where did I go wrong? Or is there a better way to setup db-mysql?
Went with node-mysql works great

Weird error compiling code that calls Surface low-level CUDA API

This minimal example:
int main()
{
struct surfaceReference* surfaceReferencePointer;
cudaGetSurfaceReference(&surfaceReferencePointer, "surfaceReference");
}
Fails when it is compiled like this:
nvcc -g -arch=sm_20 -o foo.out foo.cu
Showing the following error message:
foo.cu(4): warning: argument of type "surfaceReference **" is incompatible with parameter of type "const surfaceReference **"
foo.cu(4): warning: argument of type "surfaceReference **" is incompatible with parameter of type "const surfaceReference **"
foo.cu: In function ‘int main()’:
foo.cu:4: error: invalid conversion from ‘surfaceReference**’ to ‘const surfaceReference**’
foo.cu:4: error: initializing argument 1 of ‘cudaError_t cudaGetSurfaceReference(const surfaceReference**, const char*)’
I cannot understand what I am doing wrong. I am compiling on a Linux Ubuntu 64-bit machine, using CUDA 3.2.
The struct surfaceReference* pointer should be defined as const:
int main()
{
const struct surfaceReference* surfaceReferencePointer;
cudaGetSurfaceReference(&surfaceReferencePointer, "surfaceReference");
}
Kudos to codymanix, who provided the right answer in the comments.