rust-diplomat / diplomat

Experimental Rust tool for generating FFI definitions allowing many other languages to call Rust code
https://rust-diplomat.github.io/book/
Other
480 stars 45 forks source link

We're not actually testing clang #516

Closed Manishearth closed 3 weeks ago

Manishearth commented 3 weeks ago

CXX in Make is special, it defaults to g++ unless asked otherwise.

So in CI when we run cargo make test-cpp2 we're not actually running with the default clang++-14, we're just running g++ again.

Currently the cpp2 tests fail with clang, for reasons pertaining to the makefile (probably)

[19:43:02] मanishearth@manishearth-glaptop2 ~/dev/diplomat/feature_tests/cpp2 ^_^ 
$ make
g++ -std=c++17 ./tests/structs.cpp ../../target/debug/libdiplomat_feature_tests.a -lstdc++ -ldl -lpthread -lm -g -o ./tests/structs.out
g++ -std=c++17 ./tests/result.cpp ../../target/debug/libdiplomat_feature_tests.a -ldl -lpthread -lm -g -o ./tests/result.out
g++ -std=c++17 ./tests/option.cpp ../../target/debug/libdiplomat_feature_tests.a -ldl -lpthread -lm -g -o ./tests/option.out
g++ -std=c++17 ./tests/attrs.cpp ../../target/debug/libdiplomat_feature_tests.a -ldl -lpthread -lm -g -o ./tests/attrs.out
./tests/structs.out
./tests/result.out
./tests/option.out
./tests/attrs.out
Renamed function at 0x55ee61d8f2e0
Renamed function at 0x55ee61d8f2d0
[19:43:02] मanishearth@manishearth-glaptop2 ~/dev/diplomat/feature_tests/cpp2 ^_^
$ CXX=clang++ make
clang++ -std=c++17 ./tests/structs.cpp ../../target/debug/libdiplomat_feature_tests.a -lstdc++ -ldl -lpthread -lm -g -o ./tests/structs.out
./tests/structs.cpp:1:10: fatal error: 'iostream' file not found
#include <iostream>
         ^~~~~~~~~~
1 error generated.
make: *** [Makefile:17: tests/structs.out] Error 1
Manishearth commented 3 weeks ago

Ah, this failure is just a matter of "clang uses headers from gcc, and if you don't have the g++ corresponding to your latest gcc, clang will be sad"

Manishearth commented 3 weeks ago

Attempting to fix this in https://github.com/rust-diplomat/diplomat/pull/515