comp.lang.ada
 help / color / mirror / Atom feed
* Globe_3D & OpenGL linking issues
@ 2018-11-14 22:44 Shark8
  2018-11-15 10:50 ` gautier_niouzes
  0 siblings, 1 reply; 7+ messages in thread
From: Shark8 @ 2018-11-14 22:44 UTC (permalink / raw)


I'm trying out Globe_3D and GID -- https://globe3d.sourceforge.io/ & https://gen-img-dec.sourceforge.io/ respectively -- building and running the demos has worked well. (GPRINSTALL worked w/o a hitch, after I remembered the -P parameter.)


But now, trying to use Globe_3D (in a separate project, importing Globe_3D) I'm unable to get things to link; the errors that I get are along the lines of:

d:/programming/gnat/2018/bin/../libexec/gcc/x86_64-pc-mingw32/7.3.1/ld.exe: skipping incompatible D:\Programming\Libraries\GLOBE_3D\\obj/libwin32/opengl32.lib when searching for -lopengl32
d:/programming/gnat/2018/bin/../libexec/gcc/x86_64-pc-mingw32/7.3.1/ld.exe: skipping incompatible D:\Programming\Projects\Space\obj\/opengl32.lib when searching for -lopengl32
...
d:/programming/gnat/2018/bin/../libexec/gcc/x86_64-pc-mingw32/7.3.1/ld.exe: cannot find -lfreeglut
collect2.exe: error: ld returned 1 exit status

Any ideas?

-------------------
-- It's going to be a little solar-system demo.
-- Ada_Space GPR

with "globe_3d.gpr";

project Ada_Space is

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

   package Ide is
      for Artifacts_Dir use "ali";
      for Documentation_Dir use "doc";
   end Ide;

end Ada_Space;


-------------------
-- Globe_3D GPR
project Globe_3D is

   type OS_Kind is
      ("win32", "linux", "macosx");
   OS : OS_Kind := external ("OS_Kind", "win32");

   type Build_Mode_Type is
      ("debug", "fast", "small");
   Build_Mode : Build_Mode_Type := external ("Build_Mode", "debug");

   Binder_Options := ();

   Style_Options  := ("-gnatyaknpr",  --  Check all casings: a:attribute, k:keywords, n:package Standard identifiers, p:pragma, r:identifier references.
                      "-gnatybfhiu",  --  Check b:no blanks at end of lines, f:no ff/vtabs, h: no htabs, i:if-then layout, u:no unnecessary blank lines.
                      "-gnatyO",      --  Check that overriding subprograms are explicitly marked as such.
                      "-gnatye",      --  Check that labels on end statements (ending subprograms), and on exit statements (exiting named loops), are present.
                      "-gnatyx");     --  Check x:no extra parens.

   Compiler_Options :=   ("-gnat12",
                          "-gnatwa",
                          "-fno-strict-aliasing")
                        & Style_Options;

   Fast_Options := ("-O2", 
                    "-gnatn",
                    "-gnatp",
                    "-funroll-loops",
                    "-fpeel-loops",
                    "-ftracer",
                    "-funswitch-loops",
                    "-fweb",
                    "-frename-registers"); 

   Small_Options := ("-Os",
                     "-gnatp",
                     "-fno-inline",
                     "-march=i386",
                     "-ffunction-sections",
                     "-falign-jumps=0",
                     "-falign-loops=0",
                     "-falign-functions=0",
                     "-mpreferred-stack-boundary=2");

   case Build_Mode 
   is
      when "debug" =>
         Binder_Options   := Binder_Options   & "-E";
         Compiler_Options := Compiler_Options & "-gnato"
                                              & "-fstack-check"
                                              & "-g";
         case OS
         is
            when "linux"  =>
               Compiler_Options := Compiler_Options & "-gnatVa";

            when "win32"  =>
               Compiler_Options := Compiler_Options & "-fno-inline"
                                                    & "-gnatVcdeimoprst";
--                                                  & "-gnatVf"             -- (2016) turned off floating point validity check, seems to give false positives on a scalar product for collision detection
            when "macosx" =>
               null;
         end case;

      when "fast" =>
         case OS
         is
            when "linux"  =>
               Compiler_Options := Compiler_Options & Fast_Options 
                                                    & "-fomit-frame-pointer";
            when "win32"  =>
               Compiler_Options := Compiler_Options & Fast_Options
                                                    & "-fipa-cp-clone"
                                                    & "-fgcse-after-reload" 
                                                    & "-ftree-vectorize"
                                                    & "-mfpmath=sse"
                                                    & "-msse3";
            when "macosx" =>
               null;
         end case;

      when "small" =>
         case OS
         is
            when "linux"  =>
               Compiler_Options := Compiler_Options & Small_Options 
                                                    & "-fdata-sections";
            when "win32"  =>
               Compiler_Options := Compiler_Options & Small_Options;

            when "macosx" =>
               null;
         end case;
   end case;


   case OS
   is
      when "macosx" =>
         Compiler_Options := Compiler_Options & "-gnatf" 
                                              & "-gnatE" 
                                              & "-gnatVcfimorst"
                                              & "-gnatyhiknp";
      when "linux" =>
         Binder_Options   := Binder_Options   & "-static";

      when "win32" =>
         null;
   end case;


   for Library_Name    use "globe3d";
   for Library_Dir     use "lib/gnat_" & external ("Build_Mode", "debug");
   for Library_Ali_Dir use "lib/gnat_" & external ("Build_Mode", "debug");
   for Object_Dir      use "obj/gnat_" & external ("Build_Mode", "debug");

   for Source_Dirs use ("bindings",
                        "bindings/" & external ("OS_Kind", "win32"), 
                        "src/**");

   package Ide is
      case OS
      is
         when "linux"  =>   for Default_Switches ("adacontrol") use ("-Ftgnat_short");
         when "win32"  =>   for Default_Switches ("adacontrol") use ("-F", "gnat_short");
         when "macosx" =>   for Default_Switches ("adacontrol") use ();
      end case;
   end Ide;

   package Builder is
      for Default_Switches ("ada") use ("-C", "-j5");

      case Build_Mode 
      is
         when "debug" =>   for Global_Configuration_Pragmas use "obj/debug.pra";
         when "fast"  =>   null;
         when "small" =>   null;
      end case;
   end Builder;

   package Compiler is
      for Default_Switches ("ada") use Compiler_Options;
   end Compiler;

   package Binder is
      for Default_Switches ("ada") use Binder_Options;
   end Binder;

   package Linker is
      case OS
      is
         when "linux"  =>   for Linker_Options use ("-g", "-lGL", "-lGLU", "-lglut");
         when "win32"  =>   for Linker_Options use ("-g", "-Wl,--gc-sections", "obj/libwin32/glee.o", "-lopengl32", "-lglu32", "-lfreeglut", "-Lobj/libwin32", "-Xlinker", "--stack=0x40000000,0x400000");
         when "macosx" =>   for Linker_Options use ("-g", "-bind_at_load", "-framework", "/GLUT", "-framework", "/OpenGL", "-lm");
      end case;
   end Linker;

end Globe_3D;

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Globe_3D & OpenGL linking issues
  2018-11-14 22:44 Globe_3D & OpenGL linking issues Shark8
@ 2018-11-15 10:50 ` gautier_niouzes
  2018-11-15 14:00   ` Shark8
  0 siblings, 1 reply; 7+ messages in thread
From: gautier_niouzes @ 2018-11-15 10:50 UTC (permalink / raw)


Between both builds, did you perhaps switch from a 32-bit GNAT to a 64-bit one?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Globe_3D & OpenGL linking issues
  2018-11-15 10:50 ` gautier_niouzes
@ 2018-11-15 14:00   ` Shark8
  2018-11-15 16:05     ` gautier_niouzes
  0 siblings, 1 reply; 7+ messages in thread
From: Shark8 @ 2018-11-15 14:00 UTC (permalink / raw)


On Thursday, November 15, 2018 at 3:50:59 AM UTC-7, gautier...@hotmail.com wrote:
> Between both builds, did you perhaps switch from a 32-bit GNAT to a 64-bit one?

Nope; this is solely a clean install of the 2018 GNAT.
What I find interesting is that the demos built and ran fine, w/ no issue, but this other project doesn't.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Globe_3D & OpenGL linking issues
  2018-11-15 14:00   ` Shark8
@ 2018-11-15 16:05     ` gautier_niouzes
  2018-11-16 15:38       ` Shark8
  0 siblings, 1 reply; 7+ messages in thread
From: gautier_niouzes @ 2018-11-15 16:05 UTC (permalink / raw)


On Thursday, November 15, 2018 at 3:00:06 PM UTC+1, Shark8 wrote:

> What I find interesting is that the demos built and ran fine, w/ no issue, but this other project doesn't.

That's surprising indeed. The build of the demos (when running the make_all.cmd script for instance) fails at link phase with the 64-bit GNAT 2018 CE, with similar message - that's expected at least due to the 32-bit libfreeglut.a.

Perhaps you'll be luckier with Linux ?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Globe_3D & OpenGL linking issues
  2018-11-15 16:05     ` gautier_niouzes
@ 2018-11-16 15:38       ` Shark8
  2018-11-16 16:40         ` gautier_niouzes
  0 siblings, 1 reply; 7+ messages in thread
From: Shark8 @ 2018-11-16 15:38 UTC (permalink / raw)


On Thursday, November 15, 2018 at 9:05:37 AM UTC-7, gautier...@hotmail.com wrote:
> On Thursday, November 15, 2018 at 3:00:06 PM UTC+1, Shark8 wrote:
> 
> > What I find interesting is that the demos built and ran fine, w/ no issue, but this other project doesn't.
> 
> That's surprising indeed. The build of the demos (when running the make_all.cmd script for instance) fails at link phase with the 64-bit GNAT 2018 CE, with similar message - that's expected at least due to the 32-bit libfreeglut.a.
> 
> Perhaps you'll be luckier with Linux ?

I don't really have a free Linux box right now -- I *might* get the ok to use an old Solaris box, but honestly I'm not a big fan of *nix.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Globe_3D & OpenGL linking issues
  2018-11-16 15:38       ` Shark8
@ 2018-11-16 16:40         ` gautier_niouzes
  2018-11-16 23:21           ` Shark8
  0 siblings, 1 reply; 7+ messages in thread
From: gautier_niouzes @ 2018-11-16 16:40 UTC (permalink / raw)


So, if you run make_all.cmd now you really get a fresh build?

If you have downloaded the Zip archive (latest so far: globe_3d_release_2016-12-26.zip) from SourceForge there are pre-built executables.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Globe_3D & OpenGL linking issues
  2018-11-16 16:40         ` gautier_niouzes
@ 2018-11-16 23:21           ` Shark8
  0 siblings, 0 replies; 7+ messages in thread
From: Shark8 @ 2018-11-16 23:21 UTC (permalink / raw)


On Friday, November 16, 2018 at 9:40:11 AM UTC-7, gautier...@hotmail.com wrote:
> So, if you run make_all.cmd now you really get a fresh build?
> 
> If you have downloaded the Zip archive (latest so far: globe_3d_release_2016-12-26.zip) from SourceForge there are pre-built executables.

I'll try again over the weekend, but it looks like those executables are what I was executing; I think right now I'm stuck at trying to get a new GLEE.O properly 
built.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-11-16 23:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-14 22:44 Globe_3D & OpenGL linking issues Shark8
2018-11-15 10:50 ` gautier_niouzes
2018-11-15 14:00   ` Shark8
2018-11-15 16:05     ` gautier_niouzes
2018-11-16 15:38       ` Shark8
2018-11-16 16:40         ` gautier_niouzes
2018-11-16 23:21           ` Shark8

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox