You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Root cause is that cpp_info.defines of dependencies are not injected in CL, only includedirs. Since GDAL depends on libjpeg, and libjpeg static must come with LIBJPEG_STATIC definition, this missing definition leads to incorrect mangling, and afterwards lot of link warnings (of libjpeg symbols but also proj symbols) and few link errors when an executable is linked to gdal & libjpeg static libs.
After this fix in NMakeDeps, gdal is properly compiled and test package works fine:
--- a/conan/tools/microsoft/nmakedeps.py+++ b/conan/tools/microsoft/nmakedeps.py@@ -41,11 +41,22 @@ class NMakeDeps(object):
ret.extend(cpp_info.exelinkflags or [])
ret.extend(cpp_info.sharedlinkflags or [])
ret.extend([format_lib(lib) for lib in cpp_info.libs or []])
+ ret.extend([format_lib(lib) for lib in cpp_info.system_libs or []])
link_args = " ".join(ret)
+ def format_define(define):+ if "=" in define:+ # CL env-var can't accept '=' sign in /D option, it can be replaced by '#' sign:+ # https://learn.microsoft.com/en-us/cpp/build/reference/cl-environment-variables+ macro, value = define.split("=", 1)+ value = fr'\"{value}\"' if value and not value.isnumeric() else value+ define = f"{macro}#{value}"+ return f"/D{define}"+
cl_flags = [f'-I"{p}"' for p in cpp_info.includedirs or []]
cl_flags.extend(cpp_info.cflags or [])
cl_flags.extend(cpp_info.cxxflags or [])
+ cl_flags.extend([format_define(define) for define in cpp_info.defines or []])
env = Environment()
env.append("CL", " ".join(cl_flags))
SpaceIm
changed the title
[bug] NMakeDeps: system_libs an defines of dependencies are not injected
[bug] NMakeDeps: cpp_info.system_libs and cpp_info.defines of dependencies are not injected
Jan 21, 2023
Environment details
Steps to reproduce
VisualStudioBuildEnvironment
toNMakeToolchain
+NMakeDeps
for Visual Studio build)conan create . gdal/3.4.3@ -b missing
Root cause is that
cpp_info.defines
of dependencies are not injected inCL
, only includedirs. Since GDAL depends on libjpeg, and libjpeg static must come withLIBJPEG_STATIC
definition, this missing definition leads to incorrect mangling, and afterwards lot of link warnings (of libjpeg symbols but also proj symbols) and few link errors when an executable is linked to gdal & libjpeg static libs.Logs
https://c3i.jfrog.io/c3i/misc/logs/pr/15386/1-configs/windows-visual_studio/gdal/3.4.3//42b95a8783a99826180d6f5c9cae4fe6df641006-test.txt
The text was updated successfully, but these errors were encountered: