buddhi1980 / mandelbulber2

Official repository for Mandelbulber v2
GNU General Public License v3.0
893 stars 116 forks source link

error in compiling mandelbulber2 2.29 with msys2 #946

Closed gfernval closed 1 year ago

gfernval commented 1 year ago

Using msys2 mingw64 (gcc 12.2.0) in windows 7 64 bit and running qmake mandelbulber.pro together make generates mandelbulber2.exe that runs well inside msys2 environment (outside msys2 environment gives errors about qt libraries), but I have had to patch mingw64 compiler include files (rpcndr.h, oaidl.h, objidl.h, objidlbase.h, wtypes.h and wtypesbase.h -google "msys2 byte ambiguos symbol"-) to msys2overcome error '"reference to 'byte' is ambiguous" . What has to be changed in the sources of Mandelbulber2 2.29 to avoid this error and not to change mingw64 include files?

After doing qmake mandelbulber-opencl.pro and make, begins compilation and shows the error compiling opencl_hardware.cpp:

g++ -c -fno-keep-inline-dllexport -march=x86-64 -mtune=generic -Wa,-mbig-obj -I/usr/include/gsl -O3 -pthread -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DUSE_GAMEPAD -DUSE_EXR -DUSE_TIFF -DUSE_SNDFILE -DUSE_OPENCL -DQT_MESSAGELOGCONTEXT -DQT_NO_DEBUG -DQT_UITOOLS_LIB -DQT_WIDGETS_LIB -DQT_MULTIMEDIA_LIB -DQT_GAMEPAD_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_TESTLIB_LIB -DQT_CORE_LIB -DQT_TESTCASE_BUILDDIR='"C:/mandelbulber2/src/mandelbulber2-2.29/makefiles"' -I. -I../../mandelbulber2-2.29 -I../../../../msys64new/mingw64/include/QtUiTools -I../../../../msys64new/mingw64/include/QtWidgets -I../../../../msys64new/mingw64/include/QtMultimedia -I../../../../msys64new/mingw64/include/QtGamepad -I../../../../msys64new/mingw64/include/QtGui -I../../../../msys64new/mingw64/include/QtNetwork -I../../../../msys64new/mingw64/include/QtTest -I../../../../msys64new/mingw64/include/QtCore -Irelease -I../qt -I../../../../msys64new/mingw64/include -I../../../../msys64new/mingw64/include/OpenEXR -I../../../../msys64new/mingw64/include/Imath -I../../../../msys64new/mingw64/include/opus -I/include -I../../../../msys64new/mingw64/share/qt5/mkspecs/win32-g++ -o release/opencl_hardware.o ../src/opencl_hardware.cpp ../src/opencl_hardware.cpp: In constructor 'cOpenClHardware::cOpenClHardware(QObject*)': ../src/opencl_hardware.cpp:63:19: error: 'clewInit' was not declared in this scope 63 | int err = clewInit(openclDll.c_str()); | ^~~~ ../src/opencl_hardware.cpp:66:32: error: 'clewErrorString' was not declared in this scope 66 | qCritical() << clewErrorString(err); | ^~~~~~~ ../src/opencl_hardware.cpp: In member function 'void cOpenClHardware::CreateAllContexts(int, cOpenClDevice::enumOpenClDeviceType)': ../src/opencl_hardware.cpp:186:64: warning: unused parameter 'deviceType' [-Wunused-parameter] 186 | int platformIndex, cOpenClDevice::enumOpenClDeviceType deviceType) | ~~~~~~~~^~~~~~ make[1]: [Makefile.Release:67745: release/opencl_hardware.o] Error 1 make[1]: Leaving directory '/c/mandelbulber2/src/mandelbulber2-2.29/makefiles' make: [Makefile:45: release] Error 2

Don´t know how to solve this error

buddhi1980 commented 1 year ago

I haven't used mingw for more than five years, because there was often not possible to compile all needed qt libraries (for 64 bit platforms). Instead of writing new code I spent long hours on trying Qt cross-compilaton). That time I decided to use msvc instead of mingw. Actual code is probably not fully prepared to be compiled with mingw. IT required to use "clew" extension to OpenCL. It allowed dynamic loading of OpenCL.dll. But the problem was support of newer OpenCL versions and C++ wrappers. I'm not sure if clew.h was updated since that time (https://github.com/martijnberger/clew). Unfortunately I don't know the answer how to compile Mandelbulber-OpenCL with mingw in actual state. If you want to experiment with the code and compile the program by yourself I encourage you to use Linux (e.g Debian or Ubuntu) where you can easily use gcc compiler. I do all development on this platform. Other option would be to work od Windows and use VisualStudio but is a bumpy road.