salsaman / LiVES

LiVES is a feature rich application which combines elements of VJ and video editing software. The current version runs on Linux / BSD. Check_out_the_new_discussion_area https://github.com/salsaman/LiVES/discussions
http://lives-video.com
GNU General Public License v3.0
89 stars 11 forks source link

undefined reference to `fourccp_to_weedp' #22

Closed sagitter closed 3 years ago

sagitter commented 3 years ago

Hi again.

After the fix posted in #21, i still obtain:

libtool: link: gcc -fPIE -Wstrict-aliasing=0 -Wall -DHAVE_YUV4MPEG=1 -DHAVE_LDVGRAB=1 -I libavc1394/avc1394.h -I libraw1394/raw1394.h -I libraw1394/rom1394.h -I/usr/include/liboil-0.3 -DENABLE_OIL=1 -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/libxml2 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/gio-unix-2.0 -pthread -DHAVE_WAYLAND=1 -DLIBAV_TRANSCODE=1 -DIS_LINUX_GNU=1 -DENABLE_OSC=1 -DALSA_MIDI=1 -I/usr/include/libpng16 -DUSE_LIBPNG=1 -I/usr/include/ffmpeg -I/usr/include/ffmpeg -DUSE_SWSCALE=1 -DENABLE_JACK=1 -DENABLE_JACK_TRANSPORT=1 -D_REENTRANT -DHAVE_PULSE_AUDIO=1 -DHAVE_PA_STREAM_BEGIN_WRITE=1 -DENABLE_GIW=1 -DHAVE_UNICAP=1 -DNEED_LOCAL_WEED=1 -DNEED_LOCAL_WEED_UTILS=1 -DNEED_LOCAL_WEED_COMPAT=1 -DLIVES_LIBDIR=\"/usr/lib64\" -DHAVE_FREI0R=1 -DHAVE_LADSPA=1 -DHAVE_WEBM=1 -DHAVE_LINUX_JOYSTICK_H=1 -DHAVE_PRCTL=1 -pg -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fcommon -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -pthread -Wl,-z -Wl,relro -Wl,-z -Wl,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -o .libs/lives-exe rpmalloc.o widget-helper.o main.o support.o effects.o lsd-tab.o plugins.o effects-weed.o effects-data.o framedraw.o interface.o paramspecial.o paramwindow.o rfx-builder.o lives-yuv4mpeg.o preferences.o rte_window.o gui.o ce_thumbs.o htmsocket.o merge.o dialogs.o saveplay.o audio.o events.o resample.o osc.o omc-learn.o callbacks.o colourspace.o keyboard.o utils.o multitrack.o stream.o cvirtual.o startup.o pangotext.o machinestate.o weed-effects-utils.o diagnostics.o transcode.o videodev.o jack.o pulse.o ldvgrab.o ldvcallbacks.o ldvinterface.o giw/giwknob.o giw/giwvslider.o giw/giwled.o giw/giwtimeline.o  -lgtk-3 -latk-1.0 -lgio-2.0 -loil-0.3 -lX11 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -lgdk_pixbuf-2.0 -lcairo-gobject -lcairo -lgobject-2.0 -lmjpegutils ../libOSC/.libs/libOSC.a ../libOSC/client/.libs/libOSC_client.a -ljack -L/usr/lib64 -ljackserver -lavc1394 -lraw1394 -lrom1394 -lasound -lpulse -lpng16 -lz -lswscale -lavutil /builddir/build/BUILD/LiVES-3.2.0-pre8/libweed/.libs/libweed_gslice.so -lglib-2.0 /builddir/build/BUILD/LiVES-3.2.0-pre8/libweed/.libs/libweed-utils.so -lm -lunicap -lrt -ldl -pthread
In function 'lives_free_and_return',
    inlined from 'explain_missing' at startup.c:1387:17:
machinestate.c:590:59: warning: attempt to free a non-heap object 'pt1' [-Wfree-nonheap-object]
  590 | LIVES_GLOBAL_INLINE void *lives_free_and_return(void *p) {lives_free(p); return NULL;}
      |                                                           ^
/usr/bin/ld: /tmp/lives-exe.W2CUBD.ltrans49.ltrans.o: in function `resize_layer':
/builddir/build/BUILD/LiVES-3.2.0-pre8/src/colourspace.c:12767: undefined reference to `weed_palette_to_avi_pix_fmt'
/usr/bin/ld: /builddir/build/BUILD/LiVES-3.2.0-pre8/src/colourspace.c:12768: undefined reference to `weed_palette_to_avi_pix_fmt'
/usr/bin/ld: /tmp/lives-exe.W2CUBD.ltrans63.ltrans.o: in function `on_open_vdev_activate':
/builddir/build/BUILD/LiVES-3.2.0-pre8/src/videodev.c:191: undefined reference to `fourccp_to_weedp'
/usr/bin/ld: /builddir/build/BUILD/LiVES-3.2.0-pre8/src/videodev.c:337: undefined reference to `fourccp_to_weedp'
collect2: error: ld returned 1 exit status

Lives-3.2.0-pre8 Full build log: http://koji.rpmfusion.org/kojifiles/work/tasks/5970/445970/build.log

salsaman commented 3 years ago

machinestate.c:590:59: warning: attempt to free a non-heap object 'pt1' [-Wfree-nonheap-object]

Fixed.

salsaman commented 3 years ago

/usr/bin/ld: /tmp/lives-exe.W2CUBD.ltrans49.ltrans.o: in function resize_layer': /builddir/build/BUILD/LiVES-3.2.0-pre8/src/colourspace.c:12767: undefined reference toweed_palette_to_avi_pix_fmt' /usr/bin/ld: /builddir/build/BUILD/LiVES-3.2.0-pre8/src/colourspace.c:12768: undefined reference to weed_palette_to_avi_pix_fmt' /usr/bin/ld: /tmp/lives-exe.W2CUBD.ltrans63.ltrans.o: in functionon_open_vdev_activate': /builddir/build/BUILD/LiVES-3.2.0-pre8/src/videodev.c:191: undefined reference to fourccp_to_weedp' /usr/bin/ld: /builddir/build/BUILD/LiVES-3.2.0-pre8/src/videodev.c:337: undefined reference tofourccp_to_weedp' collect2: error: ld returned 1 exit status

Both functions are defined (as inline) in libweed/weed-compat.h, which is included from main.h There is no reason why these functions should not be found, and I am unable to reproduce the issue, even using configure --disable-system-weed.

salsaman commented 3 years ago

Does it help if you change "inline" to "static inline" in weed-compat.h ?

salsaman commented 3 years ago

Otherwise it may require attribute __ always_inline __

Failing this, I would need to create libweed-compat, which is something I am trying to avoid

salsaman commented 3 years ago

It may also be a case that weed-compat.h needs to be called directly from the .c files, rather than indirectly via main.h I am not sure - perhaps you can try this also.

sagitter commented 3 years ago

It may also be a case that weed-compat.h needs to be called directly from the .c files, rather than indirectly via main.h I am not sure - perhaps you can try this also.

Tested with this patch but does not work..

--- a/src/videodev.orig.c   2020-11-03 06:37:10.000000000 +0100
+++ b/src/videodev.c    2020-11-04 11:38:37.686032592 +0100
@@ -14,6 +14,7 @@
 #include "effects-weed.h"

 #include <unicap/unicap.h>
+#include "../libweed/weed-compat.h"

 static boolean lives_wait_user_buffer(lives_vdev_t *ldev, unicap_data_buffer_t **buff, double timeout) {
   // wait for USER type buffer

Disabling the LTO flags (-flto=auto -ffat-lto-objects), just undefined reference to fourccp_to_weedp' remains as linker failure.

salsaman commented 3 years ago

You would need to include it before "main.h" I think. However this may not be necessary:

Another user who experienced similar problems has reported that changing all of the "inline" in weed-compat.h to "static inline" may resolve the problem. Could you try this and let me know if it fixes the problem for you.

sagitter commented 3 years ago

You would need to include it before "main.h" I think. However this may not be necessary:

Another user who experienced similar problems has reported that changing all of the "inline" in weed-compat.h to "static inline" may resolve the problem. Could you try this and let me know if it fixes the problem for you.

Doesn't work for me, unfortunately, with:

--- a/src/videodev.orig.c   2020-11-03 06:37:10.000000000 +0100
+++ b/src/videodev.c    2020-11-04 11:38:37.686032592 +0100
@@ -3,6 +3,7 @@
 // released under the GNU GPL 3 or later
 // see file COPYING or www.gnu.org for details

+#include "../libweed/weed-compat.h"
 #include "main.h"

 #ifdef HAVE_UNICAP
--- a/libweed/weed-compat.orig.h    2020-11-03 06:37:10.000000000 +0100
+++ b/libweed/weed-compat.h 2020-11-05 16:17:49.084800148 +0100
@@ -85,7 +85,7 @@
 #endif

-inline int fourccp_to_weedp(unsigned int fourcc, int bpp, int *interlaced, int *sampling,
+static inline int fourccp_to_weedp(unsigned int fourcc, int bpp, int *interlaced, int *sampling,
                int *sspace, int *clamping) {
   // inputs are fourcc and bpp
   // returns int weed_palette
@@ -679,7 +679,7 @@

 #if defined FF_API_PIX_FMT ||  defined AVUTIL_PIXFMT_H

-inline int avi_color_range_to_weed_clamping(enum AVColorRange range) {
+static inline int avi_color_range_to_weed_clamping(enum AVColorRange range) {
   switch (range) {
   case AVCOL_RANGE_MPEG:
     return WEED_YUV_CLAMPING_CLAMPED;
@@ -691,7 +691,7 @@
   return WEED_YUV_CLAMPING_CLAMPED;
 }

-inline enum AVColorRange weed_clamping_to_avi_color_range(int clamping) {
+static inline enum AVColorRange weed_clamping_to_avi_color_range(int clamping) {
   switch (clamping) {
   case WEED_YUV_CLAMPING_CLAMPED:
         return AVCOL_RANGE_MPEG;
@@ -703,7 +703,7 @@

 #ifndef AVUTIL_PIXFMT_H

-inline int avi_pix_fmt_to_weed_palette(enum PixelFormat pix_fmt, int *clamped) {
+static inline int avi_pix_fmt_to_weed_palette(enum PixelFormat pix_fmt, int *clamped) {
   // clamped may be set to NULL if you are not interested in the value
   switch (pix_fmt) {
   case PIX_FMT_RGB24:
@@ -753,7 +753,7 @@
   }
 }

-inline enum PixelFormat weed_palette_to_avi_pix_fmt(int pal, int *clamped) {
+static inline enum PixelFormat weed_palette_to_avi_pix_fmt(int pal, int *clamped) {
   switch (pal) {
   case WEED_PALETTE_RGB24:
         return PIX_FMT_RGB24;
@@ -800,7 +800,7 @@

 #else

-inline int avi_pix_fmt_to_weed_palette(enum AVPixelFormat pix_fmt, int *clamped) {
+static inline int avi_pix_fmt_to_weed_palette(enum AVPixelFormat pix_fmt, int *clamped) {
   // clamped may be set to NULL if you are not interested in the value
   switch (pix_fmt) {
   case AV_PIX_FMT_RGB24:
@@ -847,7 +847,7 @@
   }
 }

-inline enum AVPixelFormat weed_palette_to_avi_pix_fmt(int pal, int *clamped) {
+static inline enum AVPixelFormat weed_palette_to_avi_pix_fmt(int pal, int *clamped) {
   switch (pal) {
   case WEED_PALETTE_RGB24:
         return AV_PIX_FMT_RGB24;
@@ -892,7 +892,7 @@
 #endif // avutil
 #endif // pix fmts

-inline int avi_trc_to_weed_gamma(enum AVColorTransferCharacteristic trc) {
+static inline int avi_trc_to_weed_gamma(enum AVColorTransferCharacteristic trc) {
   switch (trc) {
   case AVCOL_TRC_BT709:
     return WEED_GAMMA_BT709;
@@ -906,7 +906,7 @@
   return WEED_GAMMA_UNKNOWN;
 }

-inline enum AVColorTransferCharacteristic weed_gamma_to_avi_trc(int gamma_type) {
+static inline enum AVColorTransferCharacteristic weed_gamma_to_avi_trc(int gamma_type) {
   switch (gamma_type) {
   case WEED_GAMMA_BT709:
         return AVCOL_TRC_BT709;
@@ -1029,21 +1029,21 @@
 #define HAVE_PANGO_FONT_STYLE 1
 #define HAVE_PANGO_FONT_SIZE 1

-inline int font_stretch_to_pango_stretch(const char *stretch) {
+static inline int font_stretch_to_pango_stretch(const char *stretch) {
   PangoFontDescription *pfd = pango_font_description_from_string(stretch);
   PangoStretch pstretch = pango_font_description_get_stretch(pfd);
   pango_font_description_free(pfd);
   return pstretch;
 }

-inline int font_weight_to_pango_weight(const char *weight) {
+static inline int font_weight_to_pango_weight(const char *weight) {
   PangoFontDescription *pfd = pango_font_description_from_string(weight);
   PangoWeight pweight = pango_font_description_get_weight(pfd);
   pango_font_description_free(pfd);
   return pweight;
 }

-inline int font_style_to_pango_style(const char *style) {
+static inline int font_style_to_pango_style(const char *style) {
   PangoFontDescription *pfd = pango_font_description_from_string(style);
   PangoStyle pstyle = pango_font_description_get_style(pfd);
   pango_font_description_free(pfd);
salsaman commented 3 years ago

Try with removing the extra #include, but leaving the "static inline" changes.

sagitter commented 3 years ago

Try with removing the extra #include, but leaving the "static inline" changes.

It works!

salsaman commented 3 years ago

Great ! Fix checked in.