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

MSYS2/MinGW, GCC: compilation errors related to locale_t type #1998

Closed
LigH-de opened this issue Mar 2, 2023 · 9 comments
Closed

MSYS2/MinGW, GCC: compilation errors related to locale_t type #1998

LigH-de opened this issue Mar 2, 2023 · 9 comments

Comments

@LigH-de
Copy link

LigH-de commented Mar 2, 2023

Trying to compile ffmpeg with lensfun in the media-autobuild suite, an MSYS2/MinGW environment which keeps itself up to date before compiling (here with GCC 12) many modules linked into ffmpeg, verbosely logging all issues.

Excerpt:

...
G:/MABS/build/lensfun-git/libs/lensfun/database.cpp: In member function 'lfError lfDatabase::Load(const char*, const char*, size_t)':
G:/MABS/build/lensfun-git/libs/lensfun/database.cpp:826:27: error: 'locale_t' was not declared in this scope; did you mean '_locale_t'?
  826 |     auto loc = uselocale((locale_t) 0); // get current local
      |                           ^~~~~~~~
      |                           _locale_t
G:/MABS/build/lensfun-git/libs/lensfun/database.cpp:826:16: error: 'uselocale' was not declared in this scope; did you mean 'setlocale'?
  826 |     auto loc = uselocale((locale_t) 0); // get current local
      |                ^~~~~~~~~
      |                setlocale
G:/MABS/build/lensfun-git/libs/lensfun/database.cpp:827:27: error: 'LC_NUMERIC_MASK' was not declared in this scope; did you mean 'LC_NUMERIC'?
  827 |     auto nloc = newlocale(LC_NUMERIC_MASK, "C", (locale_t) 0);
      |                           ^~~~~~~~~~~~~~~
      |                           LC_NUMERIC
G:/MABS/build/lensfun-git/libs/lensfun/database.cpp:827:59: error: expected ')' before numeric constant
  827 |     auto nloc = newlocale(LC_NUMERIC_MASK, "C", (locale_t) 0);
      |                          ~                                ^~
      |                                                           )
G:/MABS/build/lensfun-git/libs/lensfun/database.cpp:827:17: error: 'newlocale' was not declared in this scope; did you mean 'setlocale'?
  827 |     auto nloc = newlocale(LC_NUMERIC_MASK, "C", (locale_t) 0);
      |                 ^~~~~~~~~
      |                 setlocale
G:/MABS/build/lensfun-git/libs/lensfun/database.cpp:858:5: error: 'freelocale' was not declared in this scope; did you mean '_free_locale'?
  858 |     freelocale(nloc);
      |     ^~~~~~~~~~
      |     _free_locale
G:/MABS/build/lensfun-git/libs/lensfun/database.cpp: In member function 'lfError lfDatabase::Save(char*&, size_t&) const':
G:/MABS/build/lensfun-git/libs/lensfun/database.cpp:901:27: error: 'locale_t' was not declared in this scope; did you mean '_locale_t'?
  901 |     auto loc = uselocale((locale_t) 0); // get current local
      |                           ^~~~~~~~
      |                           _locale_t
G:/MABS/build/lensfun-git/libs/lensfun/database.cpp:901:16: error: 'uselocale' was not declared in this scope; did you mean 'setlocale'?
  901 |     auto loc = uselocale((locale_t) 0); // get current local
      |                ^~~~~~~~~
      |                setlocale
G:/MABS/build/lensfun-git/libs/lensfun/database.cpp:902:27: error: 'LC_NUMERIC_MASK' was not declared in this scope; did you mean 'LC_NUMERIC'?
  902 |     auto nloc = newlocale(LC_NUMERIC_MASK, "C", (locale_t) 0);
      |                           ^~~~~~~~~~~~~~~
      |                           LC_NUMERIC
G:/MABS/build/lensfun-git/libs/lensfun/database.cpp:902:59: error: expected ')' before numeric constant
  902 |     auto nloc = newlocale(LC_NUMERIC_MASK, "C", (locale_t) 0);
      |                          ~                                ^~
      |                                                           )
G:/MABS/build/lensfun-git/libs/lensfun/database.cpp:902:17: error: 'newlocale' was not declared in this scope; did you mean 'setlocale'?
  902 |     auto nloc = newlocale(LC_NUMERIC_MASK, "C", (locale_t) 0);
      |                 ^~~~~~~~~
      |                 setlocale
G:/MABS/build/lensfun-git/libs/lensfun/database.cpp:1144:5: error: 'freelocale' was not declared in this scope; did you mean '_free_locale'?
 1144 |     freelocale(nloc);
      |     ^~~~~~~~~~
      |     _free_locale
...

logs.zip collected by the suite.

@Biswa96
Copy link
Contributor

Biswa96 commented Mar 2, 2023

Would you like to check if the linked pull request fixes the issue?

@LigH-de
Copy link
Author

LigH-de commented Mar 2, 2023

Unfortunately I don't know how to edit the suite to make it pull this state instead of HEAD. I am not a developer, just a half-wit user.

@Biswa96
Copy link
Contributor

Biswa96 commented Mar 2, 2023

You can find the database.cpp and lens.cpp files in your project directory and replace _MSC_VER with PLATFORM_WINDOWS in any text editor.

@newcapricasean
Copy link

How would one amend the m-ab-s/media-autobuild_suite script to pass this parameter over to the lensfun build?

build_lensfun() {
build_glib
do_git_checkout https://github.com/lensfun/lensfun.git lensfun_git
cd lensfun_git
export CMAKE_STATIC_LINKER_FLAGS='-lws2_32 -pthread'
do_cmake "-DBUILD_STATIC=on -DCMAKE_INSTALL_DATAROOTDIR=$mingw_w64_x86_64_prefix"
do_make
do_make_install
sed -i.bak 's/-llensfun/-llensfun -lstdc++/' "$PKG_CONFIG_PATH/lensfun.pc"
unset CMAKE_STATIC_LINKER_FLAGS
cd ..
}

Could I just add "-CMAKE_SYSTEM_NAME=Windows" to CMAKE_STATIC_LINKER_FLAGS='-lws2_32 -pthread' ???

@LigH-de
Copy link
Author

LigH-de commented Mar 2, 2023

There is a script build/media-suite_deps.sh with all the URLs to the repositories.

I'm just testing if it works with SOURCE_REPO_LENSFUN=https://github.com/Biswa96/lensfun.git ... please wait ...
__

Wrong attempt.

Adding https://github.com/lensfun/lensfun/pull/1999.patch to build/media-suite_compile.sh instead, just for testing.

@newcapricasean
Copy link

Testing as well...

@LigH-de
Copy link
Author

LigH-de commented Mar 2, 2023

Builds for me. Probably safe to commit.

@LigH-de
Copy link
Author

LigH-de commented Mar 16, 2023

Waiting for a commit.

@Biswa96
Copy link
Contributor

Biswa96 commented Aug 10, 2023

This has been fixed in upstream 6cb00f4

@LigH-de LigH-de closed this as completed Aug 10, 2023
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

Successfully merging a pull request may close this issue.

3 participants