Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't build for Linux #3

Open
tig opened this issue Jan 20, 2020 · 5 comments
Open

Can't build for Linux #3

tig opened this issue Jan 20, 2020 · 5 comments

Comments

@tig
Copy link

tig commented Jan 20, 2020

The instruction in the readme.MD suggest

cd LiteHtmlLib
sh build.sh

But build.sh is in lib_dylib and it doesn't work, giving errors about directories not found and command line options:

c++: error: i386: No such file or directory
c++: error: i386: No such file or directory
c++: error: i386: No such file or directory
c++: error: x86_64: No such file or directory
c++: error: unrecognized command line option ‘-arch’; did you mean ‘-march=’?
c++: error: i386: No such file or directory
c++: error: x86_64: No such file or directory
...

Help please.

@zone117x
Copy link
Member

Try removing the -arch params from the lines in the CMake file

set(CMAKE_CXX_FLAGS "-arch i386 -arch x86_64 -std=c++11 -stdlib=libc++ -O3 -fms-extensions")
set(CMAKE_C_FLAGS "-arch i386 -arch x86_64 -std=c99 -O3 -fms-extensions")

@tig
Copy link
Author

tig commented Jan 22, 2020

Thanks.

@tig
Copy link
Author

tig commented Jan 24, 2020

I've made progress, but still struggling.

I had to modify CMakeLists.txt to remove the -arch params as @zone117x suggested.

Then I had to add add_library(litehtml SHARED ${SOURCE_LITEHTMLLIB} ${SOURCE_LITEHTML} ${SOURCE_GUMBO}) include_directories("../../../litehtml/include/litehtml") to the end of the file.

I also found I had to remove the -stdlib=libc++ param as it wasn't recognized either.

Looks like this now:

cmake_minimum_required(VERSION 2.8)

project(litehtml)

set(CMAKE_CXX_FLAGS "-std=c++11 -O3 -fms-extensions")
set(CMAKE_C_FLAGS "-std=c99 -O3 -fms-extensions")

set(SOURCE_LITEHTMLLIB 
                    ../../src/dllmain.cpp
                    ../../src/DocContainer.cpp
                    ../../src/Globals.cpp
                    ../../src/TagElement.cpp
)

set(SOURCE_LITEHTML 
                    ../../../litehtml/src/background.cpp
                    ../../../litehtml/src/box.cpp
                    ../../../litehtml/src/context.cpp
                    ../../../litehtml/src/css_length.cpp
                    ../../../litehtml/src/css_selector.cpp
                    ../../../litehtml/src/document.cpp
                    ../../../litehtml/src/el_anchor.cpp
                    ../../../litehtml/src/el_base.cpp
                    ../../../litehtml/src/el_before_after.cpp
                    ../../../litehtml/src/el_body.cpp
                    ../../../litehtml/src/el_break.cpp
                    ../../../litehtml/src/el_cdata.cpp
                    ../../../litehtml/src/el_comment.cpp
                    ../../../litehtml/src/el_div.cpp
                    ../../../litehtml/src/element.cpp
                    ../../../litehtml/src/el_font.cpp
                    ../../../litehtml/src/el_image.cpp
                    ../../../litehtml/src/el_link.cpp
                    ../../../litehtml/src/el_para.cpp
                    ../../../litehtml/src/el_script.cpp
                    ../../../litehtml/src/el_space.cpp
                    ../../../litehtml/src/el_style.cpp
                    ../../../litehtml/src/el_table.cpp
                    ../../../litehtml/src/el_td.cpp
                    ../../../litehtml/src/el_text.cpp
                    ../../../litehtml/src/el_title.cpp
                    ../../../litehtml/src/el_tr.cpp
                    ../../../litehtml/src/html.cpp
                    ../../../litehtml/src/html_tag.cpp
                    ../../../litehtml/src/iterators.cpp
                    ../../../litehtml/src/media_query.cpp
                    ../../../litehtml/src/style.cpp
                    ../../../litehtml/src/stylesheet.cpp
                    ../../../litehtml/src/table.cpp
                    ../../../litehtml/src/utf8_strings.cpp
                    ../../../litehtml/src/web_color.cpp
)

set(SOURCE_GUMBO    ../../../litehtml/src/gumbo/attribute.c
                    ../../../litehtml/src/gumbo/char_ref.c
                    ../../../litehtml/src/gumbo/error.c
                    ../../../litehtml/src/gumbo/parser.c
                    ../../../litehtml/src/gumbo/string_buffer.c
                    ../../../litehtml/src/gumbo/string_piece.c
                    ../../../litehtml/src/gumbo/tag.c
                    ../../../litehtml/src/gumbo/tokenizer.c
                    ../../../litehtml/src/gumbo/utf8.c
                    ../../../litehtml/src/gumbo/util.c
                    ../../../litehtml/src/gumbo/vector.c
)

add_library(litehtml SHARED ${SOURCE_LITEHTMLLIB} ${SOURCE_LITEHTML} ${SOURCE_GUMBO})
include_directories("../../../litehtml/include/litehtml")

But now I get:

make -j8
Scanning dependencies of target litehtml
[  1%] Building CXX object CMakeFiles/litehtml.dir/mnt/c/Users/ckindel/source/LiteHtmlSharp/LiteHtmlLib/src/dllmain.cpp.o
[  3%] Building CXX object CMakeFiles/litehtml.dir/mnt/c/Users/ckindel/source/LiteHtmlSharp/LiteHtmlLib/src/DocContainer.cpp.o
[  5%] Building CXX object CMakeFiles/litehtml.dir/mnt/c/Users/ckindel/source/LiteHtmlSharp/LiteHtmlLib/src/Globals.cpp.o
[  7%] Building CXX object CMakeFiles/litehtml.dir/mnt/c/Users/ckindel/source/LiteHtmlSharp/LiteHtmlLib/src/TagElement.cpp.o
[  9%] Building CXX object CMakeFiles/litehtml.dir/mnt/c/Users/ckindel/source/litehtml/src/background.cpp.o  [ 11%] Building CXX object CMakeFiles/litehtml.dir/mnt/c/Users/ckindel/source/litehtml/src/box.cpp.o
[ 15%] Building CXX object CMakeFiles/litehtml.dir/mnt/c/Users/ckindel/source/litehtml/src/context.cpp.o
[ 15%] Building CXX object CMakeFiles/litehtml.dir/mnt/c/Users/ckindel/source/litehtml/src/css_length.cpp.o  [ 17%] Building CXX object CMakeFiles/litehtml.dir/mnt/c/Users/ckindel/source/litehtml/src/css_selector.cpp.oIn file included from /mnt/c/Users/ckindel/source/LiteHtmlSharp/LiteHtmlLib/src/Globals.cpp:1:0:
/mnt/c/Users/ckindel/source/LiteHtmlSharp/LiteHtmlLib/src/Globals.h:9:24: error: expected constructor, destructor, or type conversion before ‘(’ token
 extern "C" { __declspec(dllexport) void Init(DocumentCalls& docCalls, SetCallbacksFunc initCallbacks); }  
...

What am I missing? Thanks for your help in advance.

@zone117x
Copy link
Member

Looks like you are using the WSL to build for linux on Windows? I'd recommend building in a virtual machine with Ubuntu.

I'm not familiar enough with C/C++ build systems to give you more insight -- I'd have to trial & error to figure it out, which I unfortunately don't have time to do at the moment.

@tig
Copy link
Author

tig commented Jan 24, 2020

Ok. I'm going to give up for now. but I'm sure I'll be back to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants