MySQL program cannot find -lmysqld error - c++

I'm compiling Cryptdb in my ubuntu 16.04, which uses -lmysqld option. My MySQL version is 5.5.52; The program reports the following error:
/usr/bin/ld: cannot find -lmysqld
collect2: error: ld returned 1 exit status
I have followed the instruction in Mysql Installation
to install mysql, including using make install to copy some .h file to /usr/local/mysql/...; So I wounder how to make -lmysqld work.
Also, the program uses such files as select_sql.h, which does not appear in /user/local/mysql/...; Currently, I have to find those files in the mysql source code directory: ./mysql-5.5.52/sql and add -I option in Makefile, can anyone find a more elegant way?
Thanks:)

Related

C++ build failing on MacOS

I'm trying to run my C++ program on my Macbook and I'm trying to run my program in VSCode by running the build task C/C++:clang++ build active file. However, every time I do this I get this error ld: can't open output file for writing: /Users/admin/first/first, errno=21 for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) The terminal process terminated with exit code: 1
This appears to be a simple permission problem here:
ld: can't open output file for writing
The linker cannot write to the file specified.
Edit: As correctly pointed to by molbdnilo, the error 21 is EISDIR, which means the file you are trying to write to already exists as a directory. So ... just this folder? :)
Did you brew install any c++ tools? Sometimes that is the source of these issues. The program is trying to use native OS versions of things when it should use Homebrew's or vice versa.

libxlsxwriter with MinGW

For two days I have spent several hours trying to get libxlsxwriter to work with mingw on Windows. I followed the instructions to install and build the library, but every time I attempt to include the header files in one of my projects and use one of the function in the library, I end up getting the same error:
D:\Apps\CLion\bin\cmake\win\bin\cmake.exe --build C:\Users\Simon\CLionProjects\myexcel\cmake-build-debug --target all -- -j 4
[ 50%] Linking CXX executable myexcel.exe
D:/Apps/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\myexcel.dir/objects.a(main.cpp.obj): in function `main':
C:/Users/Simon/CLionProjects/myexcel/main.cpp:4: undefined reference to `workbook_new'
D:/Apps/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Users/Simon/CLionProjects/myexcel/main.cpp:5: undefined reference to `workbook_add_worksheet'
D:/Apps/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Users/Simon/CLionProjects/myexcel/main.cpp:8: undefined reference to `worksheet_write_string'
D:/Apps/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Users/Simon/CLionProjects/myexcel/main.cpp:9: undefined reference to `workbook_close'
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe[2]: *** [CMakeFiles\myexcel.dir\build.make:85: myexcel.exe] Error 1
mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:75: CMakeFiles/myexcel.dir/all] Error 2
mingw32-make.exe: *** [Makefile:83: all] Error 2
My code is very basic (it's pretty much one of the sample codes provided):
#include "xlsxwriter.h"
int main() {
lxw_workbook *workbook = workbook_new("myexcel.xlsx");
lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);
int row = 0;
int col = 0;
worksheet_write_string(worksheet, row, col, "Hello me!", NULL);
return workbook_close(workbook);
}
I have tried several ways to get deploy mingw, but I've ultimately settled for msys2 as a platform to host mingw as I feel the *nix environments are beneficial when it comes to managing a multitude of packages and it comes with the needed zlib preinstalled.
For all it'S worth here's my toolchain configuration in CLion 2019.3
and here's my project configuration:
Any ideas what's wrong here? I am a newby as it relates to C/C++... help is very much appreciated!
EDIT:
I've tried to install the built files from the mys2 console with pacman pacman -Ss xlsx. From what it looks like, it's already installed. This is the output of the console:
$ pacman -Ss xlsx
mingw32/mingw-w64-i686-libxlsxwriter 0.9.4-1
A C library for creating Excel XLSX files (mingw-w64)
mingw32/mingw-w64-i686-python-openpyxl 3.0.2-1
A python library to read/write Excel 2007 xlsx/xlsm file (mingw-w64)
mingw32/mingw-w64-i686-python-xlsxwriter 1.2.7-1
A Python module for creating Excel XLSL files (mingw-w64)
mingw32/mingw-w64-i686-xlnt 1.4.0-1
User-friendly xlsx library for C++14 (mingw-w64)
mingw64/mingw-w64-x86_64-libxlsxwriter 0.9.4-1
A C library for creating Excel XLSX files (mingw-w64)
mingw64/mingw-w64-x86_64-python-openpyxl 3.0.2-1
A python library to read/write Excel 2007 xlsx/xlsm file (mingw-w64)
mingw64/mingw-w64-x86_64-python-xlsxwriter 1.2.7-1
A Python module for creating Excel XLSL files (mingw-w64)
mingw64/mingw-w64-x86_64-xlnt 1.4.0-1
User-friendly xlsx library for C++14 (mingw-w64)
I don't get it, frankly. There is no libxlsxwriter.so anywhere. I have the two files (libxlsxwriter.a, libxlsxwriter.dll) in the usr/local folder and in the home folder (where they have been built originally).
You can find the libxlsxwriter library as Msys2 package and install them using (from MinGW 64 shell) the following command:
pacman -S mingw-w64-x86_64-libxlsxwriter

Suggestions to compile the program fung-calc

Im trying to compile the program called fungcalc, its a graph software which the last version was made on 2003, it was designed to run in kde 3.5 (qt3).
Now the steps that I did was to install the qt3 libs, and the required componens missing based in the
./configure --disable-kde-app
this argument remove the support for kde (and the need for its libs too).
When compiling it stops almost at the end (since many .so where compiled but not the main executable)with the next output
/bin/ld: final link failed: nonrepresentable section on output
collect2: error: ld returned 1 exit status
make[4]: *** [Makefile:412: libfungcalc.la] Error 1
make[4]: Leaving directory '/fung-calc-1.3.2b/src/libfungcalc'
With the same error for the lines 277,337,495,505 of the Makefile.
So what suggestion could be so I can start to roam the entire code?
The entire Makefile is here
I don't know if this runs on 64 bits (but I suppose it does).

NPM sqlite3 with sqlcipher support

I am trying to cross compile NPM Sqlite3 with sqlcipher support. I am using Ubuntu 16.04 to cross compile for linux armv7 based SOC(system on chip).
So I started with cross-compiling OpenSSL to build sqlcipher for arm. I successfully cross compiled sqlcipher to produce a static library (libsqlcipher.a).
Now I am trying to get the NodeJS side of the project. I need sqlite with sqlcipher support, compiled for arm. I am using SOC SDK to built till now.
I am using node v4.6.1 and npm v2.15.9 to cross compile. I made sure I have the same version installed on Ubuntu as the SOC.
The command I use to cross compile is as follows :
npm install sqlite3 --target_arch=arm --enable-static=yes --build-from-source --sqlite_libname=sqlcipher -fPIC --sqlite=home/onkar/Library/sqlcipher-master/.libs --verbose
I exported the location of the libsqlcipher.a to LDFLAGS. I get the following error when I try to cross compile. Can someone help me with this error?
/home/linuximage/sdk/sysroots/x86_64-angstromsdk-linux/usr/libexec/arm-angstrom-linux-gnueabi/gcc/arm-angstrom-linux-gnueabi/5.2.1/real-ld: error: /home/Library/sqlcipher-master/.libs/libsqlcipher.a(sqlite3.o): requires unsupported dynamic reloc R_ARM_THM_MOVW_ABS_NC; recompile with -fPIC
collect2: error: ld returned 1 exit status
node_sqlite3.target.mk:129: recipe for target 'Release/obj.target/node_sqlite3.node' failed
make: *** [Release/obj.target/node_sqlite3.node] Error 1
Please let me know if you require any additional information, I would be more than happy to provide you with the same.
Thanks,
Onkar
In the first instance, you should check if the -fPIC (position independent code) flag was correctly applied when the libsqlcipher.a file was originally created.
In your output above, it looks like the linker is using the file at:
/home/Library/sqlcipher-master/.libs/libsqlcipher.a
Run the command
objdump -r /home/Library/sqlcipher-master/.libs/libsqlcipher.a | more
... and check for a line close to the start of the output beginning with the text
RELOCATION RECORDS FOR
If you see this line, then the library doesn't contain position independent code.

Can't create QT postgresql plugin for Symbian device

I'm trying to create postgresql plugin for Symbian device but I can't compile it. I'm working on Windows 7 64bit.
I did everything according to this article: http://doc.qt.io/archives/qt-4.7/sql-driver.html#qpsql
C:\QtSDK\QtSources\4.8.1\src\plugins\sqldrivers\psql>qmake "INCLUDEPATH+=C:\Program Files (x86)\PostgreSQL\8.3\include" "LIBS+=C:\Program Files (x86)\PostgreSQL\8.3\lib\libpq.lib" psql.pro
WARNING: (internal):1: Unescaped backslashes are deprecated.
So, it looked OK. Then...
C:\...drivers\psql>C:\QtSDK\Symbian\tools\sbs\win32\mingw\bin\make debug-gcce
sbs -c arm.v5.udeb.gcce4_4_1
python.exe is not recognized as an internal or external command, operable program or batch file.
make: *** [debug-gcce] Error 9009
I noticed, that sbs_home was set to python directory but it was not in the path, then the make could not find the script raptor_start.py:
C:\...drivers\psql>echo %sbs_home%
C:\QtSDK\Symbian\tools\sbs\win32\python27
C:\...drivers\psql>set path=%path%;%sbs_home%
C:\...drivers\psql>C:\QtSDK\Symbian\tools\sbs\win32\mingw\bin\make debug-gcce
sbs -c arm.v5.udeb.gcce4_4_1
python.exe: can't open file C:\QtSDK\Symbian\tools\sbs\win32\python27\python\raptor_start.py': [Errno 2] No such file or directory
make: *** [debug-gcce] Error 2
C:\...drivers\psql>set sbs_home=C:\QtSDK\Symbian\tools\sbs
so, when I started compiling I got this error:
C:/QtSDK/Symbian/SDKs/Symbian3Qt474/epoc32/include/stdapis/stlportv5/stl/_istream.c:650: warning: suggest parentheses around '&&' within '||' target : epoc32\release\armv5\udeb\qsqlpsql.dll [arm.v5.udeb.gcce4_4_1]
FAILED linkandpostlink for arm.v5.udeb.gcce4_4_1: epoc32\release\armv5\udeb\qsqlpsql.dll
mmp: qsqlpsql_dll.mmp
c:/qtsdk/symbian/tools/gcce4/bin/../lib/gcc/arm-none-symbianelf/4.4.1/../../../../arm-none-symbianelf/bin/ld.exe: warning: C:/QtSDK/Symbian/SDKs/Symbian3Qt474/epoc32/release/armv5/udeb/usrt3_1.lib(ucppinit.o) uses variable-size enums yet the output is to use 32-bit enums; use of enum values across objects may fail
C:/QtSDK/Symbian/SDKs/Symbian3Qt474/epoc32/build/psql/c_8d95259b570e1766/qsqlpsql_dll/armv5/udeb/qsql_psql.o: In function `qMakeError': C:/QtSDK/QtSources/4.8.1/src/sql/drivers/psql/qsql_psql.cpp:175: undefined reference to `PQerrorMessage'
....many undefined references...
C:/QtSDK/QtSources/4.8.1/src/sql/drivers/psql/qsql_psql.cpp:117: undefined reference to `PQfreemem'
collect2: ld returned 1 exit status
mingw32-make[1]: *** [C:/QtSDK/Symbian/SDKs/Symbian3Qt474/epoc32/release/armv5/udeb/qsqlpsql.dll] Error 1
sbs: error: The make-engine exited with errors.
sbs : warnings: 3
sbs : errors: 2
built 'arm.v5.udeb.gcce4_4_1'
Run time 5 seconds
sbs: build log in C:\QtSDK\Symbian\SDKs\Symbian3Qt474\epoc32\build\Makefile.2012-06-26-15-03-12.78-2996.log
make: *** [debug-gcce] Error 1
Has anybody idea, what with it?
You are trying to build an Symbian/ARM application using precompiled binary postgresql client library for Windows. This won't ever work. The instructions you refer to only show how to build for OS X, Unix and Mac targets natively. You're cross compiling for Symbian.
You'd first need to obtain a binary version of the postgresql client library compiled for Symbian. It might exist out there, or you may need to compile it yourself. I don't think that the library supports Symbian as a target, and I couldn't readily find any Symbian ports for download. You may be out of luck for a trivial solution. A port might not be entirely out of the question, though -- perhaps the platform-specific code is localized enough.