clbr / webkitfltk

22 stars 14 forks source link

aarch64 build fails with 'vasprintf' was not declared in this scope; did you mean 'vswprintf'? #29

Open juanitotc opened 3 years ago

juanitotc commented 3 years ago

Building natively on an RPi aarch64 - after applying the patch in #28 , sometime later, the build fails with:

make -C Source/WebCore CXX="g++ -march=armv8-a+crc -mtune=cortex-a72 -Os -pipe -DNDEBUG"
...
g++ -march=armv8-a+crc -mtune=cortex-a72 -Os -pipe -DNDEBUG -c -o platform/LocalizedStrings.o -I .. -I . -I ../WTF -std=gnu++11 -DBUILDING_FLTK__ -D_GLIBCXX_USE_SCHED_YIELD -D_GLIBCXX_USE_NANOSLEEP -I/usr/local/include  -I/usr/local/include/cairo -I/usr/local/include -I/usr/local/include/pixman-1 -I/usr/local/include -I/usr/local/include/libdrm -I/usr/local/include -I/usr/local/include/libxml2 -I/usr/local/include/harfbuzz -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include -I/usr/local/include -I/usr/local/include/freetype2 -I/usr/local/include/libpng16 -I/usr/local/include -I/usr/include/uuid -I/usr/local/include -I Modules/battery -I Modules/airplay -I Modules/encryptedmedia -I Modules/gamepad -I Modules/gamepad/deprecated -I Modules/geolocation -I Modules/indexeddb -I Modules/indieui -I Modules/mediacontrols/ -I Modules/mediasource -I Modules/mediastream -I Modules/navigatorcontentutils -I Modules/notifications -I Modules/plugins -I Modules/proximity -I Modules/quota -I Modules/speech -I Modules/streams -I Modules/vibration -I Modules/webaudio -I Modules/webdatabase -I Modules/websockets -I accessibility -I bindings -I bindings/generic -I bindings/js -I bridge -I bridge/c -I bridge/jsc -I contentextensions -I crypto -I crypto/algorithms -I crypto/keys -I crypto/parameters -I css -I cssjit -I dom -I dom/default -I editing -I fileapi -I history -I html -I html/canvas -I html/forms -I html/parser -I html/shadow -I html/track -I inspector -I loader -I loader/appcache -I loader/archive -I loader/archive/mhtml -I loader/cache -I loader/icon -I mathml -I page -I page/animation -I page/scrolling -I platform -I platform/animation -I platform/audio -I platform/graphics -I platform/graphics/cpu/arm -I platform/graphics/cpu/arm/filters -I platform/graphics/filters -I platform/graphics/filters/texmap -I platform/graphics/harfbuzz -I platform/graphics/harfbuzz/ng -I platform/graphics/opentype -I platform/graphics/texmap -I platform/graphics/transforms -I platform/image-decoders -I platform/image-decoders/bmp -I platform/image-decoders/gif -I platform/image-decoders/ico -I platform/image-decoders/jpeg -I platform/image-decoders/png -I platform/image-decoders/webp -I platform/mediastream -I platform/mock -I platform/mock/mediasource -I platform/network -I platform/sql -I platform/text -I platform/text/icu -I plugins -I rendering -I rendering/line -I rendering/mathml -I rendering/shapes -I rendering/style -I rendering/svg -I replay -I storage -I style -I svg -I svg/animation -I svg/graphics -I svg/graphics/filters -I svg/properties -I websockets -I workers -I xml -I xml/parser -I ../JavaScriptCore -I ../JavaScriptCore/ForwardingHeaders -I ../JavaScriptCore/API -I ../JavaScriptCore/assembler -I ../JavaScriptCore/bytecode -I ../JavaScriptCore/bytecompiler -I ../JavaScriptCore/dfg -I ../JavaScriptCore/disassembler -I ../JavaScriptCore/heap -I ../JavaScriptCore/debugger -I ../JavaScriptCore/interpreter -I ../JavaScriptCore/inspector -I ../JavaScriptCore/jit -I ../JavaScriptCore/llint -I ../JavaScriptCore/parser -I ../JavaScriptCore/profiler -I ../JavaScriptCore/runtime -I ../JavaScriptCore/yarr -I ForwardingHeaders -I platform/cairo -I platform/graphics/cairo -I platform/graphics/freetype -I platform/linux -I platform/network/curl -I platform/text/icu  -DENABLE_CANVAS_PATH  -DENABLE_CHANNEL_MESSAGING  -DENABLE_CONTEXT_MENUS  -DENABLE_CSS_BOX_DECORATION_BREAK  -DENABLE_CSS_TRANSFORMS_ANIMATIONS_UNPREFIXED  -DENABLE_DETAILS_ELEMENT  -DENABLE_FTPDIR  -DENABLE_HIDDEN_PAGE_DOM_TIMER_THROTTLING  -DENABLE_ICONDATABASE  -DENABLE_IMAGE_DECODER_DOWN_SAMPLING  -DENABLE_JIT  -DENABLE_LEGACY_VENDOR_PREFIXES  -DENABLE_LINK_PREFETCH  -DENABLE_LLINT  -DENABLE_METER_ELEMENT  -DENABLE_NAVIGATOR_HWCONCURRENCY  -DENABLE_PROMISES  -DENABLE_PROGRESS_ELEMENT  -DENABLE_SVG_FONTS  -DENABLE_TEMPLATE_ELEMENT  -DENABLE_WEB_SOCKETS  -DENABLE_XSLT  -DENABLE_VIEW_MODE_CSS_MEDIA  -DENABLE_CURSOR_SUPPORT  -DENABLE_DRAG_SUPPORT  -DENABLE_FIFTH_VIDEO  -DENABLE_VIDEO  -DENABLE_VIDEO_TRACK  -DENABLE_MATHML  -DENABLE_TEXT_CARET  -DENABLE_TEXT_SELECTION  -DENABLE_WILL_REVEAL_EDGE_EVENTS  -DUSE_TEXTURE_MAPPER  -DENABLE_REQUEST_AUTOCOMPLETE  -DENABLE_REQUEST_ANIMATION_FRAME  -DUSE_CROSS_PLATFORM_CONTEXT_MENUS -DENABLE_NETSCAPE_PLUGIN_API=0 -DENABLE_DATE_AND_TIME_INPUT_TYPES=0 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -Wall -I/usr/local/include -fvisibility-inlines-hidden -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_THREAD_SAFE -D_REENTRANT platform/LocalizedStrings.cpp
platform/LocalizedStrings.cpp: In function 'WTF::String WebCore::formatLocalizedString(WTF::String, ...)':
platform/LocalizedStrings.cpp:74:21: error: 'vasprintf' was not declared in this scope; did you mean 'vswprintf'?
   74 |     const int ret = vasprintf(&tmp, format.utf8().data(), ap);
      |                     ^~~~~~~~~
      |                     vswprintf
make: *** [Makefile:3549: platform/LocalizedStrings.o] Error 1
make: Leaving directory '/usr/src/webkitfltk/Source/WebCore'
Command exited with non-zero status 2

if "vswprintf" is substituted, the build fails with:

platform/LocalizedStrings.cpp: In function 'WTF::String WebCore::formatLocalizedString(WTF::String, ...)':
platform/LocalizedStrings.cpp:74:31: error: cannot convert 'char**' to 'wchar_t*'
   74 |     const int ret = vswprintf(&tmp, format.utf8().data(), ap);
      |                               ^~~~
      |                               |
      |                               char**
clbr commented 3 years ago

This one probably needs "#define _GNU_SOURCE" at the top, above all

includes.

juanitotc commented 3 years ago

Unfortunately it's not that:

platform/LocalizedStrings.cpp:26: warning: "_GNU_SOURCE" redefined
   26 | #define _GNU_SOURCE
      | 
<command-line>: note: this is the location of the previous definition
platform/LocalizedStrings.cpp: In function 'WTF::String WebCore::formatLocalizedString(WTF::String, ...)':
platform/LocalizedStrings.cpp:74:21: error: 'vasprintf' was not declared in this scope; did you mean 'vswprintf'?
   74 |     const int ret = vasprintf(&tmp, format.utf8().data(), ap);
      |                     ^~~~~~~~~
      |                     vswprintf
make: *** [Makefile:3549: platform/LocalizedStrings.o] Error 1

I don't see anything similiar on google - where in webkit git do you source the port from?

clbr commented 3 years ago

This part is custom code.

Well, if not GNU_SOURCE, then it's gcc changing its includes again, and the file needs an "#include ".

juanitotc commented 3 years ago

That appears to have fixed things :)

juanitotc commented 3 years ago

This is the patch that fixes it for gcc-10.1.0:

--- Source/WebCore/platform/LocalizedStrings.cpp.orig   2020-11-20 14:35:13.139811798 +0100
+++ Source/WebCore/platform/LocalizedStrings.cpp    2020-11-20 12:26:38.555816396 +0100
@@ -33,6 +33,8 @@
 #include <wtf/text/CString.h>
 #include <wtf/unicode/CharacterNames.h>

+#include <stdio.h>
+
 #if USE(CF)
 #include <wtf/RetainPtr.h>
 #endif