paps icon indicating copy to clipboard operation
paps copied to clipboard

FreeBSD: 0.8.0 fails to build (autoreconf)

Open nunotexbsd opened this issue 2 years ago • 6 comments

Hello,

Trying to update FreeBSD paps port but getting error:

In file included from format_from_dict.cc:23:
./format_from_dict.h:30:23: error: no template named 'variant' in namespace 'std'
using scalar_t = std::variant<int, std::string, double, std::time_t>;
                 ~~~~~^
./format_from_dict.h:31:38: error: use of undeclared identifier 'scalar_t'
using dict_t = std::map<std::string, scalar_t>;
                                     ^
./format_from_dict.h:36:30: error: unknown type name 'dict_t'
                             dict_t dict);
                             ^
format_from_dict.cc:28:32: error: unknown type name 'scalar_t'
static string scalar_to_string(scalar_t scalar,
                               ^
format_from_dict.cc:65:25: error: unknown type name 'dict_t'
                        dict_t dict)
                        ^
--- paps-paps.o ---
In file included from paps.cc:42:
./format_from_dict.h:30:23: error: no template named 'variant' in namespace 'std'
using scalar_t = std::variant<int, std::string, double, std::time_t>;
                 ~~~~~^
./format_from_dict.h:31:38: error: use of undeclared identifier 'scalar_t'
using dict_t = std::map<std::string, scalar_t>;
                                     ^
./format_from_dict.h:36:30: error: unknown type name 'dict_t'
                             dict_t dict);
                             ^
--- paps-format_from_dict.o ---

Any hints on why this build error happens?

Thanks,

Full log: https://people.freebsd.org/~eduardo/logs/paps/paps-0.8.0.log PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=270515

nunotexbsd avatar Mar 29 '23 07:03 nunotexbsd

After adding: USES+= compiler:c++17-lang USE_CXXSTD= c++17

===>  Building for paps-0.8.0
/usr/bin/make  all-recursive
Making all in src
c++ -DHAVE_CONFIG_H -I. -I..  -DGETTEXT_PACKAGE='"paps"' -DDATADIR='"/usr/local/"'   -I/usr/local/include/pango-1.0 -I/usr/local/include -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include -I/usr/local/include/harfbuzz -I/usr/local/include/freetype2 -I/usr/local/include/libpng16 -I/usr/local/include/fribidi -I/usr/local/include/cairo -I/usr/local/include/pixman-1 -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -pthread -D_THREAD_SAFE -D_THREAD_SAFE -I/usr/local/include -O2 -pipe  -fstack-protector-strong -fno-strict-aliasing   -std=c++17 -MT paps-paps.o -MD -MP -MF .deps/paps-paps.Tpo -c -o paps-paps.o `test -f 'paps.cc' || echo './'`paps.cc
paps.cc:703:3: error: use of undeclared identifier 'textdomain'
  textdomain(GETTEXT_PACKAGE);
  ^
paps.cc:704:3: error: use of undeclared identifier 'bindtextdomain'
  bindtextdomain(GETTEXT_PACKAGE, DATADIR "/locale");
  ^
paps.cc:705:3: error: use of undeclared identifier 'bind_textdomain_codeset'
  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
  ^
3 errors generated.
*** Error code 1

nunotexbsd avatar Mar 29 '23 07:03 nunotexbsd

Thanks. I'll add the two flags to the default compilation. Regarding gettext I don't have much experience with it. @tagoh can you help? Did you try compiling with meson?

dov avatar Mar 29 '23 08:03 dov

@dov

Builds fine with meson! Also it adds c++17 to build by default.

Since meson is a newer build system than autoreconf (https://docs.freebsd.org/en/books/porters-handbook/book/#uses-autoreconf), port should use meson. Same for cmake when applicable.

I've updated port for meson use and I'm waiting on #60 because of 32bit support.

Is it good idea to leave this pr open so a solution could be found for autoreconf build?

Thanks

nunotexbsd avatar Mar 29 '23 10:03 nunotexbsd

@dov I didn't but I just tried to switch the build system to meson and that works for me. For gettext errors, those symbols are basically available on glibc on Linux though, BSD libc may not have. You need to make those lines conditional with ENABLE_NLS. Aside from that, AM_GLIB_GNU_GETTEXT m4 macro is deprecated. You may want to replace it with AM_GNU_GETTEXT_VERSION and AM_GNU_GETTEXT. See https://www.gnu.org/software/gettext/manual/html_node/AM_005fGNU_005fGETTEXT.html

tagoh avatar Mar 29 '23 10:03 tagoh

This is version-guarded.

https://github.com/dov/paps/blob/92cadd6db167817e2ede216f7178b753d5ed99ac/src/paps.cc#L54-L67

This isn't?

https://github.com/dov/paps/blob/92cadd6db167817e2ede216f7178b753d5ed99ac/src/paps.cc#L702-L705

On the other hand, what's this?

https://github.com/dov/paps/blob/92cadd6db167817e2ede216f7178b753d5ed99ac/meson.build#L44-L45

eli-schwartz avatar Mar 30 '23 00:03 eli-schwartz

Yes, 2nd quote is what compiler claimed as errors. These lines is required to make paps localized. I'm wondering if this localization support really prevents to build. it can be still optional. For 3rd quote (and localization support in meson build in general), we need to add something like https://mesonbuild.com/Localisation.html#mesonbuild

Apparently current meson.build doesn't have.

tagoh avatar Mar 30 '23 07:03 tagoh