Open R1kk3r opened 5 years ago
@v-jizhang I have tried debugging of this issue via code. I have found setting IDE value with key "BUCK_PROJECT_TYPE" in environment Immutable map. I couldn't find any piece of code in this repo.
@surapuramakhil
I'm sure what you are saying. This issue is about the generated xcode project file.
The command
buck project --ide Xcode //:binary
produces a xcode project file but xcode can't build the project using this file.
When depending on
mylib#headers
flavoured target, Buck only uses header files as expected and the library is not used at link time. On the other hand, Xcode see themylib#headers
flavoured target as a complete library and try to link against it, which is not what we want.An easy example is to take the testcase under
test/com/facebook/buck/cxx/testdata/explicit_header_only_caching
You only need to remember that
lib1
contain a function calledlib1_function
.Building with buck
buck build //:binary
Looking at the linking stage of the
binary
, we can see:So it links against the
libdylib-exporting-lib1.dylib
andmain.c.o
andliblib3.a
( both contained insidefilelist.txt
).The final binary does not have the implementation of
lib1_function
and use a reference to the one living insidelibdylib-exporting-lib1.dylib
.This behavior is expected !
Building with Xcode
buck project --ide Xcode //:binary
then building with XcodeLooking at the linking stage of the
binary
, we can see:It links against the
dylib-exporting-lib1.dylib
,lib3.a
,main.c.o
(insidebinary.LinkFileList
) but also againstlib1.a
(it shouldn't).The final binary does have the implementation of
lib1_function
and does not use the one living insidelibdylib-exporting-lib1.dylib
.This behavior is wrong !
We can clearly see in Xcode that the target
lib1
is not really compiled and that it compileslib1#headers
as a library which is not what we want here.