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

4.1.0 can't find gettext headers on darwin #2031

Open
ncfavier opened this issue Oct 15, 2023 · 6 comments
Open

4.1.0 can't find gettext headers on darwin #2031

ncfavier opened this issue Oct 15, 2023 · 6 comments
Assignees
Labels
bug Unexpected problem or unintended behavior

Comments

@ncfavier
Copy link

4.1.0 fails to build on x86_64-darwin with the following log: https://gist.github.com/ncfavier/74654ee232fe4c5b20fabdc85b3e2012#file-4-1-0-fail-txt. Also included in that gist is the full build log for 4.0.5.

Notice in particular the following diff:

--- Looking for include file libintl.h
--- Looking for include file libintl.h - found
--- Looking for dgettext
--- Looking for dgettext - found
--- Found Intl: built in to C library
+CMake Warning (dev) at /nix/store/zb41b8ydiacljd0cz9p7b11az01sda6r-cmake-3.26.4/share/cmake-3.26/Modules/CheckIncludeFiles.cmake:121 (message):
+  Policy CMP0075 is not set: Include file check macros honor
+  CMAKE_REQUIRED_LIBRARIES.  Run "cmake --help-policy CMP0075" for policy
+  details.  Use the cmake_policy command to set the policy and suppress this
+  warning.
+  CMAKE_REQUIRED_LIBRARIES is set to:
+    /nix/store/9y7gq06wk496bkk4j8iphl5gd4jxgwaa-libiconv-50/lib/libiconv.dylib
+  For compatibility with CMake 3.11 and below this check is ignoring it.
+Call Stack (most recent call first):
+  cmake/FindGettext.cmake:46 (check_include_files)
+  CMakeLists.txt:251 (find_package)
+This warning is for project developers.  Use -Wno-dev to suppress it.
+-- Looking for include file libintl.h
+-- Looking for include file libintl.h - not found
+-- Found Intl: built in to C library
@ncfavier ncfavier added the bug Unexpected problem or unintended behavior label Oct 15, 2023
@flashcode
Copy link
Member

flashcode commented Oct 15, 2023

Hi,

This is happening because WeeChat is more strict when checking required dependencies if CMake option ENABLE_NLS is enabled (default).

If you want translations to be enabled, you need to install the package that provides the header file libintl.h.

If you turn off the CMake option with -DENABLE_NLS=OFF, the compilation should work.

But I did a fix to have a clean error in case the header libintl.h is not found.
Please try to compile current master branch and tell me if it's OK with this fix (CMake should fail with an error before trying to compile source files).
If it's OK, I'll backport this to 4.0 branch (also affecter) and create a branch 4.1 for a future version 4.1.1.

Note: whenever possible, please try the devel version before the release, I'm sad to see such build issue immediately after the release, but thanks to report it anyway!

@flashcode flashcode self-assigned this Oct 15, 2023
@flashcode flashcode added in progress Someone is working on this issue waiting info Waiting for info from author of issue labels Oct 15, 2023
@flashcode
Copy link
Member

Hi,

I'll release 4.1.1 soon that includes this fix.
As I have no way to test on Darwin, could you please test the branch "4.1" (or master branch) and confirm if the fix is OK?

Thanks!

@flashcode flashcode added this to the 4.1.1 milestone Oct 23, 2023
@ncfavier
Copy link
Author

Your "fix" is just raising the error earlier, right? I don't have a darwin machine either and I suspect this is a nix-specific issue anyway, so I'll just disable translations on darwin for now and ask others to look into it.

@flashcode
Copy link
Member

Yes, that's the fix I did.
If you don't have all dependencies to build translations, then yes you have to disable them.

@ncfavier
Copy link
Author

The fix was apparently to add -lintl on darwin:

diff --git cmake/FindGettext.cmake cmake/FindGettext.cmake
index 2460e190b..2cf61a6fe 100644
--- cmake/FindGettext.cmake
+++ cmake/FindGettext.cmake
@@ -42,6 +42,7 @@ find_path(LIBINTL_INCLUDE
 )
 
 set(CMAKE_REQUIRED_INCLUDES ${LIBINTL_INCLUDE})
+set(CMAKE_REQUIRED_FLAGS "-lintl")
 
 check_include_files(libintl.h HAVE_LIBINTL_H)
 

Adding this on linux (where libintl.h is part of libc) makes the header search fail. I have no idea how any of this works, so I can't suggest a proper fix here.

@flashcode
Copy link
Member

OK, thanks for the info, I'll keep this issue open until I find a clean solution.

@flashcode flashcode reopened this Oct 28, 2023
@flashcode flashcode removed waiting info Waiting for info from author of issue in progress Someone is working on this issue labels Oct 28, 2023
@flashcode flashcode removed this from the 4.1.1 milestone Oct 28, 2023
@flashcode flashcode reopened this Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants