Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 430502 - =x11-misc/slim-1.3.4: fails to build at least on arm system
Summary: =x11-misc/slim-1.3.4: fails to build at least on arm system
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Ian Stakenvicius (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-08 22:54 UTC by Anthony Basile
Modified: 2012-10-08 14:14 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Anthony Basile gentoo-dev 2012-08-08 22:54:51 UTC
I hit this on an arm device but I can't see how it won't affect all arches.  slim fails due to a trivial syntax error:


/var/tmp/portage/x11-misc/slim-1.3.4/work/slim-1.3.4/Ck.cpp: In member function 'const char* Ck::Session::get_x11_device(const string&)':
/var/tmp/portage/x11-misc/slim-1.3.4/work/slim-1.3.4/Ck.cpp:94:5: error: 'snprintf' is not a member of 'std'
/var/tmp/portage/x11-misc/slim-1.3.4/work/slim-1.3.4/Ck.cpp:94:5: note: suggested alternative:
/usr/include/bits/stdio2.h:62:1: note:   'snprintf'
make[2]: *** [CMakeFiles/slim.dir/Ck.cpp.o] Error 1
make[2]: Leaving directory `/var/tmp/portage/x11-misc/slim-1.3.4/work/slim-1.3.4_build'
make[1]: *** [CMakeFiles/slim.dir/all] Error 2
make[1]: Leaving directory `/var/tmp/portage/x11-misc/slim-1.3.4/work/slim-1.3.4_build'
make: *** [all] Error 2


The problem is on line 94 of slim-1.3.4/Ck.cpp.  They have std::snprintf but snprintf isn't in std!  Just change that line from

    std::snprintf(device, 32, "/dev/tty%ld", vt);

to

    snprintf(device, 32, "/dev/tty%ld", vt);

and slim is a happy camper!

Reproducible: Always
Comment 1 Ian Stakenvicius (RETIRED) gentoo-dev 2012-10-05 18:33:44 UTC
For whatever reason, ARM is not C++98 compatible in that cdstio does not provide std::snprintf ...  I'm proposing to fix this by changing the call from std::snprintf to std::sprintf , but I need confirmation that std::sprintf exists on arm (i don't trust the arm devel doc i came across earlier while googling).

(Fortunately, the buffer that std::snprintf is writing to will always be bigger than the maximum-possible value of the string being written, wnich makes this a trivial change)
Comment 2 Ian Stakenvicius (RETIRED) gentoo-dev 2012-10-05 19:22:12 UTC
+  05 Oct 2012; Ian Stakenvicius <axs@gentoo.org> slim-1.3.4-r1.ebuild,
+  +files/slim-1.3.4-arm.patch:
+  swapped snprintf for sprintf to support arm's broken C++98 (bug 430502)
+
Comment 3 Anthony Basile gentoo-dev 2012-10-06 13:15:28 UTC
Confirmed that this fixes it.  Wouldn't a better, albeit harder fix be to fix ARM C++98?
Comment 4 Ian Stakenvicius (RETIRED) gentoo-dev 2012-10-07 17:29:48 UTC
Yes, it would.  However, since I expect that this isn't going to happen any time soon (if ever), I figured it would be better to work around the issue rather than wait for compliance.  Especially since the workaround doesn't invalidate arches that are fully C++98 compliant.
Comment 5 Anthony Basile gentoo-dev 2012-10-08 14:14:44 UTC
(In reply to comment #4)
> Yes, it would.  However, since I expect that this isn't going to happen any
> time soon (if ever), I figured it would be better to work around the issue
> rather than wait for compliance.  Especially since the workaround doesn't
> invalidate arches that are fully C++98 compliant.

Fair enough.