Issue 366 in webp: Build failure with SDL support enabled on macOS

22 views
Skip to first unread message

ryandesi… via monorail

unread,
Dec 4, 2017, 6:31:20 AM12/4/17
to webp-d...@webmproject.org
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 366 by ryandesi...@gmail.com: Build failure with SDL support enabled on macOS
https://bugs.chromium.org/p/webp/issues/detail?id=366

What steps will reproduce the problem?
1. Install libsdl
2. Build libwebp

What is the expected output? What do you see instead?

Expected successful build. Got build failure:

Undefined symbols for architecture x86_64:
"_main", referenced from:
implicit entry/start for main executable
(maybe you meant: _SDL_main)
ld: symbol(s) not found for architecture x86_64

What version of the product are you using? On what operating system?

libwebp 0.6.1 on macOS 10.12.6 Sierra

Please provide any additional information below.

Hi, I'm the maintainer of webp in MacPorts. I noticed while trying to update out webp port to 0.6.1 that it autodetects SDL support, but then fails to build. Full build log attached. If I supply the --disable-sdl configure arg, the build succeeds.

Attachments:
main.log 434 KB

--
You received this message because:
1. The project was configured to send all issue notifications to this address

You may adjust your notification preferences at:
https://bugs.chromium.org/hosting/settings

jz… via monorail

unread,
Dec 5, 2017, 1:24:49 AM12/5/17
to webp-d...@webmproject.org
Updates:
Status: Accepted

Comment #1 on issue 366 by jz...@google.com: Build failure with SDL support enabled on macOS
https://bugs.chromium.org/p/webp/issues/detail?id=366#c1

Thanks for the report, the workaround is the correct solution at this point.

It seems SDL 1.2 is defining main -> SDL_main on OSX, but that symbol isn't present in the library. SDL 2 looks to have reorganized that header [2], but I haven't tried changing the code to use it.
A possible solution would be to counteract that define in the code or at least we should be performing a link test in configure.

[1] http://hg.libsdl.org/SDL/file/fba40d9f4a73/include/SDL_main.h#l32

ryandesi… via monorail

unread,
Feb 3, 2018, 10:57:10 PM2/3/18
to webp-d...@webmproject.org

Comment #2 on issue 366 by ryandesi...@gmail.com: Build failure with SDL support enabled on macOS
https://bugs.chromium.org/p/webp/issues/detail?id=366#c2

Yes, SDL redefines main on macOS and Windows. You need to link with libSDLmain.a (SDL 1) or libSDL2main.a (SDL 2) to get their main function that does the SDL initialization and then calls SDL_main.

jz… via monorail

unread,
Feb 5, 2018, 7:50:38 PM2/5/18
to webp-d...@webmproject.org

Comment #3 on issue 366 by jz...@google.com: Build failure with SDL support enabled on macOS
https://bugs.chromium.org/p/webp/issues/detail?id=366#c3

From what I remember libSDLmain.a from ports didn't have SDL_main defined which led to my comment in #1. I only looked briefly though and may have been missing a -framework when linking.

bugdro… via monorail

unread,
Mar 31, 2018, 4:01:37 AM3/31/18
to webp-d...@webmproject.org

Comment #5 on issue 366 by bugd...@chromium.org: Build failure with SDL support enabled on macOS
https://bugs.chromium.org/p/webp/issues/detail?id=366#c5

The following revision refers to this bug:
https://chromium.googlesource.com/webm/libwebp/+/daa9fcaf5b81cd2e404a9c73e796d4c833d5742f

commit daa9fcaf5b81cd2e404a9c73e796d4c833d5742f
Author: James Zern <jz...@google.com>
Date: Sat Mar 31 06:30:43 2018

configure: use sdl-config if available

+ do a full link to ensure SDL_main is resolved if needed

fixes detection on OS X

BUG=webp:366

Change-Id: Id53329f5d1c2536c4584be61c6379fa76ff0e5de

[modify] https://crrev.com/daa9fcaf5b81cd2e404a9c73e796d4c833d5742f/configure.ac

jz… via monorail

unread,
Apr 2, 2018, 5:18:35 PM4/2/18
to webp-d...@webmproject.org
Updates:
Labels: v0.6.2

Comment #6 on issue 366 by jz...@google.com: Build failure with SDL support enabled on macOS
https://bugs.chromium.org/p/webp/issues/detail?id=366#c6

Additional work for this and other libs could be done to use pkg-config if present as well, but for the time being I think the original issue has been addressed. Any other changes can be tracked in a separate bug.
Reply all
Reply to author
Forward
0 new messages