flyx / OpenGLAda

Thick Ada binding for OpenGL and GLFW
flyx.github.io/OpenGLAda/
MIT License
96 stars 13 forks source link

build error #145

Closed jlots closed 3 years ago

jlots commented 4 years ago

I was able to build OpenGLAda using instructions in Readme. All tests build correctly as well. I installed using

gprinstall -XWindowing_System=x11 -Xmode=release openglada.gpr

I then open a new project using opengl.gpr and opengl-glfw.gpr

with "opengl.gpr";
with "opengl-glfw.gpr";
project MWE is

   for Source_Dirs use ("src");
   for Object_Dir use "obj";
   for Main use ("main.adb");

end MWE;

When running this example using: gprbuild -P MWE.gpr

I get the following error: collect2: error: ld returned 1 exit status gprbuild: link of main.adb failed gprbuild: failed command was: /usr/GNAT/2019/bin/gcc main.o b__main.o /usr/GNAT/2019/lib/opengl.glfw/libGlfwAda.a /usr/GNAT/2019/lib/opengl/libOpenGLAda.a -lglfw -Wl,-framework,Cocoa,-framework,IOKit -L/home/XXX/Documents/AdaProjects/MWE/obj/ -L/home/XXX/Documents/AdaProjects/MWE/obj/ -L/usr/GNAT/2019/lib/opengl/ -L/usr/GNAT/2019/lib/opengl.glfw/ -L/usr/GNAT/2019/lib/gcc/x86_64-pc-linux-gnu/8.3.1/adalib/ -static-libgcc /usr/GNAT/2019/lib/gcc/x86_64-pc-linux-gnu/8.3.1/adalib/li bgnat.a -ldl -Wl,-rpath-link,/usr/GNAT/2019/lib/gcc/x86_64-pc-linux-gnu/8.3.1//adalib -Wl,-z,origin,-rpath,$ORIGIN/:/usr/GNAT/2019/lib/opengl:/usr/GNAT/2019/lib/opengl.glfw:/usr/GNAT/2019/lib/gcc/x86_64-pc-linux-gnu/8.3.1/adalib -o main

I'm not sure where the "-framework" flags are coming from. I believe they're being generated by OpenGLAda or GLFW projects.

rogermc2 commented 4 years ago

Maybe run gprconfig and make sure to select the llvm compiler (as I recall)?

On 28 Sep 2020, at 12:59 pm, jlots notifications@github.com wrote:

I was able to build OpenGLAda using instructions in Readme. All tests build correctly as well. I installed using

gprinstall -XWindowing_System=x11 -Xmode=release openglada.gpr

I then open a new project using opengl.gpr and opengl-glfw.gpr

with "opengl.gpr"; with "opengl-glfw.gpr"; project MWE is

for Source_Dirs use ("src"); for Object_Dir use "obj"; for Main use ("main.adb");

end MWE; When running this example using: gprbuild -P MWE.gpr

I get the following error: collect2: error: ld returned 1 exit status gprbuild: link of main.adb failed gprbuild: failed command was: /usr/GNAT/2019/bin/gcc main.o b__main.o /usr/GNAT/2019/lib/opengl.glfw/libGlfwAda.a /usr/GNAT/2019/lib/opengl/libOpenGLAda.a -lglfw -Wl,-framework,Cocoa,-framework,IOKit -L/home/XXX/Documents/AdaProjects/MWE/obj/ -L/home/XXX/Documents/AdaProjects/MWE/obj/ -L/usr/GNAT/2019/lib/opengl/ -L/usr/GNAT/2019/lib/opengl.glfw/ -L/usr/GNAT/2019/lib/gcc/x86_64-pc-linux-gnu/8.3.1/adalib/ -static-libgcc /usr/GNAT/2019/lib/gcc/x86_64-pc-linux-gnu/8.3.1/adalib/li bgnat.a -ldl -Wl,-rpath-link,/usr/GNAT/2019/lib/gcc/x86_64-pc-linux-gnu/8.3.1//adalib -Wl,-z,origin,-rpath,$ORIGIN/:/usr/GNAT/2019/lib/opengl:/usr/GNAT/2019/lib/opengl.glfw:/usr/GNAT/2019/lib/gcc/x86_64-pc-linux-gnu/8.3.1/adalib -o main

I'm not sure where the "-framework" flags are coming from. I believe they're being generated by OpenGLAda or GLFW projects.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/flyx/OpenGLAda/issues/145, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC7VT6W6ZXT6D3GNMMY6EQLSH73ZPANCNFSM4R36XYVQ.

flyx commented 4 years ago

The -framework flags come from opengl-glfw.gpr and are macOS-specific. They shouldn't be there since you're not compiling for macOS; GLFW uses the sameWindowing_System variable as opengl.gpr to identify your OS.

I remember reading a post recently (Reddit? StackOverflow? can't remember and can't find it) of someone else having problems with scenario variable propagation with gprinstall, the solution was to update GNAT. Seeing that you're using GNAT 2019, I suggest updating to GNAT 2020. Afterwards, redo the installation.

In any case, the error is in the .gpr files generated by gprinstall (since tests compile fine). The installed .gpr files are different from the original ones as they reference the readily compiled libraries (they don't compile them again). You can open them, particularly opengl.gpr and opengl-glfw.gpr and inspect the Linker_Options given there. The files should be installed in /usr/GNAT/2019/share/gpr.

flyx commented 3 years ago

Closing this due to lack of feedback and probability of being a GNAT issue that has been fixed.