aseprite / laf

A C++ library to create desktop applications
https://aseprite.github.io/laf/
MIT License
274 stars 58 forks source link

compile-error without reason #67

Open mr-who2012 opened 11 months ago

mr-who2012 commented 11 months ago

I can't compile laf for some reason. The error-message is just "collect2: error: ld returned 1 exit status". I am trying to compile laf with skia. I downloaded skia-m102 from here: Skia-m102 and chose the libstdc++-version, since I think g++ is the compiler used in my system. I compiled and installed cmake 3.27 by hand, before.

as you can see in the compiler-output, I extracted skia-m102 to ~/deps/skia and set-up all path correctly. Nevertheless compiling just stops without usefull error-message.

Please see full compiler-output on pastebin

mr-who2012 commented 11 months ago

ok, I got it to work: Turns out, I had to compile skia by hand, in addition. The pre-compiled versions don't seem to work on ubuntu 18.04. For this, I had to install the package libc++-10-dev in ubuntu. They contain the c++10-header-files. Also I had to type

export CPLUS_INCLUDE_PATH=/usr/lib/llvm-10/include/c++/v1 at the command line, so the build-system could actually make use of the c++10-header-files.

BTW, the build-system is called GN and it needs to get downloaded with:

curl -L -o gn.zip "https://chrome-infra-packages.appspot.com/dl/gn/gn/linux-amd64/+/latest"

inside the downloaded zip-file was just one file "gn". I made it executable chmod ugo+x ./gn and copied it to /usr/local/bin so the system could make use of it.

Edit: The command to make the build-environmant of skia was: gn gen out/Release --args='is_debug=false is_official_build=true skia_use_system_expat=false skia_use_system_icu=false skia_use_system_libjpeg_turbo=false skia_use_system_libpng=false skia_use_system_libwebp=false skia_use_system_zlib=false skia_use_sfntly=false skia_use_freetype=true skia_use_harfbuzz=true skia_pdf_subset_harfbuzz=true skia_use_system_freetype2=false skia_use_system_harfbuzz=false cc="clang" cxx="clang++" extra_cflags_cc=["-stdlib=libc++"] extra_ldflags=["-stdlib=libc++"]' --extra-cxx-flags="-I/usr/lib/llvm-10/include/c++/v1"

this line is longer than stated in the official build-documentation.

Also, I had to add a few switches to make cmake work with clang or somethin' like this. I don't remember exactly. Anyway, this options needed to be added to the cmake-line of laf:

-DCMAKE_CXX_FLAGS=-stdlib=libc++ and -DCMAKE_EXE_LINKER_FLAGS=-stdlib=libc++

so, in the end (to compile laf) the line was: cmake -G Ninja -DLAF_BACKEND=skia -DSKIA_DIR=/home/user/deps/skia -DSKIA_LIBRARY_DIR=/home/user/deps/skia/out/Release-x64 -DCMAKE_CXX_FLAGS=-stdlib=libc++ -DCMAKE_EXE_LINKER_FLAGS=-stdlib=libc++ ..

compilation was started with

ninja afterwards