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

Add objfw dependency #13067

Merged
merged 4 commits into from
Apr 28, 2024
Merged

Add objfw dependency #13067

merged 4 commits into from
Apr 28, 2024

Conversation

Midar
Copy link
Contributor

@Midar Midar commented Apr 10, 2024

No description provided.

@Midar Midar force-pushed the objfw branch 2 times, most recently from 8a7dec1 to 46e553f Compare April 12, 2024 22:13
@dcbaker
Copy link
Member

dcbaker commented Apr 18, 2024

The Windows check failures do seem to be relevant, I think they're related to the changing the order of the compilers, since it looks like before that the test skipped on windows.

@Midar Midar force-pushed the objfw branch 4 times, most recently from dfb23dc to ed3ba44 Compare April 21, 2024 08:21
@Midar
Copy link
Contributor Author

Midar commented Apr 21, 2024

The Windows check failures do seem to be relevant, I think they're related to the changing the order of the compilers, since it looks like before that the test skipped on windows.

That should be addressed now. It seems Meson expects MSVC-syntax from Clang on Windows, so it needs to be clang-cl instead.

@tristan957
Copy link
Contributor

This needs documentation

@Midar Midar force-pushed the objfw branch 2 times, most recently from f7ef5f8 to 4e0cfb3 Compare April 22, 2024 19:41
@Midar
Copy link
Contributor Author

Midar commented Apr 22, 2024

This needs documentation

Done.

Copy link
Member

@dcbaker dcbaker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few small nits, otherwise this looks good to me to land

mesonbuild/dependencies/misc.py Outdated Show resolved Hide resolved
endif

executable('SimpleTest', 'SimpleTest.m',
dependencies: [objfw_dep])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please merge the new 5 and 6 tests into a single test. Meson startup overhead is the longest pull in CI, and so we've moved to have fewer, but more complex tests rather than many simple ones.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ObjFWTest is very new it looks like, which means that it's very likely for people with the framework installed to not have this and end up with the whole test being skipped.

Is it possible to use a different module that has been around for longer to do the test that modules: works?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dcbaker Done.
@eli-schwartz Unfortunately, ObjFWTest is the first module ObjFW ships with. All others are 3rd party.

Copy link
Member

@eli-schwartz eli-schwartz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[5/5] clang  -o exe1 exe1.p/main.c.o -Wl,--as-needed -Wl,--no-undefined subprojects/cmTest/libcmTest.a
FAILED: exe1 
clang  -o exe1 exe1.p/main.c.o -Wl,--as-needed -Wl,--no-undefined subprojects/cmTest/libcmTest.a
/usr/bin/ld: subprojects/cmTest/libcmTest.a.p/cmTest.c.o: relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: failed to set dynamic section sizes: bad value
clang-15.0: error: linker command failed with exit code 1 (use -v to see invocation)

This looks related. The OpenSUSE runner is building C with cc and ObjC with clang, then linking with clang. For some reason it doesn't like that but the reason it doesn't like it is because of PIE??

docs/markdown/Dependencies.md Outdated Show resolved Hide resolved
endif

executable('SimpleTest', 'SimpleTest.m',
dependencies: [objfw_dep])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ObjFWTest is very new it looks like, which means that it's very likely for people with the framework installed to not have this and end up with the whole test being skipped.

Is it possible to use a different module that has been around for longer to do the test that modules: works?

Copy link
Member

@eli-schwartz eli-schwartz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we install objfw on:

  • macOS CI via brew install in the GitHub actions yaml
  • fedora via ci/ciimages/ in the list of packages

The latter will only start testing once the PR is merged and the images are rebuilt. The skip will function until then (we can check that it passes in Fedora since some image builders might fail, but the Fedora image builder should show objfw running successfully and should be building fine right now).

@Midar
Copy link
Contributor Author

Midar commented Apr 22, 2024

[5/5] clang  -o exe1 exe1.p/main.c.o -Wl,--as-needed -Wl,--no-undefined subprojects/cmTest/libcmTest.a
FAILED: exe1 
clang  -o exe1 exe1.p/main.c.o -Wl,--as-needed -Wl,--no-undefined subprojects/cmTest/libcmTest.a
/usr/bin/ld: subprojects/cmTest/libcmTest.a.p/cmTest.c.o: relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: failed to set dynamic section sizes: bad value
clang-15.0: error: linker command failed with exit code 1 (use -v to see invocation)

This looks related. The OpenSUSE runner is building C with cc and ObjC with clang, then linking with clang. For some reason it doesn't like that but the reason it doesn't like it is because of PIE??

That does look to me like a very OpenSUSE-specific error where they probably force them flags on the linker. I'm guessing this is yet another case of "No proper separation between compilers / languages in Meson", so I'm not sure what to do about it.

@Midar
Copy link
Contributor Author

Midar commented Apr 22, 2024

Could we install objfw on:

* macOS CI via brew install in the GitHub actions yaml

* fedora via ci/ciimages/ in the list of packages

The latter will only start testing once the PR is merged and the images are rebuilt. The skip will function until then (we can check that it passes in Fedora since some image builders might fail, but the Fedora image builder should show objfw running successfully and should be building fine right now).

Added a commit.

Copy link
Member

@dcbaker dcbaker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of my concerns have been addressed, so when @eli-schwartz is happy with this it can be merged

@Midar
Copy link
Contributor Author

Midar commented Apr 23, 2024

Could we install objfw on:

* macOS CI via brew install in the GitHub actions yaml

* fedora via ci/ciimages/ in the list of packages

The latter will only start testing once the PR is merged and the images are rebuilt. The skip will function until then (we can check that it passes in Fedora since some image builders might fail, but the Fedora image builder should show objfw running successfully and should be building fine right now).

I looked into this and this is a distribution bug: OpenSUSE uses incompatible default flags for GCC and Clang: Their GCC defaults to not using PIE while their clang does. This leaves 2 options:

1.) Ignore the failure as a distribution bug (which it is!)
2.) Let Meson decide whether to use PIE or not and not the distribution, so that it can then consistently compile with PIE / no PIE irregardless of the defaults.

You can easily reproduce this yourself by creating a file called test.c with:

#include <stdio.h>
int main() { puts("Hello world!"); return 0; }

And then compiling like this:

gcc -c test.c
clang test.o

Which will fail. However, this works:

gcc -fPIE -c test.c
clang test.o

As does this:

gcc -c test.c
clang -Wl,-no-pie test.c

In any case, this problem exists irregardless of this PR, it just makes it more visible.

@tristan957
Copy link
Contributor

Seems like we should skip your test on opensuse

@Midar
Copy link
Contributor Author

Midar commented Apr 23, 2024

Seems like we should skip your test on opensuse

It's not even my test that's failing, it's the existing test cases/cmake/24 mixing languages that fails because now Clang is preferred for ObjC (because GCC's ObjC support is close to being useless).

@Midar Midar force-pushed the objfw branch 5 times, most recently from cf72dd8 to bdb74f6 Compare April 23, 2024 22:43
@Midar
Copy link
Contributor Author

Midar commented Apr 23, 2024

Worked around this by always enabling PIE in the test.

@tristan957
Copy link
Contributor

We should get you to rebase on #13133 when it is merged that way the Fedora image builder will succeed. Also, it sounds like if you rebase on master, the Gentoo one will succeed too?

@Midar
Copy link
Contributor Author

Midar commented Apr 23, 2024

Rebased on master for now

@tristan957
Copy link
Contributor

This is good to go pending whether or not we want to wait my PR to merge to rebase on so the Fedora image builder job succeeds.

@Midar Midar force-pushed the objfw branch 2 times, most recently from 89f79d0 to 355b4b5 Compare April 26, 2024 20:44
@Midar
Copy link
Contributor Author

Midar commented Apr 26, 2024

Rebased for the 3rd time now - what's missing to get this merged?

@jpakkane
Copy link
Member

Our development rules prohibit merging MRs that break CI.

@Midar
Copy link
Contributor Author

Midar commented Apr 26, 2024

The problem is that this PR doesn't break things, but it's things already being broken, and every time I rebase, something else has been broken.

I guess then that this means this can never get merged because CI is always broken.

@jpakkane
Copy link
Member

I restarted failed jobs, sadly there is some flakiness in some tests. :(

But for example #13148 has all green CI (except for the lint one which is an actual failure) and that is only one day old.

@eli-schwartz
Copy link
Member

I'm just waiting for the full CI results to come in...

As I pointed out a couple times in the past already -- the development policy is that the CI must be green in order to merge the PR, but "CI image builder" jobs are exempt. You don't need to worry about them, you don't need to rebase to try fixing it, and when I'm ready to merge this PR I will manually check that all required CI jobs pass and that all failures are "just" image builder failures.

At the moment we are fine and this is on track to be merged as long as there are no additional failures. All three red jobs are image builder jobs.

@eli-schwartz
Copy link
Member

eli-schwartz commented Apr 26, 2024

Ok, interesting.

3 hours ago, this passed: https://github.com/mesonbuild/meson/actions/runs/8852155560/job/24310221953

Now it fails in this PR:

[1/15] clang -Ilibalib.dylib.p -I. '-I../test cases/osx/7 bitcode' -I/opt/homebrew/include -fdiagnostics-color=always -fembed-bitcode -Wall -Winvalid-pch -O0 -g -MD -MQ libalib.dylib.p/libfoo.m.o -MF libalib.dylib.p/libfoo.m.o.d -o libalib.dylib.p/libfoo.m.o -c '../test cases/osx/7 bitcode/libfoo.m'
[2/15] clang++ -Ilibblib.dylib.p -I. '-I../test cases/osx/7 bitcode' -I/opt/homebrew/include -fdiagnostics-color=always -fembed-bitcode -Wall -Winvalid-pch -O0 -g -MD -MQ libblib.dylib.p/libbar.mm.o -MF libblib.dylib.p/libbar.mm.o.d -o libblib.dylib.p/libbar.mm.o -c '../test cases/osx/7 bitcode/libbar.mm'
[3/15] clang++ -Ilibbmodule.dylib.p -I. '-I../test cases/osx/7 bitcode' -I/opt/homebrew/include -fdiagnostics-color=always -fembed-bitcode -Wall -Winvalid-pch -O0 -g -MD -MQ libbmodule.dylib.p/libbar.mm.o -MF libbmodule.dylib.p/libbar.mm.o.d -o libbmodule.dylib.p/libbar.mm.o -c '../test cases/osx/7 bitcode/libbar.mm'
[4/15] clang -Ilibamodule.dylib.p -I. '-I../test cases/osx/7 bitcode' -I/opt/homebrew/include -fdiagnostics-color=always -fembed-bitcode -Wall -Winvalid-pch -O0 -g -MD -MQ libamodule.dylib.p/libfoo.m.o -MF libamodule.dylib.p/libfoo.m.o.d -o libamodule.dylib.p/libfoo.m.o -c '../test cases/osx/7 bitcode/libfoo.m'
[5/15] cc -Ilibclib.dylib.p -I. '-I../test cases/osx/7 bitcode' -I/opt/homebrew/include -fdiagnostics-color=always -fembed-bitcode -Wall -Winvalid-pch -O0 -g -MD -MQ libclib.dylib.p/libfile.c.o -MF libclib.dylib.p/libfile.c.o.d -o libclib.dylib.p/libfile.c.o -c '../test cases/osx/7 bitcode/libfile.c'
[6/15] rm -f libalib.a && llvm-ar csrD libalib.a libalib.dylib.p/libfoo.m.o
[7/15] cc -Ilibcmodule.dylib.p -I. '-I../test cases/osx/7 bitcode' -I/opt/homebrew/include -fdiagnostics-color=always -fembed-bitcode -Wall -Winvalid-pch -O0 -g -MD -MQ libcmodule.dylib.p/libfile.c.o -MF libcmodule.dylib.p/libfile.c.o.d -o libcmodule.dylib.p/libfile.c.o -c '../test cases/osx/7 bitcode/libfile.c'
[8/15] rm -f libblib.a && llvm-ar csrD libblib.a libblib.dylib.p/libbar.mm.o
[9/15] clang  -o libalib.dylib libalib.dylib.p/libfoo.m.o -L/opt/homebrew/lib -I/opt/homebrew/include -Wl,-bitcode_bundle -shared -install_name @rpath/libalib.dylib
FAILED: libalib.dylib 
clang  -o libalib.dylib libalib.dylib.p/libfoo.m.o -L/opt/homebrew/lib -I/opt/homebrew/include -Wl,-bitcode_bundle -shared -install_name @rpath/libalib.dylib
ld: -mllvm and -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES) cannot be used together
clang: error: linker command failed with exit code 1 (use -v to see invocation)
[10/15] clang++  -o libblib.dylib libblib.dylib.p/libbar.mm.o -L/opt/homebrew/lib -I/opt/homebrew/include -Wl,-bitcode_bundle -shared -install_name @rpath/libblib.dylib
FAILED: libblib.dylib 
clang++  -o libblib.dylib libblib.dylib.p/libbar.mm.o -L/opt/homebrew/lib -I/opt/homebrew/include -Wl,-bitcode_bundle -shared -install_name @rpath/libblib.dylib
ld: -mllvm and -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES) cannot be used together
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
[11/15] clang  -o libamodule.dylib libamodule.dylib.p/libfoo.m.o -L/opt/homebrew/lib -I/opt/homebrew/include -Wl,-dead_strip_dylibs -bundle -Wl,-undefined,dynamic_lookup
[12/15] cc  -o libclib.dylib libclib.dylib.p/libfile.c.o -L/opt/homebrew/lib -I/opt/homebrew/include -Wl,-bitcode_bundle -shared -install_name @rpath/libclib.dylib
[13/15] clang++  -o libbmodule.dylib libbmodule.dylib.p/libbar.mm.o -L/opt/homebrew/lib -I/opt/homebrew/include -Wl,-dead_strip_dylibs -bundle -Wl,-undefined,dynamic_lookup
ninja: build stopped: subcommand failed.

It's mixing cc for *.c files and clang for *.m files.

ld: -mllvm and -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES) cannot be used together

We are definitely using the latter. The former not, but maybe that is a mistaken diagnosis from using different toolchains? Linking bitcode bundles together is hardly likely to work without a consistent toolchain.

The key insight is here:

C compiler for the host machine: cc (clang 15.0.0 "Apple clang version 15.0.0 (clang-1500.0.40.1)")
C linker for the host machine: cc ld64 1015.7
Objective-C compiler for the host machine: clang (clang 18.1.4)
Objective-C linker for the host machine: clang ld64 1015.7
Objective-C++ compiler for the host machine: clang++ (clang 18.1.4)
Objective-C++ linker for the host machine: clang++ ld64 1015.7

We are trying to use clang in preference to gcc, but what we ended up doing is using clang in preference to the system AppleClang.

@Midar
Copy link
Contributor Author

Midar commented Apr 27, 2024

That's exactly what I mean. This error only came up after rebasing. Every time I rebase to incorporate one fix for CI, it also incorporates something that breaks another test on CI.

Midar added 3 commits April 27, 2024 20:50
GCC only has very limited support for Objective-C and doesn't support
any of the modern features, so whenever Clang is available, it should be
used instead. Essentially, the only reason to ever use GCC for
Objective-C is that Clang simply does not support the target system.
This uses objfw-config to get to the flags, however, there's still
several todos that can only be addressed once dependencies can have
per-language flags.
@Midar Midar force-pushed the objfw branch 2 times, most recently from 91b0e85 to e1afd17 Compare April 27, 2024 22:55
OBJC=clang / OBJCXX=clang++ can pick up a newer Clang that no longer
supports bitcode.
@Midar
Copy link
Contributor Author

Midar commented Apr 28, 2024

Everything but image builders seems to be back to green now -> I'm not rebasing it anymore

@eli-schwartz eli-schwartz merged commit e9363e1 into mesonbuild:master Apr 28, 2024
39 of 43 checks passed
@eli-schwartz
Copy link
Member

Thanks for persevering. :)

@Midar Midar deleted the objfw branch April 28, 2024 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants