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

[bug] editable mode breaks XcodeDeps/XcodeToolchain #12839

Closed
ghost opened this issue Jan 4, 2023 · 8 comments · Fixed by #12841
Closed

[bug] editable mode breaks XcodeDeps/XcodeToolchain #12839

ghost opened this issue Jan 4, 2023 · 8 comments · Fixed by #12841
Assignees

Comments

@ghost
Copy link

ghost commented Jan 4, 2023

Environment details

  • Operating System+version: macOS 12.6.2
  • Compiler+version: Apple clang 13.1.6
  • Conan version: 1.56.0
  • Python version: 3.8.9

Steps to reproduce

  1. Create a producer with conan new producer/1.0 -s
  2. Change it to use CMakeToolchain and overall Conan 2.0 compatible. The contents of all files in my producer result can be found here
  3. Create a package via conan create . -pr:h default -pr:b default -b missing
  4. Create a consumer project in the separate directory. Having a directory with a single conanfile.txt will be enough. My consumer conanfile.txt can be found here
  5. Install consumer dependency with conan install . -u -pr:h default -pr:b default --build missing -if conan-install-xcode
  6. Make your producer an editable dependency: conan editable add ../producer/ producer/1.0
  7. Install dependency with conan install . -u -pr:h default -pr:b default --build missing -if conan-editable-xcode
  8. Run diff -rup conan-install-xcode/conan_producer_producer_release_arm64.xcconfig conan-editable-xcode/conan_producer_producer_release_arm64.xcconfig (replace arm64 with x86_64 on intel Mac)

The diff will show that PACKAGE_ROOT for producer in editable mode is None.

In my real example this causes xcodebuild to fail to find the needed headers.

Logs

❯ diff -rup conan-install-xcode/conan_producer_producer_release_arm64.xcconfig  conan-editable-xcode/conan_producer_producer_release_arm64.xcconfig
--- conan-install-xcode/conan_producer_producer_release_arm64.xcconfig	2023-01-04 14:59:31.000000000 +0200
+++ conan-editable-xcode/conan_producer_producer_release_arm64.xcconfig	2023-01-04 15:01:37.000000000 +0200
@@ -1,11 +1,11 @@
-PACKAGE_ROOT_producer[config=Release][arch=arm64][sdk=*] = /Users/kovimi/Developer/conan-xcode-bug/local-conan-home/.conan/data/producer/1.0/_/_/package/f7023de70d0bfc63077b5172ade69e4423b9047c
+PACKAGE_ROOT_producer[config=Release][arch=arm64][sdk=*] = None
 // Compiler options for producer::producer
-HEADER_SEARCH_PATHS_producer_producer[config=Release][arch=arm64][sdk=*] = "/Users/kovimi/Developer/conan-xcode-bug/local-conan-home/.conan/data/producer/1.0/_/_/package/f7023de70d0bfc63077b5172ade69e4423b9047c/include"
+HEADER_SEARCH_PATHS_producer_producer[config=Release][arch=arm64][sdk=*] = "include"
 GCC_PREPROCESSOR_DEFINITIONS_producer_producer[config=Release][arch=arm64][sdk=*] =
 OTHER_CFLAGS_producer_producer[config=Release][arch=arm64][sdk=*] =
 OTHER_CPLUSPLUSFLAGS_producer_producer[config=Release][arch=arm64][sdk=*] =
 FRAMEWORK_SEARCH_PATHS_producer_producer[config=Release][arch=arm64][sdk=*] =

 // Link options for producer::producer
-LIBRARY_SEARCH_PATHS_producer_producer[config=Release][arch=arm64][sdk=*] = "/Users/kovimi/Developer/conan-xcode-bug/local-conan-home/.conan/data/producer/1.0/_/_/package/f7023de70d0bfc63077b5172ade69e4423b9047c/lib"
+LIBRARY_SEARCH_PATHS_producer_producer[config=Release][arch=arm64][sdk=*] = "lib"
 OTHER_LDFLAGS_producer_producer[config=Release][arch=arm64][sdk=*] =  -lproducer
@memsharded
Copy link
Member

Hi @mkoviazin

Thanks for your report, lets have a look.
Quick feedback: you can use conan new producer/0.1 -m=cmake_lib for a modern template recipe with CMakeToolchain, etc. There are other new templates like cmake_exe, msbuild_deps, etc.

@ghost
Copy link
Author

ghost commented Jan 4, 2023

Thanks, that's good to know! That wasn't documented here hence I didn't know it existed

@ghost
Copy link
Author

ghost commented Jan 4, 2023

I wonder actually if I'm using editable mode correctly at all. Trying to report the expected behaviour, I did the same with CMakeDeps/CMakeToolchain and it caused a python stack trace: #12840

@memsharded
Copy link
Member

memsharded commented Jan 4, 2023

Submitting a PR in #12841 for fixing this.

I am not sure what could be failing on your side, I am checking and in my tests the HEADER_SEARCH_PATHS_dep_dep[config=Release][arch=x86_64][sdk=*] = "T:\tmp7eco66liconans\path with spaces\dep\include" is correctly defined to find the headers.

Can you please try the producer with the -m=cmake_lib template instead? It is possible that something is missing there, like the layout() method. I'd say that #12840 might be solved too, I think this issue was solved for CMakeDeps some time ago.

@ghost
Copy link
Author

ghost commented Jan 4, 2023

So I recreated producer with -m cmake_lib as you said and whilst PACKAGE_ROOT is still None, the header search paths and library search paths seem to have different values now:

❯ diff -rup conan-install-xcode/conan_producer_producer_release_arm64.xcconfig  conan-editable-xcode/conan_producer_producer_release_arm64.xcconfig
--- conan-install-xcode/conan_producer_producer_release_arm64.xcconfig	2023-01-04 16:18:30.000000000 +0200
+++ conan-editable-xcode/conan_producer_producer_release_arm64.xcconfig	2023-01-04 16:18:50.000000000 +0200
@@ -1,11 +1,11 @@
-PACKAGE_ROOT_producer[config=Release][arch=arm64][sdk=*] = /Users/kovimi/Developer/conan-xcode-bug/local-conan-home/.conan/data/producer/0.1/_/_/package/f7023de70d0bfc63077b5172ade69e4423b9047c
+PACKAGE_ROOT_producer[config=Release][arch=arm64][sdk=*] = None
 // Compiler options for producer::producer
-HEADER_SEARCH_PATHS_producer_producer[config=Release][arch=arm64][sdk=*] = "/Users/kovimi/Developer/conan-xcode-bug/local-conan-home/.conan/data/producer/0.1/_/_/package/f7023de70d0bfc63077b5172ade69e4423b9047c/include"
+HEADER_SEARCH_PATHS_producer_producer[config=Release][arch=arm64][sdk=*] = "/Users/kovimi/Developer/conan-xcode-bug/producer/./include"
 GCC_PREPROCESSOR_DEFINITIONS_producer_producer[config=Release][arch=arm64][sdk=*] =
 OTHER_CFLAGS_producer_producer[config=Release][arch=arm64][sdk=*] =
 OTHER_CPLUSPLUSFLAGS_producer_producer[config=Release][arch=arm64][sdk=*] =
 FRAMEWORK_SEARCH_PATHS_producer_producer[config=Release][arch=arm64][sdk=*] =

 // Link options for producer::producer
-LIBRARY_SEARCH_PATHS_producer_producer[config=Release][arch=arm64][sdk=*] = "/Users/kovimi/Developer/conan-xcode-bug/local-conan-home/.conan/data/producer/0.1/_/_/package/f7023de70d0bfc63077b5172ade69e4423b9047c/lib"
+LIBRARY_SEARCH_PATHS_producer_producer[config=Release][arch=arm64][sdk=*] = "/Users/kovimi/Developer/conan-xcode-bug/producer/build/Release/."
 OTHER_LDFLAGS_producer_producer[config=Release][arch=arm64][sdk=*] =  -lproducer

Not sure if PACKAGE_ROOT being None brings me any issues or not, but it seems that the different value for search paths is caused by includedirs and libdirs not being specified in the "new" producer.

@memsharded
Copy link
Member

Not sure if PACKAGE_ROOT being None brings me any issues or not, but it seems that the different value for search paths is caused by includedirs and libdirs not being specified in the "new" producer.

My PR will fix it, so this shouldn't be an issue.

The main difference is the new layout() method. That produces a whole new behavior regarding paths, editables, etc.
Please try if the project builds and links now, I think it should with the new paths.

@ghost
Copy link
Author

ghost commented Jan 4, 2023

I did use cmake_layout in my original conanfile.py. The difference was caused by components IIUC

@memsharded
Copy link
Member

This was closed by #12841, the original None issue is fixed, and defining the components in the layout() method should work. Please re-open or create a new ticket with details if it doesn't work. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant