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
linux port now on my opencompiler-port branch (the default) #9
Comments
I'd like to see the changes upstream, any plans? |
Fixed up more stuff so you can do "cd src ; make CXX=clang++" to build with clang too. And took and adapted Georg Seifert's xcode proj stuff too, so it should build on macs whether you want to use xcode gui or plain make. |
I just signed the cla for a pull, and as it stands, I think it does everything it claims to do (within reasons) and does not affect visual studio builds, so this can indeed be a pull. But one reason of not creating a pull, besides the objection of signing a CLA, is issue with CLA by-pass and random crap being added by somebody else: not thinking about CLA and pulls, means I can include things like Georg's xcode stuff on merits alone (Georg may object to signing CLAs...), I can do changes like converting comments from windows encoding to utf8 - not necessary, just a conveniences to utf-8 people at the expense of inconvenience to windows encoding people; and I can object to including random people's requests to add random crap, like a cmake-based build system - I honestly do no want it, and if upstream adds such thing, I will refuse to do a pull to donate my work to be sitting next to some random crap :). |
For those who want to fix warnings, do "make ... CXXFLAGS=-Wall" . I don't want to put it into the Makefile yet, as the build already have warnings without it (and those are more important and should be looked at first) |
I am splitting out "no need to debate" changes as individual pulls... But for example, I don't want to take bulk formatting /cosmetic or indentation changes at this stage, and the conversions from windows encoding to utf8 in the comments I did, I would find that objectionable if somebody else do that amount of changes in comments and try to push in my direction :). (it makes the comoments more readable to utf8 unix people, but less readable to windows visual studio people...) |
I get an error when I try to build your fork on macOS: $ make
c++ -c -o Area.o Area.cpp
c++ -c -o CvtManager.o CvtManager.cpp
In file included from CvtManager.cpp:8:
./pch.h:22:10: fatal error: 'span' file not found
#include <span>
^~~~~~
1 error generated.
make: *** [CvtManager.o] Error 1 I don't know a whole lot about C++, so I'm not sure what might cause this. |
@jenskutilek how old is your default command-line c++ compiler ( You might need to add c++ development if xcode have optional components? If it helps, there is an xcode project too. I believe recent xcode put up-to-date compilers (and multiple of them) under private places and leave the system-wide command line at old versions or not accessible. |
For gcc it is part of gcc's c++11 support, so you need a compiler that is less than 10 years old :). Edit: on linux, I have two variants of that file, one at /usr/include/c++/v1/ and that belongs to clang, and another at /usr/include/c++/11/ and that belongs to gcc. The respective c++ compiler of each family uses its own versions. |
Hm, thanks, my computer is out of support, the Apple developer tools for XCode 10.0.0 are the newest version that can be installed. I get this:
Guess I have to wait until I can upgrade my computer :-/ |
That is not particularly old - current clang is 12 or 13, and comparing that with Debian Linux, which is still shipping clang 6... Have a look around under /Library/Developer/ to see if you can find a file called span inside "c++/v1" somewhere?
Do you have a directory /usr/include/c++ ?
Hmm, actually I have xcode 9.x (for mac os x 10.13) zipped up from a mac, and the location is something like:
... Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/,
but indeed span is not there, while codecvt is. So if your xcode is similarly old - xcode 9.x for 10.13 (which yours seems to be, darwin17), you might be out of luck.
I don't know what version of old xcode that would compile this code, sorry, but 9.x for os x 10.13 seems too old according to the xcode 9.x bundle I have.
|
Okay, found it - according to https://stackoverflow.com/questions/45723819/what-is-a-span-and-when-should-i-use-one and of course https://docs.microsoft.com/en-us/cpp/standard-library/span-class?view=msvc-160 , the <span> header is part of C++ 20 .
That's the 2020 c++ standard (the one before was 2017)... So you need a c++ compiler that is QUITE up to date! 4 years old would be too old.
|
Oh, it is microsoft visual studio being annoying - <span> is not used. ("pch.h" stands for "precompiled header" and just generic stuff populated by visual studio). Building with gcc or clang doesn't complain when that line is removed. I'll get rid of it now.
|
When I reduced VTT for vttcompile, I was planning on using but then ended up using a different method given it's newness. I forgot to remove from pch.h. |
One question/concern I have with a port is VTT and vttcompile dependence on pragmas particularly on #pragma pack (1) to set structure packing and also #pragma once in some headers to avoid multiple includes. I have read somewhere that CLang supports #pragma pack(1) but GCC does not. I don't know if that's still correct. I think #pragma once is supported on both. |
The first "pragma pack gcc" result from google gives this very old page (current gcc is 11 and a long time since gcc 4):
https://gcc.gnu.org/onlinedocs/gcc-4.4.4/gcc/Structure_002dPacking-Pragmas.html
It did not say if pack(1) is supported, just "small power of 2" (1 is 2 power 0...), but it says this feature is for compatibity with microsoft compiler so I'd expect it works like MS C++.
Pragma once is definitely supported.
I actually use that pragma once feature to get the macro expansion of swprintf to itself only once, to cope with the different prototype of this function between windows and unix (instead of 500 changes like Georg's initial work on mac!).
|
I invite you to submit a PR to we can get the port changes upstream. |
okay, at the current states, gcc -Wall gives
and clang's -Wall gives:
At least one of the dangling else warning (in getopt.h) seems tricky, and -Wmisleading-indentation probably too , and there is no obvious workaround to gcc's 61 -Wmultichar warnings (clang does not complain...). In general I am against removing unused anything at this stage (and I have opted to not-merge the removed-dead-code change), so I think this is as far as it would go. I'll stick a re-ordered version of it on a pull. |
The support-for-opencompilers branch in the pull #15 has one less gcc -Wsign-compare warning, but no better with clang. |
@jenskutilek in case you weren't reading the earlier details, we removed that unnecessary line and the code should build with older compilers than c++ 2020(!) - I just tried to get gcc to enforce c++14 and it still works, so the code should work with compilers about 7 years old now. The code fails to build for c++11, so it must be built with a compiler less than 10 years old :). |
Hm, I updated my Apple dev tools to the latest version (I am on a machine with the latest macOS today), and I still got errors when compiling. Turns out Apple’s $ CPPFLAGS=--std=gnu++2a make |
-std=c++14 works here (since removing the <span> line). What errors are you getting?
It is CXXFLAGS . CPPFLAGS stands for c-pre-processor - although c++ code passes through the C preprocessor too, CXXFLAGS is the correct one to use. Both the prefix form "CXXFLAGS=... make" and the
post-form "make CXXFLAGS=..." should work. There are subtle differences between these two ways.
|
Both The errors when I run make without any options are a number of those:
and
and
|
Oh, apple's shipped clang seems different from linux clang (I have 12.0.1). Without anything the default it works, as well as passing CXXFLAGS="-std=c++14" (and 17). It fails with c++11. I'll update the build section of readme in the pull. |
Opened a new pull for fixing the remaining warnings #17 . also found and fix a bug while testing (fix included in the pull). I think the pull is as far as I am happy with fixing warnings from gcc and clang, so when that pull merges, I'll close this. The pull still generates these from clang (excluding unused-anything warnings):
and these from gcc (again excluding unused-anything warnings):
In general, I don't look at unused-anything warnings. The common deprecated-declaration warning looks non-trivial to fix, and would make unix ports differ more from the windows code also, so I don't want to touch that. Likewise, -Wlogical-not-parentheses and -Wfree-nonheap-object do not look to have an obvious direction to change. The -Wshift-negative-value and -Wsign-compare can be "fixed" by casts and inserting some signed/unsigned, but switching signed/unsigned is tricky, and adding casts do not add-value, so I'd rather not touch those. The -Wtautological-constant-out-of-range-compare and -Wmultichar can be "fixed" by some re-write or casts, but mostly to please a specific compiler and again, does not add value. So this covers everything that could/should be changed according to -Wall from either gcc or clang. When the pull get merged, I'll close this, but keep the branch for experiments - it will continue to have those unused routines removed upstream, for example. |
We have #15 (buildable with open-source compilers), #17 (the more obvious problem with usage of "long" type), #22 (implicit cast to long and others). Now vttcompile more or less works on non-windows, and going onto the next stage of trying to fix specific issues with specific fonts when compared with vttshell - #23 . I think this can be closed, though my branch will carry on with interesting things - and we have already had one divergence of opinion: my branch retains unused and removed code. There are probably more to come, but hopefully not too many divergences. |
It probably would work with mac too. native compile just do "cd src; make". For cross-compiling for windows, make CXX=i686-w64-mingw32-c++ (32-bit) or make CXX=x86_64-w64-mingw32-c++ (64-bit).
https://github.com/HinTak/VisualTrueType
The text was updated successfully, but these errors were encountered: