-
Notifications
You must be signed in to change notification settings - Fork 74
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
Replace apr (Abandoned) #79
Conversation
I will repeat my comments...now that I am on the right repro. I messed up and the PR went to the numenta repository. I had a lot of confused people over there :( Status I implemented the os::Path and os::Directory modules using #if __has_include ( < filesystem > ). See os::Directory.hpp line 45. It will attempt to #include< filesystem > but if that is not found it includes <experimental/filesystem> and if that is not found, fall back to <boost/filesystem.hpp>. The boost solution of course will require boost system and filesystem libraries which we do not have in the build. I am developing with Ubuntu using cpp-8. I know that the latest cpp-8 does have < filesystem > but it still requires library -lstdc++fs. I got it to link by putting the -lstdc++fs after the objects in the link. cpp-7 has <experimental/filesystem> but links with the experimental library. From what I have read, the latest versions of most compilers will now support < filesystem > but some of them still require the -lstdc++fs library. MinGW does not seem to support filesystem at all so boost is the only alternative. Not sure what support CLang has although Apple's version of it does not support filesystem yet. Visual Studio 17 (latest) does have < filesystem > and it builds and runs just fine but of course this version of my code already has SWIG removed because I don't think it will build SWIG. I did verify that if I forced it to use boost::filesystem rather that std::filesystem it will also build and run successfully under windows. The point is that I am having second thoughts about requiring C++17. Every Compiler/platform combination seems to have a different setup for supporting filesystem. Maybe we should go with boost::filesystem and C++11 until the compilers all comply fully with the C++17 standard. |
…or system and filesystem libs
Thanks David,
Yes, the CIs are running antique versions of compilers (compared to c++17), see
I'd propose to use just <boost/fs> for now. When we do boost removal in other PR, we'll solve the c++17 stuff.
It's a bit pity we can use just the includes of boost. The c++17 will resolve that again.
About the mess with link flags for , I don't think it should be a big obstacle, we have platform specific flangs in CMake anyways, we'd just set it up once..
As above, I'd think before this PR/repo matures, newer version of compilers will be again around. But I do see your concerns. Let's go the
Filesystem is supported in g++8 (in Ubuntu 18.04 LTS, I think), and clang 7, MSVC17 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additional comments to the PR itself
- You've somehow changed so many files (whitespace), please try to limit that and exclude it from the PR. It's fairly difficult to review now. Do you know how did that happen?
- if we need to build the Boost, let's make that a PR alone - again, huge changes. Just switching from includes-only to build boost-fs ... After that, this PR should be much more feature-focused.
CommonCompilerConfig.cmake
Outdated
|
||
##### Set parameters | ||
|
||
set(INTERNAL_CPP_STANDARD "-std=c++11") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is just more confusing than stating it directly, unless we have a good usecase.
Dockerfile
Outdated
FROM ubuntu:14.04 | ||
|
||
RUN apt-get update && \ | ||
boost install -y \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't use Docker...
Well... I already swapped out the external/common/include/boost for a
little bit of CMake to download and install boost...if needed.
That is why you see so many file changes. But in order to remove APR I had
to either use std::filesystem or boost::filesystem.
I have a little bit more CMake code that will set C++17 for known good
compilers/versions and all of the rest will install and use boost. That
code could be deferred to another PR but that will not does not reduce the
number of files deleted.
…On Sun, Sep 30, 2018 at 11:30 AM breznak ***@***.***> wrote:
***@***.**** requested changes on this pull request.
Additional comments to the PR itself
- You've somehow changed so many files (whitespace), please try to
limit that and exclude it from the PR. It's fairly difficult to review now.
Do you know how did that happen?
- if we need to build the Boost, let's make that a PR alone - again,
huge changes. Just switching from includes-only to build boost-fs ... After
that, this PR should be much more feature-focused.
------------------------------
In CommonCompilerConfig.cmake
<#79 (comment)>
:
> +
+set(EXTERNAL_C_FLAGS_UNOPTIMIZED)
+set(EXTERNAL_C_FLAGS_OPTIMIZED)
+
+set(EXTERNAL_CXX_FLAGS_UNOPTIMIZED)
+set(EXTERNAL_CXX_FLAGS_OPTIMIZED)
+
+set(EXTERNAL_LINKER_FLAGS_UNOPTIMIZED)
+set(EXTERNAL_LINKER_FLAGS_OPTIMIZED)
+
+set(EXTERNAL_STATICLIB_CMAKE_DEFINITIONS_OPTIMIZED)
+set(EXTERNAL_STATICLIB_CONFIGURE_DEFINITIONS_OPTIMIZED)
+
+##### Set parameters
+
+set(INTERNAL_CPP_STANDARD "-std=c++11")
I think this is just more confusing than stating it directly, unless we
have a good usecase.
------------------------------
In Dockerfile
<#79 (comment)>
:
> -
-# Explicitly specify --cache-dir, --build, and --no-clean so that build
-# artifacts may be extracted from the container later. Final built python
-# packages can be found in /usr/local/src/nupic.core/bindings/py/dist
-
-RUN pip install \
- --cache-dir /usr/local/src/nupic.core/pip-cache \
- --build /usr/local/src/nupic.core/pip-build \
- --no-clean \
- pycapnp==0.6.3 \
- -r bindings/py/requirements.txt && \
- python setup.py bdist bdist_dumb bdist_wheel sdist
+FROM ubuntu:14.04
+
+RUN apt-get update && \
+ boost install -y \
we don't use Docker...
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#79 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFBa_5dVcHzmJK9T3IY4gzlKOVfOK0tzks5ugQ3YgaJpZM4W7moO>
.
|
Don't know where the docker file came from. Not from me.
…On Sun, Sep 30, 2018 at 4:15 PM David E Keeney ***@***.***> wrote:
Well... I already swapped out the external/common/include/boost for a
little bit of CMake to download and install boost...if needed.
That is why you see so many file changes. But in order to remove APR I
had to either use std::filesystem or boost::filesystem.
I have a little bit more CMake code that will set C++17 for known good
compilers/versions and all of the rest will install and use boost. That
code could be deferred to another PR but that will not does not reduce the
number of files deleted.
On Sun, Sep 30, 2018 at 11:30 AM breznak ***@***.***> wrote:
> ***@***.**** requested changes on this pull request.
>
> Additional comments to the PR itself
>
> - You've somehow changed so many files (whitespace), please try to
> limit that and exclude it from the PR. It's fairly difficult to review now.
> Do you know how did that happen?
> - if we need to build the Boost, let's make that a PR alone - again,
> huge changes. Just switching from includes-only to build boost-fs ... After
> that, this PR should be much more feature-focused.
>
> ------------------------------
>
> In CommonCompilerConfig.cmake
> <#79 (comment)>
> :
>
> > +
> +set(EXTERNAL_C_FLAGS_UNOPTIMIZED)
> +set(EXTERNAL_C_FLAGS_OPTIMIZED)
> +
> +set(EXTERNAL_CXX_FLAGS_UNOPTIMIZED)
> +set(EXTERNAL_CXX_FLAGS_OPTIMIZED)
> +
> +set(EXTERNAL_LINKER_FLAGS_UNOPTIMIZED)
> +set(EXTERNAL_LINKER_FLAGS_OPTIMIZED)
> +
> +set(EXTERNAL_STATICLIB_CMAKE_DEFINITIONS_OPTIMIZED)
> +set(EXTERNAL_STATICLIB_CONFIGURE_DEFINITIONS_OPTIMIZED)
> +
> +##### Set parameters
> +
> +set(INTERNAL_CPP_STANDARD "-std=c++11")
>
> I think this is just more confusing than stating it directly, unless we
> have a good usecase.
> ------------------------------
>
> In Dockerfile
> <#79 (comment)>
> :
>
> > -
> -# Explicitly specify --cache-dir, --build, and --no-clean so that build
> -# artifacts may be extracted from the container later. Final built python
> -# packages can be found in /usr/local/src/nupic.core/bindings/py/dist
> -
> -RUN pip install \
> - --cache-dir /usr/local/src/nupic.core/pip-cache \
> - --build /usr/local/src/nupic.core/pip-build \
> - --no-clean \
> - pycapnp==0.6.3 \
> - -r bindings/py/requirements.txt && \
> - python setup.py bdist bdist_dumb bdist_wheel sdist
> +FROM ubuntu:14.04
> +
> +RUN apt-get update && \
> + boost install -y \
>
> we don't use Docker...
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <#79 (review)>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AFBa_5dVcHzmJK9T3IY4gzlKOVfOK0tzks5ugQ3YgaJpZM4W7moO>
> .
>
|
I have successfully added boost install to the package so that we can have boost::filesystem under std++11 instead of std::filesystem under std++17. This worked quite well for Linux but... for MinGW the boost install is "major pain and suffering". The hardest problem is that the Boost installation generates .o objects (ELF format) and all other objects are .obj (COFF/PE format). The resulting static library cannot be a mixture of object formats. The resulting executables do not run. I got around this problem with a hack to convert the boost ELF objects to COFF/PE objects before being added to the combined library. Now that I got past that, there is a problem building the bindings that is failing. Some file is not being found...have to research this. We are not really using MinGW but rather a fork of it, mingwpy to generate Python compatable SWIG bindings for use on Windows. As of 10/14/2017 the mingwpy project has been abandoned. I think that when we remove SWIG all of this will no longer be necessary. We should scrap MinGW support and implement Visual Studio 2017. |
Great news! 👍
sorry to hear that, the fake Windows env is a pain.
I agree, it costs is much time. I'd propose to make a MSVC build- just the c++ stuff, no swig/pytests and run that. In future we'll transition away from swig and will make full python build on Windows available again. What do you think? |
I'd propose to make a MSVC build- just the c++ stuff, no swig/pytests and
run that.
That is what I started with. I have been gradually moving code from my
MSVC build into the Linux build so that they merge. But there were many
things that the MinGW compiler would not support so it was hard to merge
all three. I have not been concentrating on the OSx version. I think that
if the Linux version works, the OSx version is likely to work as well.
So let me push what I have and ignore the MinGW build (Appveyor) for now
and see if the Linux (travis) and OSx (Circle CI) builds work.
You may not like the superbuild I used in the CMake. It was a further
attempt to isolate the building of dependencies and get MinGW to work.
Once we git rid of SWIG, MinGW and boost we will not need it.
…On Wed, Oct 10, 2018 at 4:01 AM breznak ***@***.***> wrote:
I have successfully added boost install to the package so that we can have
boost::filesystem under std++11 instead of std::filesystem under std++17
Great news! 👍
for MinGW the boost install is "major pain and suffering".
sorry to hear that, the fake Windows env is a pain.
We should scrap MinGW support and implement Visual Studio 2017.
I agree, it costs is much time. I'd propose to make a MSVC build- just the
c++ stuff, no swig/pytests and run that. In future we'll transition away
from swig and will make full python build on Windows available again. What
do you think?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#79 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFBa_6QyXM-AJLmt4dxqdBxMELL9BTGKks5ujdOZgaJpZM4W7moO>
.
|
The OSx build is working. The Linux build (travis) puzzles me because I cannot reproduce the error locally. Here it works great. It does not seem to be the compiler version either. I will keep looking. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reviewed the last changes, overall nice cleanup 👍
.travis.yml
Outdated
packages: | ||
# - g++-4.9 | ||
- g++-7 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice bump, maybe we should specify this in the Readme as well.
external/Boost.cmake
Outdated
|
||
###################################################################### | ||
# MinGW Notes: MinGW needs special handling. | ||
# 1) The default Library filename is something like libboost_filesystem-mgw49-mt-x64-1_68.a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: let's make a note we'd like to transition from MingGW to clean MSVC
src/CMakeLists.txt
Outdated
@@ -29,7 +29,7 @@ message(STATUS "CMAKE_CURRENT_SOURCE_DIR = ${CMAKE_CURRENT_SOURCE_DIR}") | |||
message(STATUS "EP_BASE = ${EP_BASE}") | |||
|
|||
set_property(GLOBAL PROPERTY USE_FOLDERS ON) | |||
set(CMAKE_VERBOSE_MAKEFILE OFF) # toggle for cmake debug | |||
set(CMAKE_VERBOSE_MAKEFILE ON) # toggle for cmake debug |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: before finishing the PR, toggle back to OFF
src/CombineUnixArchives.cmake
Outdated
# i.e., Windows with MINGW toolchain | ||
set(globbing_ext "obj") | ||
# i.e., MSYS & MINGW toolchain; could be .o or .obj | ||
set(globbing "${working_dir}/*.o*") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: would this cover all cases? (but keep the doc which format uses which OS)
src/CombineUnixArchives.cmake
Outdated
@@ -104,6 +107,23 @@ function(COMBINE_UNIX_ARCHIVES | |||
# Use relative paths to work around too-long command failure when building | |||
# on Windows in AppVeyor | |||
file(RELATIVE_PATH new_obj_file_path ${scratch_dir} ${new_obj_file_path}) | |||
|
|||
####### remove this section if we no longer support MINGW | |||
get_filename_component(ext ${new_obj_file_path} EXT) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is MINGW actually working? if not, and likely won't?, let's remove it right away
I am going to set this project aside for a while. I am getting obsessed with it and need a break. We are making a little trip to Mexico and will be gone for a week. Maybe when I get back I will look at this and it will be obvious what the problem is. |
Changes in "remove_APR" PR to date:
5 Replaced APR functions with C++11 std:: functions
17 Formatting only |
Could not help taking one last crack at it before I leave for a week. But still breaks at the same place. |
I am back from my little vacation. MinGW I am giving up on for now. MinGW needs the Boost build to use the special version of the gcc compiler tailored to work with Python 2.7 to build the Python SWIG bindings for windows. I may be able to eventually get that to work but I don't think it is worth the effort. What I am hoping is that with the PyBind11 interface this special compiler will not be a requirement. I can then create a build that will work for both MinGW and Visual Studio 2017. This PR is currently running with C++11 and Boost for filesystem. Later we can turn on the ability to use C++17 and std::filesystem for those build environments that can handle it. So, @breznak, is there any cleanup on this PR I still need to do before proceeding with a new PR? I was thinking about extracting a subset of Boost that just builds the filesystem and system modules. I think this is the only thing left that I need Boost for. This would avoid the download step. I would take the sources for just those modules and add them to the external folder rather than install all of the Boost includes and the filesystem module. Another thing I can do is add some checks to see if an acceptable version of boost is already installed someplace on a system before performing a build of the filesystem module. Or, should I just leave it as is? I am thinking that the next step would be to isolate the Python related interface code into a separate ExternalProject section in such a way that the nupic.cpp library does not contain any Python interface code. This is still using SWIG. Then once that is working, another PR could construct a parallel ExternalProject to use PyBind11 as the Python interface. Or, should I just discard the SWIG bindings and go for the PyBind11 interface all in one go? |
…boost as possible. There are still several besides filesystem.
The diffs for the 'replace_APR' branch are showing a lot of files with whitespace changes. Many of these are files that I never even opened in an editor. It could be something to do with line endings changing. At one point I was using GIT on windows and now I am using Ubuntu. That could have something to do with it but I don't really understand what happened. So, now that the Linux and OSx builds are successful, How do we get this PR completed? |
I am going to start over with this PR. So, I will start by adding Boost filesystem and system modules with one PR, Then do a PR for each file to remove the APR routines. Then as the last PR, remove the APR libraries. |
@dkeeney I managed to fix the whitespace, merged master with boost changes, and made small fixes Do you want to revive this PR, where you've put a lot of work, or keep it as review and do the separate PRs? I think it'd be possible to do a few rounds of reviews of this PR and get it merged. Current problems:
|
The CMake files will eventually have to be re-organized, (probably with the super build) when we separate the Python interface and possibly testing, in order to get the dependencies right. But lets break this up into separate PR's. What I am proposing is that I create a separate PR for each .cpp file (and its .hpp). I will be pulling lines from a copy of this PR to do this so it should not take long to do. By doing this the changes will get a proper review. |
I thouught this could be in the hierarchical cmake, like #91 suggests ?
would all get its (sub)cmake But let's leave that when necessary
Maybe not exactly file-by-file, but make it common-sense small (like your points in #81 (comment) , that's a good level for PR) |
@dkeeney ready to close this PR? There is a conflict in the merge now, likely not worth solving, but I quickly checked the diff and seems all the functionality is covered? |
yes, please close.
…On Thu, Nov 15, 2018 at 4:00 AM breznak ***@***.***> wrote:
@dkeeney <https://github.com/dkeeney> ready to close this PR? There is a
conflict in the merge now, likely not worth solving, but I quickly checked
the diff and seems all the functionality is covered?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#79 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFBa_1fjLOBvEjdnJMmPpNggcMX6KJdiks5uvVdKgaJpZM4W7moO>
.
|
All merged already in separate PRs. |
Creating a pull request