Is there a way to work with ODBC by MinGW? - c++

First I tried to download iODBC.
My MSYS console can't configure it, even if it "INSTALL" document orders to do it, because it has just configure.in, that have to be parsed by autoconf.
I downloaded GnuWin32 autoconf (2.63) to parse it. But it can't parse, because when I start autoconf in MSYS with path to configure.in, it can't find some files:
./autoconf: line 615: C:/PROGRA~2/GnuWin32/autoconf/bin/autom4te: No such file or directory
./autoconf: line 615: exec: C:/PROGRA~2/GnuWin32/autoconf/bin/autom4te: cannot execute: No such file or directory
Fun, that autoconf already placed in GnuWin32/bin directory, and autom4te lays near.
I tried just rename configure.in to configure, but I receive syntax error at first line with "AC_PREREQ(2.59)". Also I found in internet that 2.63 may not work with 2.59, and lost any wish to continue my attempts.
I also tried to run bootstrap, but it falls with "line 145: --force: command not found".
Then I decide to try unixODBC. I downloaded library 2.3.2 from home link, and started to configure it. It was done well.
Then I run "make check". It failed with:
iniOpen.c: In function 'iniOpen':
iniOpen.c:401:43: error: 'EOVERFLOW' undeclared (first use in this function)
( errno != ENOSPC ) && ( errno != EOVERFLOW ) &&
^
iniOpen.c:401:43: note: each undeclared identifier is reported only once for each function it appears in
iniOpen.c:402:20: error: 'EWOULDBLOCK' undeclared (first use in this function)
( errno != EWOULDBLOCK ))
I found that EWOULDBLOCK and EOVERFLOW never met in sources anywhere else. Also I found that it guess take them from MinGW\include\errno.h, where I found all other constaints (such as ENOSPC). Also I found EWOULDBLOCK and EOVERFLOW in boost "cerrno.hpp" and other files with errors. I fixed problem, insterting #ifndef - #define - #endif.
Now I have problem with "ld.exe: cannot find -lpthread" - Linker is trying to link posix threads that are not available at system. I can remove it, but what should I add instead? Or better would be to download and build pthread_win32 from posix thread for Win link?
It was built with adding definition for EWOULDBLOCK, EOVERFLOW and configuring with flag --enable-threads=no
So, my question is: is there right way to work with ODBC from MinGW WITH threads? If I was moving right way, how to solve those strange (at least because I downloaded releases marked as "stable") troubles?

Related

CMake error: Could not find the VTK package with the following required components:GUISupportQt, ViewsQt

I compiled VTK in my RedHat 8.3 machine, and now when I want to compile an example in the /GUI/Qt/SimpleView with cmake I get the following error message when configuring:
CMake Warning at CMakeLists.txt:4 (find_package):
Found package configuration file:
home/user/Downloads/VTK-9.1.0/build/lib64/cmake/vtk-9.1/vtk-config.cmake
but it set VTK_FOUND to FALSE so package “VTK” is considered to be NOT FOUND.
Reason given by package:
Could not find the VTK package with the following required components:
GUISupportQt, ViewsQt.
Has anyone encountered this problem before ?
Thank you for your help.
This looks like you did not set the VTK_MODULE_ENABLE_VTK_GuiSupportQt and VTK_MODULE_ENABLE_VTK_ViewsQt options to "YES" when running configure in CMake.
Note: the abovementioned option names are only applicable for VTK >= 9; for VTK < 9, they are called Module_vtkGUISupportQt and Module_vtkViewsQt (and you might also need to enable Module_vtkGUISupportQtOpenGL and Module_vtkRenderingQt).
These options are not enabled by default, but they seem to be required by the example that you're trying to compile.
Don't worry, you shouldn't have to re-do everything now. To fix:
Open the CMake GUI.
Enter the folder where you built VTK in "Where to build the binaries".
If it's not checked, set the "Advanced" checkbox (the required options are not visible otherwise).
Set VTK_MODULE_ENABLE_VTK_GuiSupportQt and VTK_MODULE_ENABLE_VTK_ViewsQt options to "YES"
Press "Configure", and wait for it to finish
During Configuring, you might get an error, if CMake doesn't know how to find Qt; if so, enter the Qt5_DIR / Qt6_DIR, and press configure again.
Press "Generate", and wait for it to finish
Start the vtk build again (depends on what build tool you choose...)
Try configuring the example again, now you should not see the error message anymore.

Fatal error: debugger does not support channel locks

I am trying to use ocamldebug with my project, to understand why a 3rd party lib I'm using is not behaving the way I expected.
https://ocaml.org/manual/debugger.html
The OCaml debugger is invoked by running the program ocamldebug with the name of the bytecode executable file as first argument
I have added (modes byte exe) to my dune file.
When I run dune build I can see the bytecode file output, alongside the exe, as _build/default/bin/cli.bc
When I pass this to ocamldebug I get the following error:
ocamldebug _build/default/bin/cli.bc
OCaml Debugger version 4.12.0
(ocd) r
Loading program... done.
Fatal error: debugger does not support channel locks
Lost connection with process 33035 (active process)
between time 170000 and time 180000
Restart from time 170000 and try to get closer of the problem ? (y or n)
If I choose y the console seems to hang indefinitely.
I found the source of the error here:
https://github.com/ocaml/ocaml/blob/f68acd1a618ac54790a8347fad466084f15a9a9e/runtime/debugger.c#L144
/* The code in this file does not bracket channel I/O operations with
Lock and Unlock, so fail if those are not no-ops. */
if (caml_channel_mutex_lock != NULL ||
caml_channel_mutex_unlock != NULL ||
caml_channel_mutex_unlock_exn != NULL)
caml_fatal_error("debugger does not support channel locks");
...but I don't know what might be triggering it.
My project is using cmdliner and lwt ...I think at this early point of execution it hasn't hit any lwt code though.
Is ocamldebug incompatible with cmdliner?
If that's the case then I will need to make a new entrypoint just for debugging I guess. (currently the bin/cli is the only executable artefact in my project, the code I need to debug is all under lib/s)
It looks like that the OCaml debugger is broken for your version of macOS. Please, report the issue to the OCaml issue tracker including the detailed information on your system. I can't reproduce it on my machine, but I am using a pretty old version of macOS (10.11.6) and I have the 4.12 debugger working flawlessly.
As a workaround, try using an older version of OCaml, as this channel lock test was introduced very recently you can install any version prior to 4.12,
opam switch create 4.11.0
eval $(opam env)
Then, do not forget to rebuild your project (previously installing the required dependencies),
opam install lwt cmdliner
dune build
and then you can use the debugger to your taste.

CMAKE_CXX_CLANG_TIDY: avoid clang-diagnostic-error interrupting build

I am building a C++ project using clang-tidy as linter (cmake -DCMAKE_CXX_CLANG_TIDY=clang-tidy).
After updating my system (Fedora 28->29, cmake 3.11->3.12 I believe), I cannot build any more when clang-tidy reports some clang-diagnostic-error (which I cannot fix right now...). I am pretty sure that clang-diagnostic-error's did not interrupt the build earlier... But I cannot be hundred percent sure.
Edit: The change happened in clang-tidy, now it returns a non-zero exit code when errors are found.
Is it possible to suppress those errors, something like the opposite of "-warnings-as-errors"?
Not sure if a solution or a workaround, but this does the trick (in my OS...):
cmake -DCMAKE_CXX_CLANG_TIDY="${PATH_TO_SCRIPT}/suppress_exit_status.sh;clang-tidy"
PATH_TO_SCRIPT to script is the absolute path to suppress_exit_status.sh, which looks like:
#!/bin/sh
$#||echo Command \"$#\" failed with exit code $?
|| is the "or" operator, the second operands is only executed if the first one fails. It seems that cmake captures standard error from the command and throws it way, hence the error message.
I could not figure out a more elegant way to do this, it is not possible to throw || directly into CMAKE_CXX_CLANG_TIDY.

LNK1181 error when compiling V8 engine on Win10

I'm following this guide on building V8 but I am hitting some issues on the compilation step. I am running Windows 10 x64. I am trying to compile with options to embed the engine also.
Running the following command:
ninja -C out.gn/x64.release
Gives me this error:
ninja: Entering directory `out.gn/x64.release'
[1/471] LINK mksnapshot.exe mksnapshot.exe.pdb
FAILED: mksnapshot.exe mksnapshot.exe.pdb
C:/Workspace/depot_tools/win_tools-2_7_6_bin/python/bin/python.exe ../../build/toolchain/win/tool_wrapper.py link-wrapper environment.x64 False link.exe /nologo /OUT:./mksnapshot.exe /PDB:./mksnapshot.exe.pdb #./mksnapshot.exe.rsp
LINK : fatal error LNK1181: cannot open input file 'comdlg32.lib'
ninja: build stopped: subcommand failed.
Now I believe I have narrowed down the error to looking for the .lib files in the wrong directory. I have (had) multiple versions installed, so there were multiple folders in my Windows Kit install.
Windows Kits/10/Lib/10.0.16299.0
Windows Kits/10/Lib/10.0.15xxx.0
If I dragged and dropped the comdlg32.lib file from 10.0.16299.0 into the 10.0.15xxx.0 directory then the error changed to a LNK1181 error with a different input file. I did this a few times but I was unsure if this was going to cause issues with different versions and there was probably going to be a lot.
I uninstalled the 10.0.15xxx.0 version which left behind the folder I mentioned, so I removed that and after doing so I have started getting the LNK1181 error with a different input file (advapi32.lib I assume the very first file it can't find). This is how I came to the conclusion about the path being incorrect.
So I have tried a few things to change the path (I hoped just uninstalling the old version would fix it) such as:
Uninstalling the old version.
Going through registry entries to see if I can find an install path or something using that path, which I didn't. I did notice that there was still installation and data in the registry for the 10.0.15xxx.0 install, I might try deleting that from the registry directly as a last resort?
I have tried to explicitly set the path by setting <TargetUniversalCRTVersion>10.0.16299.0</TargetUniversalCRTVersion> in this file: C:\Program Files (x86)\Windows Kits\10\DesignTime\CommonConfiguration\Neutral\uCRT.props
I have never used Ninja before so I tried looking for a way to set some kind of lib-path in the command but couldn't really find anything.
I looked through the python scripts being executed to try and locate something to do with the libs path but couldn't see anything.
I would be grateful for any help and suggestions. Thanks.
You can try to compile v8 using Visual Studio as explained here: https://chromium.googlesource.com/chromium/src/+/master/docs/windows_build_instructions.md#using-the-visual-studio-ide
By running the following commands:
$ gn gen --ide=vs out.gn/x64.release
$ cd out.gn/x64.release
$ msbuild all.sln
You can see a full example here: https://github.com/phpv8/v8js/issues/272#issuecomment-262848754
Apparently this method is not officially supported anymore, but I had the same problem as you have and this solved the issue for me.
Note that after this I had another issue, the unit tests failed to be compiled due to a linking error, but I had the necessary libraries to use v8. So there may be deeper problem that is causing all of this that I'm missing.
Edit:
Also, you could try to set the following parameters with gn args:
visual_studio_path = "..."
visual_studio_version = "2017"
wdk_path = "..."
windows_sdk_path = "C:\Program Files (x86)\Windows Kits\10"
To set those parameters, do:
gn args out.gn/x64.release
This will open a text editor where you can write the extra parameters you are interested in.
To see the full list of parameters you can specify:
gn args --list out.gn/x64.release
I was following this guide https://medium.com/dailyjs/how-to-build-v8-on-windows-and-not-go-mad-6347c69aacd4 and also ran into the error
LINK1181: cannot open input file 'advapi32.lib'
I'm pretty sure it was because I had the wrong versions of the Windows 10 SDK. Similar to you I had versions:
Windows Kits/10/Lib/10.0.10240.0
Windows Kits/10/Lib/10.0.16299.0
But according to https://chromium.googlesource.com/chromium/src/+/master/docs/windows_build_instructions.md#Setting-up-Windows (Which I think is relevant) you need version 10.0.15063.0
After installing version 10.0.15063.0 (with the visual studio installer) to
Windows Kits/10/Lib/10.0.15063.0
I was able to continue with the build.

Building U-Boot is failing

I am trying to build u-boot
Toolchain:
http://web.archive.org/web/20130823131954/http://www.angstrom-distribution.org/toolchains/
U-boot: git.denx.de
I am following this site to build this u-boot
http://beagleboard.org/linux
It says to put cross compiler path before building.
export PATH=/usr/local/angstrom/arm/bin:$PATH
1) I can see angstrom folder in /usr/local. Also I think that we need the toolchain's actual place of binaries. Let suppose in /home/myhome/BBB/angtrom_x_y_z/usr/local/angstrom/arm/bin
So which path actually i should export?
2)I have tried to put both paths, but I am getting errors.
3)I have downloaded three toolchains
angstrom-2011.03-i686-linux-armv5te-linux-gnueabi-toolchain
angstrom-2011.03-x86_64-linux-armv7a-linux-gnueabi-toolchain-qte-4.6.3
angstrom-2011.03-i686-linux-armv7a-linux-gnueabi-toolchain-qte-4.6.3
1st gives errors as
CROSS_COMPILE=arm-angstrom-linux-gnueabi- make am335x_evm
scripts/kconfig/conf --silentoldconfig Kconfig
CHK include/config.h
GEN include/autoconf.mk
arm-angstrom-linux-gnueabi-gcc: 0: No such file or directory
arm-angstrom-linux-gnueabi-gcc: unrecognized option '-G'
cc1: error: unrecognized command line option "-mabicalls"
make[1]: *** [include/autoconf.mk] Error 1
make: *** No rule to make target `am335x_evm'. Stop.
second one is I think for 64 bit processor, I have i386 one, so it also doesn't worked
Third one is corrupted.
Can anybody tell me how to compile it as the site says. Maybe the site is outdated but still if anybody can tell me a straightforward way how to do this.
It looks like Angstorm toolchian is too old to deal with recent U-Boot. I tried your procedure and get other errors. I'm not sure why you try to use that old toolchain and if you have to use it. But I quickly check Linaro toolchain gcc-linaro-arm-linux-gnueabihf-4.9-2014.07_linux, which I use for boards like Cubietruck and A20-OLinuXino-MICRO and it works fine.
git clone git://git.denx.de/u-boot.git
cd u-boot
export PATH=${PATH}:${PATH_TO_TOOLCHAIN}/gcc-linaro-arm-linux-gnueabihf-4.9-2014.07_linux/bin
CROSS_COMPILE=arm-linux-gnueabihf- make am335x_evm_defconfig
CROSS_COMPILE=arm-linux-gnueabihf- make -j$(nproc)