[m-users.] Pass options to gcc compiler

Sean Charles (emacstheviking) objitsu at gmail.com
Thu Nov 17 08:27:44 AEDT 2022


Final working solution in case it helps anybody but I doubt it as I am usually the stupidest person in the room:

SDL2FLAGS=`pkg-config --cflags sdl2`
SDL2LIBS=`pkg-config --libs sdl2`
FLAGS=-s $(GRADE) -O4 -E --cflags "$(SDL2FLAGS)" $(SDL2LIBS) -lsdl2

Works fine, not sure why I had to do it this way now but as I say, there ain't no cure for stupid.

Thanks again.
Sean


> On 16 Nov 2022, at 21:17, Sean Charles (emacstheviking) <objitsu at gmail.com> wrote:
> 
> Fixed it with:  
> 	--c-include-directory  /opt/homebrew/include/SDL2
> 
> This is a mystery, I have never used this flag before in my SDL2 projects!
> Just lucky I guess... if I have time I'll boot up my older imac and check out the projects. Very odd.
> 
> Presumably there is an equivalent linker option for the libs folder.
> 
> Thanks for your time agian Zoltan.
> 
> 
>> On 16 Nov 2022, at 21:08, Sean Charles (emacstheviking) <objitsu at gmail.com> wrote:
>> 
>> OK, -V is a good option!!
>> I added that to my makefile and rebuilt, near the end I saw the compiler invocation:
>> 
>> % Compiling `Mercury/cs/agame.c':
>> % Invoking system command `gcc -I. -I. -I./Mercury/mihs -I/usr/local/mercury-22.01.3/lib/mercury/lib/hlc.gc/inc -I/usr/local/mercury-22.01.3/lib/mercury/conf -I/usr/local/mercury-22.01.3/lib/mercury/inc   -O2 -fomit-frame-pointer -fno-strict-aliasing -DMR_HIGHLEVEL_CODE -DMR_CONSERVATIVE_GC -DMR_BOEHM_GC -DMR_TAGBITS=3        -w    -c Mercury/cs/agame.c -o Mercury/os/agame.o'...
>> 
>> So it is definitely using gcc at least. The output was been truncated. It says to see agame.err for the complete log but that doesn't contain the above line. I am very suspicious of the two initial '-I' options as they appear to be just pointing at the current folder? I see no mention of my desired include paths in the final output so for some reason as yet undetermined I've failed to pass these through to the build process!
>> 
>> The worst part is I know it's my fault....   :|
>> 
>> Sean.
>> 
>> 
>>> On 16 Nov 2022, at 20:51, Zoltan Somogyi <zoltan.somogyi at runbox.com> wrote:
>>> 
>>> 
>>> 2022-11-17 07:45 GMT+11:00 "Sean Charles (emacstheviking)" <objitsu at gmail.com>:
>>>> What I tried to ask for is how do I know what the final set of include paths is at compile time, and what compiler does mmc use as the default?
>>> 
>>> The section "Output options" in the user's guide, which is section 9.4
>>> in the ROTD version, has several options that print relevant information.
>>> You can also just give the -V flag to mmc, and it will tell you the exact
>>> command line it is using to compile the .c file to .o.
>>> 
>>> Zoltan.
>> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurylang.org/archives/users/attachments/20221116/a5aba395/attachment.html>


More information about the users mailing list