gfortran: error: CreateProcess: No such file or directory in build with MinGW - dll

I tried to build shared lib for Lapack with MinGW_64. I got error as
gfortran: error: CreateProcess: No such file or directory.
My Lapack version is Lapack_3.5 and my MinGW has x86_64-4.9.2-posix-seh-rt_v3-rev1 version for x86_64.
I can build blas.dll with gfortran --shared -o blas.dll blas\src\*.f -O successfully. But when I build lapack.dll with gfortran --shared -o lapack.dll src\*.f blas.dll -O, I got gfortran: error: CreateProcess: No such file or directory error. I have restarted the system after MinGW's installation.

This may be due to an error in the mingw package you are using. The same thing happened to me.
If you search for a gfortran.exe file under your mingw tree (x86_mingwgfortran.exe or whatever - I don't have the machine this happend on any more), you can invoke this with the full pathname. This should work.

Related

CMake -- CUDA compiler is not able to compile a simple test program

I am working on a small library that makes use of CUDA, however I cannot seem to make CMake work when I run it from the command line, even though my IDE (CLion) uses CMake to comile the program succesfully.
I have scoured the internet for ages trying to solve this, though with nothing making much of a difference. I have got CUDA 11.1 and CMake 3.17.3, and both are accessable from the command line.
CLion is able to compile the code perfectly, and everything works as expected, however when I run CMake from the command line, it gives the following error:
PS C:\Users\penci\OneDrive\Desktop\Rapid\Temporary\Rapid\build> cmake ..
-- The CUDA compiler identification is NVIDIA 11.1.105
-- Check for working CUDA compiler: /cygdrive/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.1/bin/nvcc.exe
-- Check for working CUDA compiler: /cygdrive/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.1/bin/nvcc.exe - broken
CMake Error at /usr/share/cmake-3.17.3/Modules/CMakeTestCUDACompiler.cmake:46 (message):
The CUDA compiler
"/cygdrive/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.1/bin/nvcc.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /cygdrive/c/Users/penci/OneDrive/Desktop/Rapid/Temporary/Rapid/build/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make.exe cmTC_2c864/fast && /usr/bin/make -f CMakeFiles/cmTC_2c864.dir/build.make CMakeFiles/cmTC_2c864.dir/build
make[1]: Entering directory '/cygdrive/c/Users/penci/OneDrive/Desktop/Rapid/Temporary/Rapid/build/CMakeFiles/CMakeTmp'
Building CUDA object CMakeFiles/cmTC_2c864.dir/main.cu.o
"/cygdrive/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.1/bin/nvcc.exe" -forward-unknown-to-host-compiler -x cu -c /cygdrive/c/Users/penci/OneDrive/Desktop/Rapid/Temporary/Rapid/build/CMakeFiles/CMakeTmp/main.cu -o CMakeFiles/cmTC_2c864.dir/main.cu.o
c1xx: fatal error C1083: Cannot open source file: 'C:/cygdrive/c/Users/penci/OneDrive/Desktop/Rapid/Temporary/Rapid/build/CMakeFiles/CMakeTmp/main.cu': No such file or directory
main.cu
make[1]: *** [CMakeFiles/cmTC_2c864.dir/build.make:86: CMakeFiles/cmTC_2c864.dir/main.cu.o] Error 2
make[1]: Leaving directory '/cygdrive/c/Users/penci/OneDrive/Desktop/Rapid/Temporary/Rapid/build/CMakeFiles/CMakeTmp'
make: *** [Makefile:141: cmTC_2c864/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:2 (project)
-- Configuring incomplete, errors occurred!
See also "/cygdrive/c/Users/penci/OneDrive/Desktop/Rapid/Temporary/Rapid/build/CMakeFiles/CMakeOutput.log".
See also "/cygdrive/c/Users/penci/OneDrive/Desktop/Rapid/Temporary/Rapid/build/CMakeFiles/CMakeError.log".
Sorry for the wall of text, but I'm not sure why this doesn't work in the command line, when it does in CLion.
This is my CMakeLists.txt file:
cmake_minimum_required(VERSION 3.17)
project(Rapid LANGUAGES CUDA)
set(CMAKE_CUDA_STANDARD 14)
include_directories(${PROJECT_SOURCE_DIR}/include/rapid/graphics/GLFW)
link_directories(${PROJECT_SOURCE_DIR}/include/rapid/graphics/GLFW/lib64)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcompiler /openmp")
SET (CMAKE_C_COMPILER_WORKS 1)
SET (CMAKE_CXX_COMPILER_WORKS 1)
add_executable(Rapid main.cu)
set_target_properties(
Rapid
PROPERTIES
CUDA_SEPARABLE_COMPILATION ON)
target_link_libraries(Rapid cublas glfw3 gdi32 opengl32)
Any ideas as to how I can fix this issue would be greatly appreciated, as I have spent days trying to fix this, but nothing online seems to work.
After Googling some things that seemed completely unrelated to the issue, I discovered that my Cygwin64 install of CMake was not setup to use Visual Studio generators.
To fix the issue, I needed to put the Visual Studio install of CMake into the PATH environment variable, but it needed to be above the Cygwin64 bin directory. This meant that running the cmake command from the command line would refer to the Visual Studio install, and not the Cygwin64 install, allowing it to work correctly.
Hopefully this helps someone else in the future too

Installing LLReve using Cmake. Unknown BISON_TARGET error

I am getting the following error :
CMake Error at CMakeLists.txt:9 (BISON_TARGET):
Unknown CMake command "BISON_TARGET".
when I run the command :
cmake .. -GNinja
Please tell me what to do. I tried searching on google a lot and thus came up with the additions and finally ran the command :
cmake .. -D LLVM_DIR=/usr/lib/llvm-5.0/cmake/ -D FLEX_EXECUTABLE=/usr/local/Cellar/flex/2.5.37/bin/ -D FLEX_INCLUDE_DIR=/usr/local/Cellar/flex/2.5.37/include/ -D BISON_EXECUTABLE=/usr/bin/bison
but it still shows the same error :(.
Please someone help.
Your error is occurring because the BISON_TARGET function definition has not yet been supplied. This method, as commented, is supplied by FindBISON. The error indicates that either Bison was not found on your system (hopefully, you have it installed), or cmake was ran from the wrong directory. Bison is included in the top-level CMake file via:
find_package(BISON REQUIRED)
This line to include Bison must be called before using the BISON_TARGET CMake function. The LLReve instructions for compiling this repository are explicit about which directory to run the build commands in:
Go to the llreve directory and run
cd reve
mkdir build
cd build
cmake .. -GNinja
ninja
This would run on the CMake file in the llreve/reve directory, not the llreve/reve/reve directory. Please ensure you are running CMake from the correct location, as not running cmake on the top-level CMake file will often yield errors.

g++ doesn't recognize the file format of a dll

I am on Windows, and I am using the version of g++ that comes with mingw-64. I have a file on my computer called lua51.dll. When I try to run the following command :
g++ -shared -fPIC -o stuff.dll -llua51 stuff.cpp
I get the following error:
C:/Program Files/LOVE/lua51.dll: file not recognized: File format not recognized
collect2.exe: error: ld returned 1 exit status
make: *** [main] Error 1
How can I fix this? Please let me know if more information is needed; I am a complete beginner to compilation.
This is an issue you get when you try to include a 64-bit library when running a 32-bit version of g++ or even gcc.
I thought that that the version of g++.exe that comes with mingw-64 would produce 64-bit code, but it turns out this isn't true; it still only produces 32-bit code. In my case, lua51.dll is 64-bit, which is an issue since I was using the version of g++ that produces 32-bit code.
Instead, you need to use x86_64-w64-mingw32-g++.exe, which can be found in the same folder as g++.exe. This is the version of g++ that will produce 64-bit code.

Using CMake with Eclipse CDT and Cygwin on Windows

For a new project we want to use CMake. We are using Eclipse CDT as IDE and Cygwin gcc.
We generated the CMakeLists.txt and followed [this tutorial (option 2)][1].
When I try to run the described Make target to generate the Makefiles with CMake, which executes
cmake -E chdir C:/projects/eclipse_ws/MyApp/Build/ cmake -G "Unix Makefiles" ../ Run CMake
I get the error
CMake Error: The source directory "C:/projects/eclipse_ws/MyApp/Build/CMake" does not exist.
If I run the command directly from a Cygwin console it works just fine, however then I have to run make also from the Cygwin console, because the Makefiles are generated with Unix paths.
EDIT:
So I fixed this issue (see my answer below).
But I'm still having problems.
When I try to run CMake as Make target in Eclipse as suggested in the tutorial I get the following errors:
cmake -E chdir Build/ cmake -G 'Unix Makefiles' ../
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
System is unknown to cmake, create:
Platform/MINGW32_NT-6.1 to use this system, please send your config file to cmake#www.cmake.org so it can be added to cmake
Your CMakeCache.txt file was copied to CopyOfCMakeCache.txt. Please send that file to cmake#www.cmake.org.
-- Check for working C compiler: /usr/bin/gcc.exe
System is unknown to cmake, create:
Platform/MINGW32_NT-6.1 to use this system, please send your config file to cmake#www.cmake.org so it can be added to cmake
-- Check for working C compiler: /usr/bin/gcc.exe -- broken
CMake Error at /usr/share/cmake-2.8.9/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):
The C compiler "/usr/bin/gcc.exe" is not able to compile a simple test
program.
It fails with the following output:
Change Dir: /cygdrive/c/projects/eclipse_ws/MyApp/Build/CMakeFiles CMakeTmp
Run Build Command:/usr/bin/make.exe "cmTryCompileExec726566634/fast"
/usr/bin/make -f CMakeFiles/cmTryCompileExec726566634.dir/build.make
CMakeFiles/cmTryCompileExec726566634.dir/build
make[1]: Entering directory
'/cygdrive/c/projects/eclipse_ws/MyApp/Build/CMakeFiles/CMakeTmp'
/usr/bin/cmake.exe -E cmake_progress_report
/cygdrive/c/projects/eclipse_ws/MyApp/Build/CMakeFiles/CMakeTmp/CMakeFiles
1
Building C object
CMakeFiles/cmTryCompileExec726566634.dir/testCCompiler.c.obj
/usr/bin/gcc.exe -o
CMakeFiles/cmTryCompileExec726566634.dir/testCCompiler.c.obj -c
/cygdrive/c/projects/eclipse_ws/MyApp/Build/CMakeFiles/CMakeTmp/testCCompiler.c
CMakeFiles/cmTryCompileExec726566634.dir/build.make:60: recipe for target
'CMakeFiles/cmTryCompileExec726566634.dir/testCCompiler.c.obj' failed
make[1]: Leaving directory
'/cygdrive/c/projects/eclipse_ws/MyApp/Build/CMakeFiles/CMakeTmp'
make[1]: *** [CMakeFiles/cmTryCompileExec726566634.dir/testCCompiler.c.obj]
Error 1
Makefile:117: recipe for target 'cmTryCompileExec726566634/fast' failed
make: *** [cmTryCompileExec726566634/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:3 (project)
-- Configuring incomplete, errors occurred!
Seems like for some reason CMake assumes I have an MinGW environment and not Cygwin.
EDIT2
MinGW system was assumed, because a Git installation was in PATH before Cygwin and Git's uname command was used (which returns MinGW).
If you check "Make Target - Same as the target name" in Eclipse's Make dialog, Eclipse will add a
Run CMake
to the command (see question), which is misinterpreted by CMake.
I just unchecked "Same as the target name".

OpenKinect: Compile custom code on MAC

Can someone please tell me how to compile custom kinect code on MAC.
I have downloaded and built the OpenKinect as instructed by the guide(and yes glview works fine)
I am following this: http://openkinect.org/wiki/C%2B%2B_GL_Example
But I am not able to produce any output file.
g++ -g -Wall `pkg-config --cflags libfreenect` -lopengl32 -lglut32 `pkg-config --libs libfreenect` -lGL -lGLU -lglut -c main.cpp
Package libfreenect was not found in the pkg-config search path.
Perhaps you should add the directory containing `libfreenect.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libfreenect' found
Package libfreenect was not found in the pkg-config search path.
Perhaps you should add the directory containing `libfreenect.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libfreenect' found
In file included from main.cpp:27:
/usr/local/include/libfreenect.hpp:29:25: error: libfreenect.h: No such file or directory
In file included from main.cpp:27:
/usr/local/include/libfreenect.hpp:46: error: expected `)' before ‘*’ token