Bug 235493 - emulators/mame: Fix build with system clang
Summary: emulators/mame: Fix build with system clang
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-ports-bugs mailing list
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2019-02-04 14:00 UTC by Naram Qashat
Modified: 2019-02-17 18:31 UTC (History)
2 users (show)

See Also:


Attachments
mame.patch (1.20 KB, patch)
2019-02-04 14:00 UTC, Naram Qashat
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Naram Qashat 2019-02-04 14:00:44 UTC
Created attachment 201719 [details]
mame.patch

I'm not sure if this problem occurred for anyone else, but with the system clang, MAME's build system thinks it is running GCC instead of Clang and its genie lua script spits out the incorrect message of "GCC version 5.0 or later needed", as seen here:

http://kirby.cyberbotx.com:8765/poudriere/data/local-default/2018-12-24_10h40m30s/logs/errors/mame-0.200_2.log

The attached patch fixes this so it correctly sees it as clang. I'm really not sure WHY it doesn't detect it as clang properly, but this fixes it regardless.
Comment 1 Fernando Apesteguía freebsd_committer 2019-02-12 21:50:54 UTC
(In reply to Naram Qashat from comment #0)

Hi Naram,

Sorry, but I can't reproduce this. It builds fine for me in {11.2,12.0}{amd64,i386} and 13-current i386.

Do you have any specifics settings that can trigger this problem?
Comment 2 Naram Qashat 2019-02-12 22:02:14 UTC
(In reply to Fernando Apesteguía from comment #1)

Not that I'm aware of. I'm just building in poudriere in a 12-amd64 jail. My options for MAME are set to their defaults. 'clang --version' reports it to be clang 6.0.1, so I really don't know what is going on with my system causing that.
Comment 3 Fernando Apesteguía freebsd_committer 2019-02-13 18:17:56 UTC
(In reply to Naram Qashat from comment #2)

I see in your log you're using ccache. Could you try to disable it and/or clean the cache directory?
Comment 4 Naram Qashat 2019-02-15 01:43:27 UTC
(In reply to Fernando Apesteguía from comment #3)

Just tried without my patch and without ccache on, same issue for me:

http://kirby.cyberbotx.com:8765/poudriere/data/local-default/2019-02-14_20h35m10s/logs/errors/mame-0.200_3.log

Still have no idea why it is happening.
Comment 5 Fernando Apesteguía freebsd_committer 2019-02-15 18:10:28 UTC
(In reply to Naram Qashat from comment #4)
Could you try something like this?

make clean && make extract the port

Modify genie.lua and add 
print("XXX " .. _OPTIONS["gcc"]);
right after the conditional you modify in your patch.

Build the port and save the output to out.txt

grep XXX out.txt and show the result.

This is my ouptput:

fernape@hammer:~/FreeBSD-repos/ports/head/emulators/mame$ grep XXX salida 
XXX freebsd-clang
fernape@hammer:~/FreeBSD-repos/ports/head/emulators/mame$ 


What's yours?
Comment 6 Naram Qashat 2019-02-15 21:28:35 UTC
(In reply to Fernando Apesteguía from comment #5)

For me I get

XXX freebsd

Without the -clang part at the end. After a little digging, I notice that my genie command is getting called with --gcc=freebsd, though, which is why _OPTIONS["gcc"] is freebsd instead of freebsd-clang. And freebsd-clang only seems to be added via patches in the port's files directory. Not really sure what is causing it to still pick freebsd instead of freebsd-clang. That is beyond my understanding of MAME's build system.
Comment 7 Fernando Apesteguía freebsd_committer 2019-02-17 17:54:32 UTC
(In reply 'to Naram Qashat from comment #6)
Can you do

make clean && make patch

¿Does it show any errors? If not, can you attach ${WRKSRC}/makefile and ${WRKSRC}/scripts/toolchain.lua?
Comment 8 Naram Qashat 2019-02-17 18:02:10 UTC
(In reply to Fernando Apesteguía from comment #7)

There were no errors in patching. I assume you want to make sure that freebsd-clang is in those two files, and it is:

http://www.cyberbotx.com/mame-makefile
http://www.cyberbotx.com/mame-toolchain.lua
Comment 9 Fernando Apesteguía freebsd_committer 2019-02-17 18:31:18 UTC
(In reply to Naram Qashat from comment #8)

Yep. Those files are identical to mine :S

I don't know what's going on here.