Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

meson does not support -libpath: in LDFLAGS environment variable #6101

Closed
ericLemanissier opened this issue Oct 24, 2019 · 3 comments · Fixed by #6106
Closed

meson does not support -libpath: in LDFLAGS environment variable #6101

ericLemanissier opened this issue Oct 24, 2019 · 3 comments · Fixed by #6106

Comments

@ericLemanissier
Copy link
Contributor

meson seems to modify LDFLAGS environment varibable if it contains some -LIBPATH:whatever, and it makes the build fail:

Appending LDFLAGS from environment: ['-LIBPATH:C:\\Users\\appveyor\\.conan\\data\\libffi\\3.2.1\\_\\_\\package\\f27dcd2d5e453cb01f9324a959461903ce8116a0\\lib', '-LIBPATH:C:\\Users\\appveyor\\.conan\\data\\pcre\\8.41\\_\\_\\package\\799aa7257b99a1d9c85e265ab0b7ddc6342e7064\\lib', '-LIBPATH:C:\\Users\\appveyor\\.conan\\data\\libelf\\0.8.13\\_\\_\\package\\f27dcd2d5e453cb01f9324a959461903ce8116a0\\lib', '-LIBPATH:C:\\Users\\appveyor\\.conan\\data\\gettext\\0.20.1\\bincrafters\\stable\\package\\2b9b20f61d3ea15628d5e59640e45d270d4e1baa\\lib', '-LIBPATH:C:\\Users\\appveyor\\.conan\\data\\bzip2\\1.0.8\\_\\_\\package\\b553e9981f9078ff331b4fd4c3b7f9c44a5514ff\\lib', '-LIBPATH:C:\\Users\\appveyor\\.conan\\data\\libxml2\\2.9.9\\bincrafters\\stable\\package\\164a9ccb60ddea0ae0d23eacd120c5b18d4082e1\\lib', '-LIBPATH:C:\\Users\\appveyor\\.conan\\data\\zlib\\1.2.11\\_\\_\\package\\f27dcd2d5e453cb01f9324a959461903ce8116a0\\lib', '-LIBPATH:C:\\.conan\\c517c1\\1\\lib']
(...)
Traceback (most recent call last):
  File "C:\Users\appveyor\.conan\data\meson\0.52.0\_\_\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\bin\mesonbuild\mesonmain.py", line 129, in run
    return options.run_func(options)
  File "C:\Users\appveyor\.conan\data\meson\0.52.0\_\_\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\bin\mesonbuild\msetup.py", line 245, in run
    app.generate()
  File "C:\Users\appveyor\.conan\data\meson\0.52.0\_\_\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\bin\mesonbuild\msetup.py", line 159, in generate
    self._generate(env)
  File "C:\Users\appveyor\.conan\data\meson\0.52.0\_\_\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\bin\mesonbuild\msetup.py", line 215, in _generate
    intr.backend.generate(intr)
  File "C:\Users\appveyor\.conan\data\meson\0.52.0\_\_\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\bin\mesonbuild\backend\ninjabackend.py", line 314, in generate
    self.generate_target(t)
  File "C:\Users\appveyor\.conan\data\meson\0.52.0\_\_\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\bin\mesonbuild\backend\ninjabackend.py", line 632, in generate_target
    elem = self.generate_link(target, outname, obj_list, linker, pch_objects, stdlib_args=stdlib_args)
  File "C:\Users\appveyor\.conan\data\meson\0.52.0\_\_\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\bin\mesonbuild\backend\ninjabackend.py", line 2534, in generate_link
    dep_targets.extend(self.guess_external_link_dependencies(linker, target, commands, internal))
  File "C:\Users\appveyor\.conan\data\meson\0.52.0\_\_\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\bin\mesonbuild\backend\ninjabackend.py", line 2428, in guess_external_link_dependencies
    search_dirs, static_patterns)
  File "C:\Users\appveyor\.conan\data\meson\0.52.0\_\_\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\bin\mesonbuild\backend\ninjabackend.py", line 2369, in guess_library_absolute_path
    trial = CCompiler._get_file_from_list(self.environment, trial)
  File "C:\Users\appveyor\.conan\data\meson\0.52.0\_\_\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\bin\mesonbuild\compilers\mixins\clike.py", line 916, in _get_file_from_list
    if f.is_file():
  File "C:\Python37\lib\pathlib.py", line 1372, in is_file
    return S_ISREG(self.stat().st_mode)
  File "C:\Python37\lib\pathlib.py", line 1168, in stat
    return self._accessor.stat(self)
OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: 'C:\\.conan\\01ae82\\1\\build_subfolder\\IBPATH:C:\\Users\\appveyor\\.conan\\data\\libffi\\3.2.1\\_\\_\\package\\f27dcd2d5e453cb01f9324a959461903ce8116a0\\lib\\libglib\\libglib-2.0.a.a'

(more detail https://ci.appveyor.com/project/bincrafters/conan-glib/builds/28354777/job/nexbj5fnd0vx3yq9#L906)

this issue is very similar to #5811 (with solution proposed in #5812), but it does not involve pkg-config

@ericLemanissier ericLemanissier changed the title meson does not support -libpath: in ldflags environment variable meson does not support -libpath: in LDFLAGS environment variable Oct 24, 2019
@agurtovoy
Copy link
Contributor

I'm sitting on a trivial patch that fixes this that I originally considered including in #5727, but decided to wait until we have a confirmed valid use case. Could you elaborate on why you are using the -LIBPATH: spelling instead of /LIBPATH:?

@ericLemanissier
Copy link
Contributor Author

it's how conan package manager generates compiler flags (https://github.com/conan-io/conan/blob/8a6df42e34f3e8b4b3c4e8d2e115ab87ab272072/conans/client/build/compiler_flags.py#L194)
The reason is at the top of the file:

    # Visual Studio cl options reference:
    #   https://msdn.microsoft.com/en-us/library/610ecb4h.aspx
    #       "Options are specified by either a forward slash (/) or a dash (–)."
    #   Here we use "-" better than "/" that produces invalid escaped chars using AutoTools.
    #   -LIBPATH, -D, -I, -ZI and so on.

@agurtovoy
Copy link
Contributor

Ha, I didn't realize MSVC actually allows both. I'll submit a PR with a fix later today. Thanks for clarifying!

agurtovoy added a commit to agurtovoy/meson that referenced this issue Oct 25, 2019
Fixes mesonbuild#6101 (with a test), following up mesonbuild#5881
jpakkane pushed a commit that referenced this issue Oct 29, 2019
Fixes #6101 (with a test), following up #5881
ericLemanissier added a commit to bincrafters/conan-center-index that referenced this issue Dec 13, 2019
meson 0.52.1 does not handle properly msvc's environment variable -LIBPATH
see mesonbuild/meson#6101
this change is a backport of the fix mesonbuild/meson#6106
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants