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: a07f3367d7,99e88d5f39f38483 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post02.iad.highwinds-media.com!news.flashnewsgroups.com-b7.4zTQh5tI3A!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: GprBuild and linker options References: <30764c54-0e96-4394-9a5c-d742adbc5344@glegroupsg2000goo.googlegroups.com> Date: Tue, 19 Jul 2011 04:20:28 -0400 Message-ID: <82sjq2isvn.fsf@stephe-leake.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (windows-nt) Cancel-Lock: sha1:80rYjlBvsSuoUSsTfG0M67XE9pM= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@flashnewsgroups.com Organization: FlashNewsgroups.com X-Trace: 394a04e253e4ee029e66108874 Xref: g2news1.google.com comp.lang.ada:20226 Date: 2011-07-19T04:20:28-04:00 List-Id: Felix Krause writes: > 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; As you have seen, this treats "-framework OpenCL" as a single option string, which is not what your shell does. > 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 [...] Apparently gprbuild is treating each item in Linker_Options that does not start with "-" as a library file; it searches for that file in the search path, and provides the full path when found. Which is not what you want. > 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. The user's guide is woefully inadequate. > 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? Can you use "-framework=OpenCL"? In the gcc manual, there is this: `-Xlinker OPTION' Pass OPTION as an option to the linker. You can use this to supply system-specific linker options which GCC does not know how to recognize. If you want to pass an option that takes an argument, you must use `-Xlinker' twice, once for the option and once for the argument. For example, to pass `-assert definitions', you must write `-Xlinker -assert -Xlinker definitions'. It does not work to write `-Xlinker "-assert definitions"', because this passes the entire string as a single argument, which is not what the linker expects. `-Wl,OPTION' Pass OPTION as an option to the linker. If OPTION contains commas, it is split into multiple options at the commas. either of these might work. -- -- Stephe