From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,99e88d5f39f38483 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!feeder1.cambriumusenet.nl!feed.tweaknews.nl!193.201.147.68.MISMATCH!feeder.news-service.com!feeder.news-service.com!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: "Alex R. Mosteo" Newsgroups: comp.lang.ada Subject: Re: GprBuild and linker options Followup-To: comp.lang.ada Date: Tue, 19 Jul 2011 11:14:52 +0200 Organization: A noiseless patient Spider Message-ID: References: <30764c54-0e96-4394-9a5c-d742adbc5344@glegroupsg2000goo.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit Injection-Date: Tue, 19 Jul 2011 09:14:57 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="M7rP6jhm1IVgvmYaXQFuIA"; logging-data="25762"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18b0hKzju9dr/H+eTup5Z4q" User-Agent: KNode/4.4.10 Cancel-Lock: sha1:1zVrMTUu8q+wZS+05y7HXGMiFXQ= Xref: g2news1.google.com comp.lang.ada:20228 Date: 2011-07-19T11:14:52+02:00 List-Id: Felix Krause wrote: > I need GprBuild to use a custom linker option (in this case, for linking > against an OSX framework). So I include this in my project file: > > package Linker is > for Linker_Options use ("-framework OpenCL", "-v"); > end Linker; > > When I try to build this project, this is the output I get at linking > phase, which fails: > > /usr/local/gnat/bin/gcc [...] -framework OpenCL -v [...] > [...] > COLLECT_GCC_OPTIONS=[...] '-framework OpenCL' '-v' [...] > /usr/local/gnat/libexec/gcc/x86_64-apple-darwin10.2.0/4.5.3/collect2 > [...] > > After that, I get a list of undefined symbols. This is due to "-framework > OpenCL" not being given to the collect2 call. I have no idea what > COMPILE_GCC_OPTIONS does, but I noticed my switch being listed there. Now > when I copypaste the above call to /usr/local/gnat/bin/gcc into my shell > and execute it there, my switch isn't listed in COLLECT_GCC_OPTIONS > anymore, but instead is given to the collect2 call, and everything links > correctly. > > Now of course, I want the build to work directly without having to copy > commands to the shell. One thing I tried is splitting the switch into two > strings: > > for Linker_Options use ("-framework", "OpenCL", "-v"); > > The linking phase now executes the following: > > /usr/local/gnat/bin/gcc [...] -framework > /users/felix/projects/libs/openclada//OpenCL -v [...] > > This obviously results in an error because this framework can't be found. > I searched in the GprBuild user's guide for some hint on what causes this > behavior, but I didn't find anything. Can anyone tell me how to either > make the GprBuild execution with "-framework OpenCL" work like when I > execute it in the shell, or prevent GprBuild from prepending the working > path to "OpenCL" when passing two strings to Linker_Options? Since I don't see that you have solved this, here's an example from a project of mine, in case it gives any idea: package Linker is for Default_Switches ("Ada") use Linker'Default_Switches ("Ada") & ("-Lsrc/rtwmp/lib", "-Wl,-Bstatic", -- force static linking "-lrt-wmp", "-lrt", -- rt is for system clock_gettime, used by rt-wmp "-Wl,-Bdynamic", -- restore default dynamic linking needed by other libs ""); -- This form works when the current open project is a descendant. for Linker_Options use Linker'Linker_Options & ("-Lsrc/rtwmp/lib"); end Linker; I'm using both Linker'Default_Switches and Linker_Options. There are subtle differences between them, but I couldn't say exactly what right now, nor I think I ever could pinpoint them in the manual. They're related to relative path interaction with projects that use other projects IIRC. Besides, they have changed over the GPL releases. > Thanks. > Felix