Doubt in Windows Build

78 views
Skip to first unread message

mmEEmm

unread,
Dec 28, 2023, 9:39:54 AM12/28/23
to MathGL
Hi everyone,

so, I've managed to build MathGL manually, though in a very rough way.

However, I am still trying to understand why using directly CMake does not work.

The build script contains the folowing command:
```
if not exist build_cmake mkdir build_cmake
cmake ^
   -D enable-dep-dll=ON -D enable-pdf=ON -D enable-zlib=ON -D enable-png=ON ^
   -D enable-python=OFF  -D enable-opengl=ON -D enable-glut=ON ^
   -D HPDF_ROOT_DIR="C:\Program Files (x86)\libharu" ^
   -D GLUT_ROOT_PATH="D:\repos\GLUT" ^
   -D BUILD_SHARED_LIBS=ON ^
   -S . -B build_cmake --fresh
```
Generation does fine.

Then, going to build with `cmake --build build_cmake --config <CONFIG>`, I have:
 ```
error LNK2019: reference to external symbol __imp_glutInitWindowSize undefined..
```
which is sign that some .dll s are missing.
But... What is causing such error in CMake config files? I mean, frmo it everythong should be set just fine. While apparently is not the case. Or, am I missing something?

Thanks!

mmEEmm

unread,
Dec 28, 2023, 9:44:02 AM12/28/23
to MathGL
Also, I expect that dependent .dll s to be copied to generated .exe (examples) locations, after having set `enable-dep-dll=ON`, but they are not.

mmEEmm

unread,
Dec 28, 2023, 10:54:02 AM12/28/23
to MathGL
So, I bet that the first problem, is caused by the fact that the FreeGLUT distribution I have has Import Library versions of .lib files (not static libraries, so .dll are needed since they host the actual code).

If so, how would I instruct CMake to also include those .dll when generatig build files?

diku...@gmail.com

unread,
Dec 28, 2023, 11:46:54 AM12/28/23
to MathGL
Look into CMakeCache.txt in your build directory and make sure that all variables related to glut and hpdf updated correctly.
I don't remember exactly, but I think, that all out of source or build system dlls required for compiling  must be in the Windows path.
Make install should copy all dependent dlls with enable-dep-dll=ON to the target directory.
Anyway I suggest you to setup a mingw environment 64 or 32-bit, this is a legal way to compile MathGL in Windows.

четверг, 28 декабря 2023 г. в 17:39:54 UTC+3, mmEEmm:

mmEEmm

unread,
Dec 28, 2023, 4:28:42 PM12/28/23
to MathGL
Hi,

thanks for answering. After many tweaks, I managed to build MathGL from within CMake (I had to fully rebuild, with modifications to the cmake files the FreeGLUT repo).

Yet, the build does not copy .dll from zlib and libpng, which are required at runtime.

Do you have any suggestion on how to solve this, also considering other external uses of MathGL?

Thanks.
Reply all
Reply to author
Forward
0 new messages