Skip to content

fails to build with clang/libc++ #910

New issue

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

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

Already on GitHub? # to your account

Closed
markand opened this issue Apr 17, 2019 · 7 comments
Closed

fails to build with clang/libc++ #910

markand opened this issue Apr 17, 2019 · 7 comments

Comments

@markand
Copy link
Contributor

markand commented Apr 17, 2019

Hello,

I'm trying to build jsoncpp 1.8.4 with clang and libc++.

[5/10] Compiling C++ object 'jsoncpp@sha/src_lib_json_json_writer.cpp.o'.
FAILED: jsoncpp@sha/src_lib_json_json_writer.cpp.o
clang++ -Ijsoncpp@sha -I. -I.. -I../include -Xclang -fcolor-diagnostics -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wnon-virtual
-dtor -O3 -O2 -fPIC -MD -MQ 'jsoncpp@sha/src_lib_json_json_writer.cpp.o' -MF 'jsoncpp@sha/src_lib_json_json_writer.cpp.o.d' -o 'jsoncp
p@sha/src_lib_json_json_writer.cpp.o' -c ../src/lib_json/json_writer.cpp
In file included from ../src/lib_json/json_writer.cpp:7:
In file included from ../include/json/writer.h:10:
In file included from ../include/json/value.h:10:
In file included from ../include/json/forwards.h:10:
In file included from ../include/json/config.h:9:
In file included from /bin/../include/c++/v1/string:505:
In file included from /bin/../include/c++/v1/string_view:176:
In file included from /bin/../include/c++/v1/__string:57:
In file included from /bin/../include/c++/v1/algorithm:640:
In file included from /bin/../include/c++/v1/initializer_list:47:
In file included from /bin/../include/c++/v1/cstddef:38:
../version:1:1: error: expected unqualified-id
1.8.4

To my understanding, cstddef.h from libc++ does #include <version> and therefore includes the filename version in the project directory, which isn't a C++ header file, thus the error.

I don't know how we can fix that correctly though. Renaming that file?

@markand markand changed the title fail to build with clang/libc++ fails to build with clang/libc++ Apr 17, 2019
@cdunn2001
Copy link
Contributor

Renaming would be fine. Could you submit a PR for that?

@markand
Copy link
Contributor Author

markand commented Apr 18, 2019

Done via #911. I've only tested with clang yet. Is this file used anywhere in the build process?

@cdunn2001
Copy link
Contributor

I don't remember why this file is generated. I think it's ok to rename it. However, I know where it's generated, in CMakeLists.txt:

102 configure_file( "${PROJECT_SOURCE_DIR}/version.in"
103                 "${PROJECT_BINARY_DIR}/version"
104                 NEWLINE_STYLE UNIX )

... Oh, I see where it's used, in dev.makefile, to help sign a release. So rename it there too please.

@BillyDonahue
Copy link
Contributor

That 'version' file should have been harmless. It wasn't in a directory that contains c++ code, so why was the compiler pointed at it? That is, I don't think there was a reason to have -I .. in the compile command. The compiler isn't going to find anything useful there.

I don't know enough about meson to guess where the offending -I .. is coming from, but I suspect we don't want or need it.

@cdunn2001
Copy link
Contributor

https://mesonbuild.com/Include-directories.html

Another thing to note is that include_directories adds both the source directory and corresponding build directory to include path, so you don't have to care.

Not sure, but that seems to indicate Meson does add some -I directories magically. Let's just call it version.txt and be done with it.

@markand
Copy link
Contributor Author

markand commented Apr 23, 2019

I don't remember why this file is generated. I think it's ok to rename it. However, I know where it's generated, in CMakeLists.txt:

102 configure_file( "${PROJECT_SOURCE_DIR}/version.in"
103                 "${PROJECT_BINARY_DIR}/version"
104                 NEWLINE_STYLE UNIX )

... Oh, I see where it's used, in dev.makefile, to help sign a release. So rename it there too please.

No, the file version.in is generated in the build directory (aka where you run CMake). The original version file is untouched from CMake (unless you run CMake in the root directory which is harmful).

@eirnym
Copy link

eirnym commented May 21, 2019

Please, make a release with this, as your distro have to be patched to be used this way

res2k pushed a commit to res2k/jsoncpp that referenced this issue Aug 21, 2019
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants