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

v11.0+ fails to build on Amiga and Xbox #4054

Closed
glebm opened this issue Jul 6, 2024 · 10 comments
Closed

v11.0+ fails to build on Amiga and Xbox #4054

glebm opened this issue Jul 6, 2024 · 10 comments

Comments

@glebm
Copy link
Contributor

glebm commented Jul 6, 2024

fmt from v11.0.0 onwards (6b68dff) no longer builds for Amiga and Xbox, with the same error on both:

fmt/format-inl.h:1638:5: error: 'flockfile' was not declared in this scope
 1638 |     flockfile(f);
      |     ^~~~~~~~~
fmt/format-inl.h: In destructor 'fmt::v11::detail::file_print_buffer::~file_print_buffer()':
fmt/format-inl.h:1646:5: error: 'funlockfile' was not declared in this scope; did you mean 'fallback_file'?
 1646 |     funlockfile(file_);
      |     ^~~~~~~~~~~
      |     fallback_file

Would it be possible to add a define to avoid using lock/unlock/getc_unlocked, so that it can be built on platforms that do not support these functions?

@vitaut
Copy link
Contributor

vitaut commented Jul 6, 2024

Just removing these calls might be undesirable. I think we should figure out what printf does on these systems and do something similar.

@vitaut
Copy link
Contributor

vitaut commented Jul 6, 2024

@glebm
Copy link
Contributor Author

glebm commented Jul 8, 2024

Got a response in the Xbox issue: XboxDev/nxdk#672 (comment)

@jwillikers
Copy link
Contributor

jwillikers commented Jul 8, 2024

I see these same errors attempting to build for a microcontroller with both newlib and picolibc:

In file included from /home/jordan/.conan2/p/b/fmtc75dbc04c5faa/b/src/src/format.cc:8:
/home/jordan/.conan2/p/b/fmtc75dbc04c5faa/b/src/include/fmt/format-inl.h: In constructor 'fmt::v11::detail::file_print_buffer::file_print_buffer(FILE*)':
/home/jordan/.conan2/p/b/fmtc75dbc04c5faa/b/src/include/fmt/format-inl.h:1638:5: error: 'flockfile' was not declared in this scope; did you mean '_flockfile'?
 1638 |     flockfile(f);
      |     ^~~~~~~~~
      |     _flockfile
/home/jordan/.conan2/p/b/fmtc75dbc04c5faa/b/src/include/fmt/format-inl.h: In destructor 'fmt::v11::detail::file_print_buffer::~file_print_buffer()':
/home/jordan/.conan2/p/b/fmtc75dbc04c5faa/b/src/include/fmt/format-inl.h:1646:5: error: 'funlockfile' was not declared in this scope; did you mean '_funlockfile'?
 1646 |     funlockfile(file_);
      |     ^~~~~~~~~~~
      |     _funlockfile

@xiyoo0812
Copy link

Similarly, it is not possible to build on PS4 and PS5

@vitaut
Copy link
Contributor

vitaut commented Jul 8, 2024

Added flockfile detection in 486838f. Note that providing flockfile/funlockfile is a better solution especially on platforms targeted by these C library implementations because it prevents dynamic memory allocations in the common case. It also seems trivial to do since they already have the necessary primitives, they just have wrong names, e.g. __STDIO_LOCK instead of flockfile.

@vitaut
Copy link
Contributor

vitaut commented Jul 8, 2024

@glebm could you verify that it fixes the problem on Amiga?

@glebm
Copy link
Contributor Author

glebm commented Jul 8, 2024

@vitaut The build is still failing but now the errors are different

@vitaut
Copy link
Contributor

vitaut commented Jul 8, 2024

A more complete fix: 92227c7.

@glebm
Copy link
Contributor Author

glebm commented Jul 8, 2024

All builds are now green! Thank you for the fix!

@glebm glebm closed this as completed Jul 8, 2024
mtremer pushed a commit to ipfire/ipfire-2.x that referenced this issue Aug 15, 2024
- Update from version 11.0.1 to 11.0.2
- Update of rootfile
- Changelog
    11.0.2
	- Fixed compatibility with non-POSIX systems
	  (fmtlib/fmt#4054,
	  fmtlib/fmt#4060).
	- Fixed performance regressions when using `std::back_insert_iterator` with
	  `fmt::format_to` (fmtlib/fmt#4070).
	- Fixed handling of `std::generator` and move-only iterators
	  (fmtlib/fmt#4053,
	  fmtlib/fmt#4057). Thanks @Arghnews.
	- Made `formatter<std::string_view>::parse` work with types convertible to
	  `std::string_view` (fmtlib/fmt#4036,
	  fmtlib/fmt#4055). Thanks @Arghnews.
	- Made `volatile void*` formattable
	  (fmtlib/fmt#4049,
	  fmtlib/fmt#4056). Thanks @Arghnews.
	- Made `Glib::ustring` not be confused with `std::string`
	  (fmtlib/fmt#4052).
	- Made `fmt::context` iterator compatible with STL algorithms that rely on
	  iterator category (fmtlib/fmt#4079).

Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
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

No branches or pull requests

4 participants