There is an issue with LIMD_GLUE_API definition in installed headers, which prevents static builds on windows.
In case of a static build, LIMD_GLUE_STATIC is defined in configure.ac
|
GLOBAL_CFLAGS+=" -DLIMD_GLUE_STATIC" |
and passed to the environment as a compiler flag.
In the source files it is checked here:
|
#ifndef LIMD_GLUE_API |
|
#ifdef LIMD_GLUE_STATIC |
|
#define LIMD_GLUE_API |
|
#elif defined(_WIN32) |
|
#define LIMD_GLUE_API __declspec(dllimport) |
|
#else |
|
#define LIMD_GLUE_API |
|
#endif |
|
#endif |
To decide how
LIMD_GLUE_API should be defined if it doesn't already exist.
The problem however is, that LIMD_GLUE_STATIC is never defined outside of the buildenvironment of libimobiledevice-glue itself!
Which means that this case:
|
#ifdef LIMD_GLUE_STATIC |
|
#define LIMD_GLUE_API |
|
#elif defined(_WIN32) |
Is
never true when a 3rd party imports libimobiledevice-glue headers. As a result, on windows the headers will always define
|
#define LIMD_GLUE_API __declspec(dllimport) |
which causes linker errors down the line when libimobiledevice-glue was built statically.
Checking whether libimobiledevice-glue was built statically cannot be done this way.
One solution would be to pre-process the header and statically resolve the condition before installing the header.
One example of this can be seen here:
https://github.com/tihmstar/img4tool/blob/d082f71dbf06f5d325140c14b47a0a214908f57c/include/img4tool/img4tool.hpp.in#L19-L21
Note: This problem also applies to other libimobiledevice projects which define _APIs in a similar matter.
There is an issue with
LIMD_GLUE_APIdefinition in installed headers, which prevents static builds on windows.In case of a static build,
LIMD_GLUE_STATICis defined in configure.aclibimobiledevice-glue/configure.ac
Line 132 in 0779631
and passed to the environment as a compiler flag.
In the source files it is checked here:
libimobiledevice-glue/include/libimobiledevice-glue/glue.h
Lines 25 to 33 in 0779631
To decide how
LIMD_GLUE_APIshould be defined if it doesn't already exist.The problem however is, that
LIMD_GLUE_STATICis never defined outside of the buildenvironment of libimobiledevice-glue itself!Which means that this case:
libimobiledevice-glue/include/libimobiledevice-glue/glue.h
Lines 26 to 28 in 0779631
Is never true when a 3rd party imports libimobiledevice-glue headers. As a result, on windows the headers will always define
libimobiledevice-glue/include/libimobiledevice-glue/glue.h
Line 29 in 0779631
which causes linker errors down the line when libimobiledevice-glue was built statically.
Checking whether libimobiledevice-glue was built statically cannot be done this way.
One solution would be to pre-process the header and statically resolve the condition before installing the header.
One example of this can be seen here:
https://github.com/tihmstar/img4tool/blob/d082f71dbf06f5d325140c14b47a0a214908f57c/include/img4tool/img4tool.hpp.in#L19-L21
Note: This problem also applies to other libimobiledevice projects which define
_APIs in a similar matter.