frequensea icon indicating copy to clipboard operation
frequensea copied to clipboard

Fix Linux build errors

Open yuvadm opened this issue 10 years ago • 19 comments
trafficstars

[ 82%] Building C object CMakeFiles/frequensea.dir/src/nim.c.o
/home/yuval/dev/archlinux-packages/aur/frequensea-git/src/frequensea/src/nim.c: In function ‘nim_png_write’:
/home/yuval/dev/archlinux-packages/aur/frequensea-git/src/frequensea/src/nim.c:40:9: error: ‘channels’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
     int channels;
         ^
cc1: all warnings being treated as errors
CMakeFiles/frequensea.dir/build.make:123: recipe for target 'CMakeFiles/frequensea.dir/src/nim.c.o' failed
make[2]: *** [CMakeFiles/frequensea.dir/src/nim.c.o] Error 1
CMakeFiles/Makefile2:60: recipe for target 'CMakeFiles/frequensea.dir/all' failed
make[1]: *** [CMakeFiles/frequensea.dir/all] Error 2
Makefile:76: recipe for target 'all' failed
make: *** [all] Error 2
==> ERROR: A failure occurred in build().

yuvadm avatar Mar 13 '15 10:03 yuvadm

Hi Yuval,

I’m kinda busy today, but I’ll try to get a Linux box so I can test this properly. PRs are also welcome :-)

Best,

F

On 13 Mar 2015 at 11:51:40, Yuval Adam ([email protected]) wrote:

[ 82%] Building C object CMakeFiles/frequensea.dir/src/nim.c.o /home/yuval/dev/archlinux-packages/aur/frequensea-git/src/frequensea/src/nim.c: In function ‘nim_png_write’: /home/yuval/dev/archlinux-packages/aur/frequensea-git/src/frequensea/src/nim.c:40:9: error: ‘channels’ may be used uninitialized in this function [-Werror=maybe-uninitialized] int channels; ^ cc1: all warnings being treated as errors CMakeFiles/frequensea.dir/build.make:123: recipe for target 'CMakeFiles/frequensea.dir/src/nim.c.o' failed make[2]: *** [CMakeFiles/frequensea.dir/src/nim.c.o] Error 1 CMakeFiles/Makefile2:60: recipe for target 'CMakeFiles/frequensea.dir/all' failed make[1]: *** [CMakeFiles/frequensea.dir/all] Error 2 Makefile:76: recipe for target 'all' failed make: *** [all] Error 2 ==> ERROR: A failure occurred in build().

— Reply to this email directly or view it on GitHub.

fdb avatar Mar 13 '15 11:03 fdb

I see some other errors popping up as well. I'll try to send some patches your way :)

yuvadm avatar Mar 13 '15 11:03 yuvadm

Were there any patches for this issue? I'm hitting the same problem under Arch.

altercation avatar Apr 04 '15 07:04 altercation

@yuvadm has posted a PR which solves some of the first errors. I still have to find the time to get everything working.

I'll try to do this next week.

fdb avatar Apr 05 '15 12:04 fdb

Using the current master, Frequensea should now build (although not without warnings, most of them caused by including the GLFW source).

However, on my testing machine (Chromebook with Ubuntu 14.04) only the ../lua/empty.lua script works correctly. This has probably to do with support for OpenGL ES. Somebody with a OpenGL Desktop system, please test this.

fdb avatar Apr 08 '15 21:04 fdb

Getting:

[ 55%] Building C object CMakeFiles/frequensea.dir/src/nosc.c.o
/home/yuval/dev/archlinux-packages/aur/frequensea-git/src/frequensea/src/nosc.c: In function ‘_nosc_server_start’:
/home/yuval/dev/archlinux-packages/aur/frequensea-git/src/frequensea/src/nosc.c:259:17: warning: implicit declaration of function ‘nanosleep’ [-Wimplicit-function-declaration]
                 nanosleep((struct timespec[]){{0, 1 * MILLIS_TO_NANOS}}, NULL);
                 ^
/home/yuval/dev/archlinux-packages/aur/frequensea-git/src/frequensea/src/nosc.c:259:35: error: array type has incomplete element type
                 nanosleep((struct timespec[]){{0, 1 * MILLIS_TO_NANOS}}, NULL);
                                   ^
CMakeFiles/frequensea.dir/build.make:169: recipe for target 'CMakeFiles/frequensea.dir/src/nosc.c.o' failed
make[2]: *** [CMakeFiles/frequensea.dir/src/nosc.c.o] Error 1
CMakeFiles/Makefile2:61: recipe for target 'CMakeFiles/frequensea.dir/all' failed
make[1]: *** [CMakeFiles/frequensea.dir/all] Error 2
Makefile:116: recipe for target 'all' failed
make: *** [all] Error 2

yuvadm avatar Apr 08 '15 21:04 yuvadm

Confirming identical result as @yuvadm here (building on arch surface pro 3)

altercation avatar Apr 09 '15 01:04 altercation

Per http://stackoverflow.com/questions/14415465/why-do-i-get-in-my-timespec-array-the-error-array-type-has-incomplete-element-t this should fix the problem:

#if __STDC_VERSION__ >= 199901L
#define _XOPEN_SOURCE 600
#else
#define _XOPEN_SOURCE 500
#endif /* __STDC_VERSION__ */
#include <time.h>

However the error, and even the warning about implicit use of nanosleep, still exist. Is there some other time.h in use here?

yuvadm avatar Apr 09 '15 09:04 yuvadm

I found out that I already fixed the issue in nrf.c -- so I moved the implementation to the nut utility module. The code should build now.

Since the code also includes glfw as externals, it tries to build GLFW's examples and fails. However, the frequensea binary should still build.

fdb avatar Apr 09 '15 09:04 fdb

@fdb awesome! Is there any way to disable the GLFW examples? Locally it's fine, but I can't package something that fails a build. If it's not required I'd just like to disable it.

yuvadm avatar Apr 09 '15 10:04 yuvadm

I'm also getting this:

$ ./frequensea ../lua/empty.lua 
GLFW ERROR 65543: GLX: Failed to create context: GLXBadFBConfig

Happens on all the scripts. Here's my glxinfo https://gist.github.com/yuvadm/1a5c870ef0a406039281

yuvadm avatar Apr 09 '15 10:04 yuvadm

Hmm have you been able to run other OpenGL stuff? Do you have other apps that use GLFW?

Maybe I should switch back to the GLFW packaged release. I believe Arch has a recent GLFW 3 package, no?

fdb avatar Apr 10 '15 10:04 fdb

@fdb yes, there's no reason to bundle GLFW, any proper distribution should have it packaged separately. If you do decide to keep it, at least provide a flag for package maintainers to disable it.

As for other OpenGL stuff, I'll test some more and see what I come up with.

yuvadm avatar Apr 10 '15 15:04 yuvadm

@yuvadm you're right, of course. I did this because Ubuntu 14.04 doesn't have GLFW3 in its repository, only GLFW2.

fdb avatar Apr 10 '15 17:04 fdb

I removed GLFW3 from source and uses the one that should be pre-installed. I had to use pkg-config to include all relevant X11 libraries.

fdb avatar Apr 12 '15 09:04 fdb

As for the GLXBadFBConfig, it's because you're using OpenGL 2.1 (Mesa) drivers. We require at least OpenGL 3.2 (See nwm.c).

Depending on your video card, proprietary drivers might include a more recent version of OpenGL.

fdb avatar Apr 12 '15 09:04 fdb

@fdb build seems to finish successfully, thanks for the updates! I'll go ahead and test on a machine with better OpenGL support.

I think we can close this issue now that all build errors are resolved.

yuvadm avatar Apr 12 '15 09:04 yuvadm

Package builds under arch but I get an immediate segfault when running frequensea on any of the test lua files. I'll investigate further as well. OpenGL supported fine on this machine so there's something else happening. Any tips on diagnosing or information I can provide?

Here's relevant info from glxinfo dump:

% glxinfo | grep OpenGL
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) Haswell Mobile 
OpenGL core profile version string: 3.3 (Core Profile) Mesa 10.5.2
OpenGL core profile shading language version string: 3.30
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 3.0 Mesa 10.5.2
OpenGL shading language version string: 1.30
OpenGL context flags: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.0 Mesa 10.5.2
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.00
OpenGL ES profile extensions:

altercation avatar Apr 12 '15 18:04 altercation

Try running using gdb:

gdb --args ./frequensea ../lua/static.lua
> run
> backtrace full

Thanks for helping me debug this issue!

fdb avatar Apr 12 '15 21:04 fdb