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

synctex_parser: fix vasprintf() not exists in non-GNU environment #134

Merged
merged 1 commit into from
Aug 22, 2022

Conversation

sunlin7
Copy link
Contributor

@sunlin7 sunlin7 commented Jul 28, 2022

The vasprintf() is a GNU extension function, missed in non-GNU build environment, so we define it.

Without this change, there will have error message when build with clang:

./autogen.sh
./configure CC=clang
make

Will get errors:

synctex_parser.c:8448:13: error: call to undeclared function 'vasprintf'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
        if (vasprintf(&buffer, format, va) < 0) {

The vasprintf() is a GNU extension function, define it in non-GNU env.
@vedang vedang merged commit bea5ddb into vedang:master Aug 22, 2022
@vedang
Copy link
Owner

vedang commented Aug 22, 2022

Thanks, I've merged the change in.

@sunlin7
Copy link
Contributor Author

sunlin7 commented Aug 22, 2022

@vedang Thank you !

vedang added a commit that referenced this pull request Aug 23, 2022
…ment (#134)"

This reverts commit bea5ddb because
`pdf-tools` compilation is broken.

Closes: #141
Reopens: #134
@vedang
Copy link
Owner

vedang commented Aug 23, 2022

Please note that I have reverted the change since it broke compilation on Mac OS. I will look into the problem later once I have some time, for the moment I have fixed the master branch by reverting the change.

@sunlin7
Copy link
Contributor Author

sunlin7 commented Aug 23, 2022

Sorry for the disturb, and look forward for the better solution. Thanks.

@cyrilarnould
Copy link

FYI, I found that I can build v1.1.0 with the following in MSYS2's clang environment:

./autogen.sh
CFLAGS='-g -O2 -D_GNU_SOURCE' ./configure
make

Not sure if this also works in your environment, however.

@sunlin7
Copy link
Contributor Author

sunlin7 commented Jun 27, 2023

According #141 , the vasprintf should no be static in the synctex_parser.c while stdio.h:381 defined it as external.

synctex_parser.c:8421:12: error: static declaration of 'vasprintf' follows non-static declaration
static int vasprintf(char **ret,
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/stdio.h:381:6: note:
previous declaration is here
int vasprintf(char ** __restrict, const char * __restrict, va_list) __printflike(2, 0);
^

@LinuxUserGD
Copy link

According #141 , the vasprintf should no be static in the synctex_parser.c while stdio.h:381 defined it as external.

Upstream defines _GNU_SOURCE to fix the error
https://www.tug.org/svn/texlive/trunk/Build/source/texk/web2c/synctexdir/synctex_parser.c?view=markup#l89

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

Successfully merging this pull request may close these issues.

4 participants