Opened 2 months ago

Closed 2 months ago

#69524 closed defect (fixed)

rawstudio does not build again: error: unknown type name 'xmlDocPtr' etc.

Reported by: barracuda156 Owned by: barracuda156
Priority: Normal Milestone:
Component: ports Version: 2.9.1
Keywords: Cc:
Port: rawstudio

Description

:info:build libtool: compile:  /opt/local/bin/gcc-mp-13 -DHAVE_CONFIG_H -I. -I.. -I.. -DWITH_GCONF -isystem/opt/local/include/LegacySupport -I/opt/local/include -Wall -fno-strict-aliasing -DPACKAGE_DATA_DIR=\"/opt/local/share\" -DPACKAGE_LIBRARY_DIR=\"/opt/local/lib/rawstudio/plugins\" -DPACKAGE_LOCALE_DIR=\"/opt/local/share/locale\" -I/opt/local/include/gtk-3.0 -I/opt/local/include/at-spi2-atk/2.0 -I/opt/local/include/at-spi-2.0 -I/opt/local/include/dbus-1.0 -I/opt/local/lib/dbus-1.0/include -I/opt/local/include/gtk-3.0 -I/opt/local/include/gio-unix-2.0 -I/opt/local/include/cairo -I/opt/local/include/pango-1.0 -I/opt/local/include/harfbuzz -I/opt/local/include/pango-1.0 -I/opt/local/include/fribidi -I/opt/local/include/harfbuzz -I/opt/local/include/atk-1.0 -I/opt/local/include/cairo -I/opt/local/include/pixman-1 -I/opt/local/include/freetype2 -I/opt/local/include/gdk-pixbuf-2.0 -I/opt/local/include/libpng16 -I/opt/local/include/libxml2 -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -DORBIT2=1 -I/opt/local/include/gconf/2 -I/opt/local/include/orbit-2.0 -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include/lensfun -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -pipe -Os -arch ppc -MT rs-lens-db-editor.lo -MD -MP -MF .deps/rs-lens-db-editor.Tpo -c rs-lens-db-editor.c -o rs-lens-db-editor.o >/dev/null 2>&1
:info:build rs-lens-fix.c: In function 'rs_lens_fix_init':
:info:build rs-lens-fix.c:248:9: error: unknown type name 'xmlDocPtr'
:info:build   248 |         xmlDocPtr doc;
:info:build       |         ^~~~~~~~~
:info:build rs-lens-fix.c:249:9: error: unknown type name 'xmlNodePtr'
:info:build   249 |         xmlNodePtr cur;
:info:build       |         ^~~~~~~~~~
:info:build rs-lens-fix.c:250:9: error: unknown type name 'xmlNodePtr'
:info:build   250 |         xmlNodePtr entry = NULL;
:info:build       |         ^~~~~~~~~~
:info:build rs-lens-fix.c:250:28: warning: initialization of 'int' from 'void *' makes integer from pointer without a cast [-Wint-conversion]
:info:build   250 |         xmlNodePtr entry = NULL;
:info:build       |                            ^~~~
:info:build rs-lens-fix.c:251:9: error: unknown type name 'xmlChar'
:info:build   251 |         xmlChar *val;
:info:build       |         ^~~~~~~
:info:build rs-lens-fix.c:266:15: warning: implicit declaration of function 'xmlParseFile' [-Wimplicit-function-declaration]
:info:build   266 |         doc = xmlParseFile(filename);
:info:build       |               ^~~~~~~~~~~~
:info:build libtool: compile:  /opt/local/bin/gcc-mp-13 -DHAVE_CONFIG_H -I. -I.. -I.. -DWITH_GCONF -isystem/opt/local/include/LegacySupport -I/opt/local/include -Wall -fno-strict-aliasing -DPACKAGE_DATA_DIR=\"/opt/local/share\" -DPACKAGE_LIBRARY_DIR=\"/opt/local/lib/rawstudio/plugins\" -DPACKAGE_LOCALE_DIR=\"/opt/local/share/locale\" -I/opt/local/include/gtk-3.0 -I/opt/local/include/at-spi2-atk/2.0 -I/opt/local/include/at-spi-2.0 -I/opt/local/include/dbus-1.0 -I/opt/local/lib/dbus-1.0/include -I/opt/local/include/gtk-3.0 -I/opt/local/include/gio-unix-2.0 -I/opt/local/include/cairo -I/opt/local/include/pango-1.0 -I/opt/local/include/harfbuzz -I/opt/local/include/pango-1.0 -I/opt/local/include/fribidi -I/opt/local/include/harfbuzz -I/opt/local/include/atk-1.0 -I/opt/local/include/cairo -I/opt/local/include/pixman-1 -I/opt/local/include/freetype2 -I/opt/local/include/gdk-pixbuf-2.0 -I/opt/local/include/libpng16 -I/opt/local/include/libxml2 -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -DORBIT2=1 -I/opt/local/include/gconf/2 -I/opt/local/include/orbit-2.0 -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include/lensfun -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -pipe -Os -arch ppc -MT rs-filetypes.lo -MD -MP -MF .deps/rs-filetypes.Tpo -c rs-filetypes.c  -fno-common -DPIC -o .libs/rs-filetypes.o
:info:build rs-lens-fix.c:275:15: warning: implicit declaration of function 'xmlDocGetRootElement' [-Wimplicit-function-declaration]
:info:build   275 |         cur = xmlDocGetRootElement(doc);
:info:build       |               ^~~~~~~~~~~~~~~~~~~~
:info:build rs-lens-fix.c:276:21: warning: implicit declaration of function 'xmlStrcmp'; did you mean 'strcmp'? [-Wimplicit-function-declaration]
:info:build   276 |         if (cur && (xmlStrcmp(cur->name, BAD_CAST "rawstudio-lens-fix") == 0))
:info:build       |                     ^~~~~~~~~
:info:build       |                     strcmp
:info:build rs-lens-fix.c:276:34: error: invalid type argument of '->' (have 'int')
:info:build   276 |         if (cur && (xmlStrcmp(cur->name, BAD_CAST "rawstudio-lens-fix") == 0))
:info:build       |                                  ^~
:info:build rs-lens-fix.c:276:42: error: 'BAD_CAST' undeclared (first use in this function)
:info:build   276 |         if (cur && (xmlStrcmp(cur->name, BAD_CAST "rawstudio-lens-fix") == 0))
:info:build       |                                          ^~~~~~~~
:info:build rs-lens-fix.c:276:42: note: each undeclared identifier is reported only once for each function it appears in
:info:build rs-lens-fix.c:276:50: error: expected ')' before string constant
:info:build   276 |         if (cur && (xmlStrcmp(cur->name, BAD_CAST "rawstudio-lens-fix") == 0))
:info:build       |                              ~                   ^~~~~~~~~~~~~~~~~~~~~
:info:build       |                                                  )
:info:build rs-lens-fix.c:278:26: error: invalid type argument of '->' (have 'int')
:info:build   278 |                 cur = cur->xmlChildrenNode;
:info:build       |                          ^~
:info:build rs-lens-fix.c:281:44: error: invalid type argument of '->' (have 'int')
:info:build   281 |                         if ((!xmlStrcmp(cur->name, BAD_CAST "lens")))
:info:build       |                                            ^~
:info:build rs-lens-fix.c:281:60: error: expected ')' before string constant
:info:build   281 |                         if ((!xmlStrcmp(cur->name, BAD_CAST "lens")))
:info:build       |                                        ~                   ^~~~~~~
:info:build       |                                                            )

Change History (15)

comment:1 Changed 2 months ago by ryandesign (Ryan Carsten Schmidt)

Incompatibility with libxml2 2.12.x, I'm sure. I've fixed similar in several ports already.

The last commit in the rawstudio repository was 3 years ago. libxml2 2.12.x came out more recently than that so they haven't fixed this yet. I also don't see an issue about it in their issue tracker. I'd start by filing an issue there. However, they haven't responded to the 4-month-old bug report that it doesn't build with exiv2 0.28.x, so they may not respond to a new issue either and you may have to work on the fix yourself.

I haven't updated exiv2 to 0.28.x because of the amount of breakage it will cause so if you can incorporate the patches for exiv2 0.28.x support as well, if you haven't already, that will be of help in moving that forward too.

comment:2 in reply to:  1 ; Changed 2 months ago by barracuda156

Replying to ryandesign:

Incompatibility with libxml2 2.12.x, I'm sure. I've fixed similar in several ports already.

Thank you, that is indeed the case, and I have fixed the build now (was a matter of two headers), however it does not work, unfortunately, for unrelated reasons.

On Sonoma it fails to launch on:

svacchanda@Sergeys-Air ~ % rawstudio
dlopen(/opt/local/lib/rawstudio/plugins/denoise.so, 0x000A): symbol not found in flat namespace '__Z22rs_detect_cpu_featuresv'
**
ERROR:rs-plugin-manager.c:56:rs_plugin_manager_load_all_plugins: assertion failed: (g_type_module_use(G_TYPE_MODULE(plugin)))
Bail out! ERROR:rs-plugin-manager.c:56:rs_plugin_manager_load_all_plugins: assertion failed: (g_type_module_use(G_TYPE_MODULE(plugin)))
zsh: abort      rawstudio

On 10.6 ppc it fails to launch on:

36-156% rawstudio
dlopen(/opt/local/lib/rawstudio/plugins/dcp.so, 10): Symbol not found: _exposure_ramp
  Referenced from: /opt/local/lib/rawstudio/plugins/dcp.so
  Expected in: dynamic lookup

**
ERROR:rs-plugin-manager.c:56:rs_plugin_manager_load_all_plugins: assertion failed: (g_type_module_use(G_TYPE_MODULE(plugin)))
Bail out! ERROR:rs-plugin-manager.c:56:rs_plugin_manager_load_all_plugins: assertion failed: (g_type_module_use(G_TYPE_MODULE(plugin)))
zsh: abort      rawstudio
Last edited 2 months ago by barracuda156 (previous) (diff)

comment:3 Changed 2 months ago by barracuda156

UPD. Ah, that bug was there already: https://github.com/rawstudio/rawstudio/issues/82#issuecomment-1223877154 Not sure about Sonoma one, maybe arm64 is not properly supported.

comment:4 in reply to:  2 Changed 2 months ago by ryandesign (Ryan Carsten Schmidt)

Replying to barracuda156:

On Sonoma it fails to launch on:

svacchanda@Sergeys-Air ~ % rawstudio
dlopen(/opt/local/lib/rawstudio/plugins/denoise.so, 0x000A): symbol not found in flat namespace '__Z22rs_detect_cpu_featuresv'
**
ERROR:rs-plugin-manager.c:56:rs_plugin_manager_load_all_plugins: assertion failed: (g_type_module_use(G_TYPE_MODULE(plugin)))
Bail out! ERROR:rs-plugin-manager.c:56:rs_plugin_manager_load_all_plugins: assertion failed: (g_type_module_use(G_TYPE_MODULE(plugin)))
zsh: abort      rawstudio

I can confirm that on Monterey x86_64.

comment:5 Changed 2 months ago by ryandesign (Ryan Carsten Schmidt)

My observations about this are:

rs_detect_cpu_features is defined in librawstudio, which is a C library, so the symbol in the library is _rs_detect_cpu_features.

denoise.so doesn't link with librawstudio; none of the plugins do. Maybe that's not required if they're loaded by the main rawstudio program since rawstudio does link with librawstudio.

Of the 5 plugins that use rs_detect_cpu_features, denoise is the only one written in C++. All the others are C and correctly reference the _rs_detect_cpu_features symbol. denoise, being a C++ plugin, references the name-mangled symbol, __Z22rs_detect_cpu_featuresv, which doesn't exist.

rawstudio.h uses the correct trick to tell any C++ code including it that the library's functions are C functions that should not be name-mangled:

#ifdef  __cplusplus
extern "C" {
#endif
#ifdef  __cplusplus
} /* extern "c" */
#endif

There is one rawstudio header—rs-types.h—included outside of that #ifdef, but rs-types.h doesn't include any other rawstudio headers and only defines datatypes so I don't think that would be the cause.

So I'm not sure yet why denoise is using the name-mangled symbol when it shouldn't.

Last edited 2 months ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:6 in reply to:  5 ; Changed 2 months ago by ryandesign (Ryan Carsten Schmidt)

Replying to ryandesign:

rawstudio.h uses the correct trick to tell any C++ code including it that the library's functions are C functions that should not be name-mangled:

#ifdef  __cplusplus
extern "C" {
#endif
#ifdef  __cplusplus
} /* extern "c" */
#endif

Ah. The problem is you added a patchfile to remove those. Why? (Not one of the 52 comments in the PR that made this change appears to have questioned it.)

I do see that they removed this guard on 20210523 but they put it back on 20210526.

If I remove this part of your patch and add the fix for the libxml2 2.12 problem then the port builds and does not have the denoise.so error on startup.

comment:7 in reply to:  6 Changed 2 months ago by barracuda156

Replying to ryandesign:

Ah. The problem is you added a patchfile to remove those. Why? (Not one of the 52 comments in the PR that made this change appears to have questioned it.)

I do see that they removed this guard on 20210523 but they put it back on 20210526.

If I remove this part of your patch and add the fix for the libxml2 2.12 problem then the port builds and does not have the denoise.so error on startup.

Thank you! I do not remember now, there was some reason (I am not saying the patch was correct, but it would not have been added without an underlying issue).

Let me sort symbols issue on PPC, once that works, I make a PR to sort this out (and drop that part of the patch which causes a breakage).

comment:8 in reply to:  6 Changed 2 months ago by barracuda156

Replying to ryandesign:

So on powerpc symbols that are not found at runtime have a form of inline something. For example, inline guint clampbits16(gint x) in demosaic plugin. What is the correct way to fix that?

comment:9 Changed 2 months ago by ryandesign (Ryan Carsten Schmidt)

On PowerPC you're using gcc which might have different inline semantincs from clang and in addition IIRC inline semantics differed in c89 and c99 modes. I'd have to do some research.

comment:10 in reply to:  9 Changed 2 months ago by barracuda156

Replying to ryandesign:

On PowerPC you're using gcc which might have different inline semantincs from clang and in addition IIRC inline semantics differed in c89 and c99 modes. I'd have to do some research.

I think I was struggling back then to make it build with clang. I have dropped patch-rawstudio.h.diff completely, and it still builds fine with gcc. It does not help, however, the symbols are still not found.

comment:11 Changed 2 months ago by ryandesign (Ryan Carsten Schmidt)

How about committing the fix for the issue this ticket was filed for (error: unknown type name 'xmlDocPtr'), and the second issue you mentioned (symbol not found in flat namespace '__Z22rs_detect_cpu_featuresv'), and leave the third issue for later.

comment:12 in reply to:  11 Changed 2 months ago by barracuda156

Replying to ryandesign:

How about committing the fix for the issue this ticket was filed for (error: unknown type name 'xmlDocPtr'), and the second issue you mentioned (symbol not found in flat namespace '__Z22rs_detect_cpu_featuresv'), and leave the third issue for later.

Will be done today.

comment:14 in reply to:  11 Changed 2 months ago by barracuda156

Replying to ryandesign:

How about committing the fix for the issue this ticket was filed for (error: unknown type name 'xmlDocPtr'), and the second issue you mentioned (symbol not found in flat namespace '__Z22rs_detect_cpu_featuresv'), and leave the third issue for later.

Ryan, could we merge it, if you are happy with the changes?

comment:15 Changed 2 months ago by barracuda156

Resolution: fixed
Status: assignedclosed

In dbf0fb102d2213c13395499d6e87dbfe77d73897/macports-ports (master):

rawstudio: fix build with new libxml2

Fixes: #69524

Note: See TracTickets for help on using tickets.