Project

General

Profile

Compiling with GCC 5.4.0 is Ok, but fails with GCC 4.9.2

Added by Carlo Bramini over 7 years ago

When compiling my MINGW build, I got a strange error with GCC 4.9.2 that I have not when I use GCC 5.4.0 instead:


vfs_local.cc: In member function 'virtual VFSImpl* LocalTransport::fopen(const char*, const char*, String&)':
vfs_local.cc:124:39: error: invalid new-expression of abstract class type 'LocalFile'
     return new LocalFile (path, stream);
                                       ^
vfs_local.cc:46:7: note:   because the following virtual functions are pure within 'LocalFile':
 class LocalFile : public VFSImpl
       ^
In file included from plugin.h:29:0,
                 from vfs_local.h:23,
                 from vfs_local.cc:21:
../libaudcore/vfs.h:88:17: note:        virtual int VFSImpl::ftruncate(int64_t)
     virtual int ftruncate (int64_t length) = 0;
                 ^
vfs_local.cc: In member function 'virtual VFSImpl* StdinTransport::fopen(const char*, const char*, String&)':
vfs_local.cc:135:43: error: invalid new-expression of abstract class type 'LocalFile'
     return new LocalFile ("(stdin)", stdin);
                                           ^
vfs_local.cc: In function 'VFSImpl* vfs_tmpfile(String&)':
vfs_local.cc:150:46: error: invalid new-expression of abstract class type 'LocalFile'
     return new LocalFile ("(tmpfile)", stream);
                                              ^
vfs_local.cc: In member function 'virtual VFSImpl* LocalTransport::fopen(const char*, const char*, String&)':
vfs_local.cc:125:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
vfs_local.cc: In member function 'virtual VFSImpl* StdinTransport::fopen(const char*, const char*, String&)':
vfs_local.cc:136:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
vfs_local.cc: In function 'VFSImpl* vfs_tmpfile(String&)':
vfs_local.cc:151:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
Failed to compile vfs_local.cc (lib)!

Before filing a bug, I was wondering if it is a known behavior or not, because I'm not able to understand the reason since it appears by changing the compiler.
Thank you very much.

Sincerely.


Replies (9)

RE: Compiling with GCC 5.4.0 is Ok, but fails with GCC 4.9.2 - Added by Carlo Bramini over 7 years ago

I did a new checkout and I tried to compile again, this time no more failures in detection of AR/RANLIB/WINDRES tools, no more error with unexisting readlink(), but unfortunately vfs_local.cc still fails with GCC 4.9.2.

RE: Compiling with GCC 5.4.0 is Ok, but fails with GCC 4.9.2 - Added by John Lindgren over 7 years ago

Does it work if, in vfs_local.cc, you move #include <unistd.h> above #include "vfs_local.h"?

RE: Compiling with GCC 5.4.0 is Ok, but fails with GCC 4.9.2 - Added by Carlo Bramini over 7 years ago

John Lindgren wrote:

Does it work if, in vfs_local.cc, you move #include <unistd.h> above #include "vfs_local.h"?

Yes, it does. I did this change:


#include <errno.h>
#include <string.h>
#include <unistd.h>

#include <glib/gstdio.h>

#define WANT_VFS_STDIO_COMPAT
#include "vfs_local.h" 

#include "audstrings.h" 
#include "i18n.h" 
#include "runtime.h" 

In this way the compilation works. o_O

RE: Compiling with GCC 5.4.0 is Ok, but fails with GCC 4.9.2 - Added by John Lindgren over 7 years ago

Thought so. I committed that change to master.

RE: Compiling with GCC 5.4.0 is Ok, but fails with GCC 4.9.2 - Added by Carlo Bramini over 7 years ago

I'm suspecting that I'm getting another little trouble related to the compiler version.

I tried to activate QT in the Windows build.

With GCC 5.4.0, everything is compiled succesfully.
It does not work because, for some unknown reasons, it is not listed in the list of available user interfaces available for selection, but this is another issue.

With GCC 4.9.2, it compiles well, but it fails during linking:


infowin.lib.o: nella funzione "operator()":
/home/Carlo/audacious-master/src/libaudqt/infowin.cc:78: riferimento non definito a "_imp___ZN5audqt10InfoWidget10updateFileEv" 
infowin.lib.o: nella funzione "ZN5audqt10InfoWindowC2EP7QWidget":
/home/Carlo/audacious-master/src/libaudqt/infowin.cc:61: riferimento non definito a "_imp___ZN5audqt10InfoWidgetC1EP7QWidget" 
/home/Carlo/audacious-master/src/libaudqt/infowin.cc:61: riferimento non definito a "_imp___ZN5audqt10InfoWidgetD1Ev" 
infowin.lib.o: nella funzione "ZN5audqt10InfoWindow8fillInfoEiiPKcRK5TupleP12PluginHandleb":
/home/Carlo/audacious-master/src/libaudqt/infowin.cc:90: riferimento non definito a "_imp___ZN5audqt10InfoWidget8fillInfoEiiPKcRK5TupleP12PluginHandleb" 
infowin.lib.o: nella funzione "ZN5audqt10InfoWindowD1Ev":
/home/Carlo/audacious-master/src/libaudqt/infowin.cc:42: riferimento non definito a "_imp___ZN5audqt10InfoWidgetD1Ev" 
infowin.lib.o: nella funzione "~InfoWindow":
/home/Carlo/audacious-master/src/libaudqt/infowin.cc:42: riferimento non definito a "_imp___ZN5audqt10InfoWidgetD1Ev" 
info-widget.lib.o: nella funzione "ZN5audqt10InfoWidgetD2Ev":
/home/Carlo/audacious-master/src/libaudqt/info-widget.cc:102: riferimento non definito a "_imp___ZTVN5audqt10InfoWidgetE" 
info-widget.lib.o: nella funzione "~InfoWidget":
/home/Carlo/audacious-master/src/libaudqt/info-widget.cc:102: riferimento non definito a "_imp___ZTVN5audqt10InfoWidgetE" 
info-widget.lib.o: nella funzione "ZN5audqt10InfoWidgetC2EP7QWidget":
/home/Carlo/audacious-master/src/libaudqt/info-widget.cc:94: riferimento non definito a "_imp___ZTVN5audqt10InfoWidgetE" 
collect2: error: ld returned 1 exit status
Failed to link libaudqt.dll!
make[1]: *** [../../buildsys.mk:231: libaudqt.dll] Error 1
make: *** [../../buildsys.mk:118: all] Error 2

I hope this information could be helpful.

PS: in italian, "riferimento non definito a" means "undefined reference to".

RE: Compiling with GCC 5.4.0 is Ok, but fails with GCC 4.9.2 - Added by Carlo Bramini over 7 years ago

John Lindgren wrote:

I've never actually built the Qt interface on Windows. This might help:
https://github.com/audacious-media-player/audacious/commit/10325f411ec79f3d1ddec86383875b0a0b1ea230

Yes, not it compiles fine, thank you!

The only annoying thing during the compilation is the warning to "-fPIC" option because it unsupported on COFF-PE executables, but we can survive with it for now. ;)
It is interesting to notice that I configured everything with "--disable-gtk --enable-qt" and here it happens that it finally triggers an error when you start the QT version of audacious. I attached the screenshot of the message that I'm getting on screen. I think I followed the instructions of copying all files, adding qt.conf, optional environment variable, etc, and it still does not work, however I never programmed QT so I'm sure that it is just a configuration problem.

RE: Compiling with GCC 5.4.0 is Ok, but fails with GCC 4.9.2 - Added by John Lindgren over 7 years ago

I expect there will be a number of issues still to work out. I don't have time to devote to it at present (and anyway there are still missing features on the Qt interface that need to be added, even on Linux).

    (1-9/9)