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

Unknown type uint trying to use the shared lib. #906

Closed
vtr88 opened this issue Nov 13, 2020 · 5 comments
Closed

Unknown type uint trying to use the shared lib. #906

vtr88 opened this issue Nov 13, 2020 · 5 comments

Comments

@vtr88
Copy link

vtr88 commented Nov 13, 2020

The code I'm using is https://curl.se/libcurl/c/htmltidy.html ;
Either through the libtidy-dev package https://packages.debian.org/unstable/libtidy-dev or after building from source:

[100%] Built target tidy-share
Install the project...
-- Install configuration: "Release"
-- Installing: /usr/lib/libtidys.a
-- Installing: /usr/include/tidyplatform.h
-- Installing: /usr/include/tidy.h
-- Installing: /usr/include/tidyenum.h
-- Installing: /usr/include/tidybuffio.h
-- Installing: /usr/lib/libtidy.so.5.7.35
-- Installing: /usr/lib/libtidy.so.5
-- Installing: /usr/lib/libtidy.so
-- Installing: /usr/bin/tidy
-- Installing: /usr/share/man/man1/tidy.1
-- Installing: /usr/lib/pkgconfig/tidy.pc

I keep getting the same error with that sample code:

$ make
c99 -g -Wall -O3 tidytest.c pkg-config --libs libcurl tidy -o tidytest

In file included from /usr/include/tidy.h:69,
from tidytest.c:2:
/usr/include/tidyplatform.h:605:9: error: unknown type name ‘uint’
605 | typedef uint tchar; /* single, full character */
| ^~~~
In file included from tidytest.c:2:
/usr/include/tidy.h:445:13: error: unknown type name ‘uint’; did you mean ‘int’?
445 | TIDY_EXPORT uint TIDY_CALL tidyErrorCount( TidyDoc tdoc );
| ^~~~
| int
/usr/include/tidy.h:451:13: error: unknown type name ‘uint’; did you mean ‘int’?
451 | TIDY_EXPORT uint TIDY_CALL tidyWarningCount( TidyDoc tdoc );
| ^~~~
| int
/usr/include/tidy.h:457:13: error: unknown type name ‘uint’; did you mean ‘int’?
457 | TIDY_EXPORT uint TIDY_CALL tidyAccessWarningCount( TidyDoc tdoc );
| ^~~~
| int
/usr/include/tidy.h:464:13: error: unknown type name ‘uint’; did you mean ‘int’?
464 | TIDY_EXPORT uint TIDY_CALL tidyConfigErrorCount( TidyDoc tdoc );
| ^~~~
| int
In file included from tidytest.c:2:
/usr/include/tidy.h:749:13: error: unknown type name ‘ulong’; did you mean ‘long’?
749 | TIDY_EXPORT ulong TIDY_CALL tidyOptGetDefaultInt( TidyOption opt );
| ^~~~~
| long

And it keeps going on and on.

@vtr88 vtr88 changed the title Unknown type uint trying to use the shared lib. Unknown type uint trying to use the shared lib. Build/Install Nov 13, 2020
@vtr88 vtr88 changed the title Unknown type uint trying to use the shared lib. Build/Install Unknown type uint trying to use the shared lib. Nov 13, 2020
@geoffmcl
Copy link
Contributor

@vtr88 thank you for your issue... hope we can find a solution...

This unknown type name uint and ulong has come up before... See #453, #636, and maybe others...

uint is used over 770 times in tidy code... How come you were able to build tidy from source, if uint was not defined?

What is different about compiling tidy sources, and compiling tidytest.c... which also uses uint, in the callback uint write_cb(char *in, uint size, uint nmemb, ... )...

For certain platforms it is explicitly typedef in tidyplatform.h.

What platform are you on? But this does not explain why you can compile tidy source, and not tidytest.c...

HTH... Look forward to further feedback... and hopefully a solution!... thanks...

@vtr88
Copy link
Author

vtr88 commented Nov 15, 2020

Thank you very much for your reply and sorry for my newbieness.
Well for now I just added the typedefs on the test file for testing purposes and it works.
I'm actually on kali linux: Debian 5.9.1-1kali2 (2020-10-29) x86_64 GNU/Linux with HTML Tidy for Linux version 5.7.35.
The full compilation error for tidytest.c is https://pastebin.com/zFDwbz2j and the I'm using CFLAGS= -g -Wall -O3, LDLIBS=pkg-config --libs libcurl tidy, CC=c99 in make.

I guess the normal definition of uint ulong is on /usr/include/x86_64-linux-gnu/sys/types.h for me.

@geoffmcl
Copy link
Contributor

@vtr88 thanks for the further feedback...

I guess I am still at a loss to understand why you were able to compile tidy, from source - that is what you did right? - and then have trouble compiling a separate source, tidytest.c, which includes the tidy.h headers...

I have a separate, private, projects called tidy-test, which also includes a slightly enhanced version of the Curl tidytest.c, and I have had no problem, in several distros, compiling it.

Out of interest, you might want to clone that repo, and give it a try... It uses cmake to build the makefiles and cmake find modules, to find tidy and curl... Be interested to hear any results... In some folder, just do -

$ git clone git@github.com:geoffmcl/tidy-test.git
$ cd tidy-test/build
$ cmake ..
$ make

You should end up with a htmltidy executable, among other things... Advise, if you get the chance...

And you mentioned both I just added the typedefs on the test file, and I guess the normal definition of uint ... sys/types.h for me.

So why did you just not add #include <sys/types.h> to the test file? Does this work also, after removing any added typdefs?

I am sorry to push you on this, as a self expressed newbie, but I just want to cleanly and precisely nail down this issue, hopefully once and for all - the case of the missing uint! As mentioned, it has come up before...

Hope you can provide further feedback... and maybe close this... thanks...

@vtr88
Copy link
Author

vtr88 commented Nov 24, 2020

Sorry for taking so long to respond.
Cloning the repo and compiling works without issues: https://pastebin.com/1abPpszH
Adding '#include <sys/types.h>' gives me the same errors. Only explicitly adding typedef unsigned int/long uint/ulong; works.
I can close the issue since that solves it for me. Will only let it open if you need me to do more tests. I'd be glad to help in any way.

Thank you.

@geoffmcl
Copy link
Contributor

@vtr88 thank you for the further feedback...

Glad you had success compiling my repo, with htmltidy.c... that's good...

I do understand that #include <sys/types.h> does not solve it for everyone, hence tidyplatform.h, included by tidy.h, also had an explicit typedef for some platform... I am just at a loss why this did not work for you.

But ok, if you have solved it for yourself, then closing this... thanks...

bbguimaraes added a commit to bbguimaraes/machinatrix that referenced this issue May 25, 2021
Tidy uses the non-standard `uint`/`ulong` `typedef`s defined by (among
others)`_GNU_SOURCE`, `common.h` defines those for now.

htacg/tidy-html5#906
bbguimaraes added a commit to bbguimaraes/machinatrix that referenced this issue May 25, 2021
Tidy uses the non-standard `uint`/`ulong` `typedef`s defined by (among
others)`_GNU_SOURCE`, `common.h` defines those for now.

htacg/tidy-html5#906
bbguimaraes added a commit to bbguimaraes/machinatrix that referenced this issue Oct 30, 2021
Tidy uses the non-standard `uint`/`ulong` `typedef`s defined by (among
others)`_GNU_SOURCE`, `common.h` defines those for now.

htacg/tidy-html5#906
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants