comp.lang.ada
 help / color / mirror / Atom feed
From: Shark8 <onewingedshark@gmail.com>
Subject: Globe_3D & OpenGL linking issues
Date: Wed, 14 Nov 2018 14:44:21 -0800 (PST)
Date: 2018-11-14T14:44:21-08:00	[thread overview]
Message-ID: <75a4451a-c427-4ecd-a548-5b6dd610abfd@googlegroups.com> (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;

             reply	other threads:[~2018-11-14 22:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-14 22:44 Shark8 [this message]
2018-11-15 10:50 ` Globe_3D & OpenGL linking issues 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
replies disabled

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