How to build Python 3.4.2 from source in cygwin? - python-3.x

According to the README in the Python 3.4.2 source package compilation on Cygwin should be as easy as this:
./configure
make
make test
sudo make install
However, the make command fails after a while giving me this output (i have gcc 3.4.4):
$ make
gcc -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Werror=declaration-after-statement -I. -IInclude -I./Include -DPy_BUILD_CORE -c ./Modules/signalmodule.c -o Modules/signalmodule.o
...
./Modules/signalmodule.c: In function ‘fill_siginfo’:
./Modules/signalmodule.c:744:5: error: ‘siginfo_t’ has no member named ‘si_band’
Makefile:1645: recipe for target `Modules/signalmodule.o' failed
make: *** [Modules/signalmodule.o] Error 1
I guess there are some dependencies that I need to compile?

Python does not compile out of the box without additional patches.
I was able to compile Python 3.4.2 on cygwin with the following 2 patches:
http://bugs.python.org/file34693/cygwin_si_band.patch
http://bugs.python.org/file28934/0001-CYGWIN-issue13756-Python-make-fail-on-cygwin.patch

Related

Pyenv BUILD FAILED while Integrate Spark (Scala) and Jupyter Notebook

Does anyone know how to solve this problem?
pyenv build fails. Trying to integrate spark scala with jupyter notbook as described hereenter link description here
➜ ~ pyenv install 3.8.2
python-build: use openssl#1.1 from homebrew
python-build: use readline from homebrew
Downloading Python-3.8.2.tar.xz...
-> https://www.python.org/ftp/python/3.8.2/Python-3.8.2.tar.xz
Installing Python-3.8.2...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
^D
BUILD FAILED (OS X 11.2.1 using python-build 20180424)
Inspect or clean up the working tree at /var/folders/_v/qvsxvlw51rxb43z929hyv45w0000gn/T/python-build.20210222233923.72853
Results logged to /var/folders/_v/qvsxvlw51rxb43z929hyv45w0000gn/T/python-build.20210222233923.72853.log
Last 10 log lines:
extern int _NSGetExecutablePath(char* buf, uint32_t* bufsize) __OSX_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_2_0);
^
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -I./Include/internal -I. -I./Include -I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/Users/quais/.pyenv/versions/3.8.2/include -I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/Users/quais/.pyenv/versions/3.8.2/include -DPy_BUILD_CORE_BUILTIN -DPy_BUILD_CORE_BUILTIN -I./Include/internal -c ./Modules/posixmodule.c -o Modules/posixmodule.o
./Modules/posixmodule.c:9197:15: error: implicit declaration of function 'sendfile' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
ret = sendfile(in, out, offset, &sbytes, &sf, flags);
^
1 error generated.
make: *** [Modules/posixmodule.o] Error 1
make: *** Waiting for unfinished jobs....
1 warning generated.
➜ ~
Saving session...completed.
Deleting expired sessions...none found.
[Process completed]
I could solve this by getting an older version the environment. Apparently the latest version is not supported even if i have the 12+ version of Xcode
pyenv install 3.7.9

YouCompleteMe (ycm), Failed to build regex module

I am trying to install the ycmd plugin for vim (after having ran git submodule update --init --recursive) and I am running into: Failed to build regex module.
After running ./install.py in the "YouCompleteMe" folder, here are the upstream lines that lead to the stated error:
[100%] Linking CXX shared library /home/users/jeremy/.vim/bundle/YouCompleteMe/third_party/ycmd/ycm_core.so
[100%] Built target ycm_core
running build
running build_py
creating /home/users/jeremy/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/regex-build
creating /home/users/jeremy/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/regex-build/regex
copying regex_3/__init__.py -> /home/users/jeremy/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/regex-build/regex
copying regex_3/regex.py -> /home/users/jeremy/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/regex-build/regex
copying regex_3/_regex_core.py -> /home/users/jeremy/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/regex-build/regex
copying regex_3/test_regex.py -> /home/users/jeremy/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/regex-build/regex
running build_ext
building 'regex._regex' extension
creating /home/users/jeremy/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/regex-build/3
creating /home/users/jeremy/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/regex-build/3/temp.linux-x86_64-3.7
creating /home/users/jeremy/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/regex-build/3/temp.linux-x86_64-3.7/regex_3
gcc -pthread -B /home/users/jeremy/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/users/jeremy/anaconda3/include/python3.7m -c regex_3/_regex.c -o /home/users/jeremy/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/regex-build/3/temp.linux-x86_64-3.7/regex_3/_regex.o
gcc -pthread -B /home/users/jeremy/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/users/jeremy/anaconda3/include/python3.7m -c regex_3/_regex_unicode.c -o /home/users/jeremy/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/regex-build/3/temp.linux-x86_64-3.7/regex_3/_regex_unicode.o
gcc -pthread -shared -B /home/users/jeremy/anaconda3/compiler_compat -L/home/users/jeremy/anaconda3/lib -Wl,-rpath=/home/users/jeremy/anaconda3/lib -Wl,--no-as-needed -Wl,--sysroot=/ /home/users/jeremy/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/regex-build/3/temp.linux-x86_64-3.7/regex_3/_regex.o /home/users/jeremy/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/regex-build/3/temp.linux-x86_64-3.7/regex_3/_regex_unicode.o -o /home/users/jeremy/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/regex-build/regex/_regex.cpython-37m-x86_64-linux-gnu.so
/home/users/jeremy/anaconda3/compiler_compat/ld: /home/users/jeremy/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/regex-build/3/temp.linux-x86_64-3.7/regex_3/_regex.o: unable to initialize decompress status for section .debug_info
/home/users/jeremy/anaconda3/compiler_compat/ld: /home/users/jeremy/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/regex-build/3/temp.linux-x86_64-3.7/regex_3/_regex.o: unable to initialize decompress status for section .debug_info
/home/users/jeremy/anaconda3/compiler_compat/ld: /home/users/jeremy/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/regex-build/3/temp.linux-x86_64-3.7/regex_3/_regex.o: unable to initialize decompress status for section .debug_info
/home/users/jeremy/anaconda3/compiler_compat/ld: /home/users/jeremy/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/regex-build/3/temp.linux-x86_64-3.7/regex_3/_regex.o: unable to initialize decompress status for section .debug_info
/home/users/jeremy/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/regex-build/3/temp.linux-x86_64-3.7/regex_3/_regex.o: file not recognized: file format not recognized
collect2: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
Failed to build regex module.
It seems like the /anaconda3/compiler_compat/ld executable is not compatible with the YouCompleteMe/third_party/ycmd/third_party/regex-build/3/temp.linux-x86_64-3.7/regex_3/_regex.o file.
Does someone have an idea of what's going on or what I could try out ?
you can use coc.nvim to do code complement, it works so good and is easy to use.
i tried to build YCM so many times several years before, and in the end, i gave up.
I've found the problem from someone hitting the same kind of issue while trying to compile PyTorch :
"The whole problem lies in the fact that Anaconda distribution comes with its own ld linker that is located in /opt/anaconda/compiler_compat/ and it overshadows system ld residing at /usr/bin.
To fix my error I ran python setup.py clean and then I temporarily renamed Anaconda's ld linker to ld-old to make it invisible during PyTorch installation. Removing -B option from the installation stage could fix it too."
So renaming my anaconda ld linker for the ycm compilation fixed my issue. (I renamed it back afterwards)

gcc cannot find standard libraries on mac (when installing python packages from requirements)

I am having an issue due to my gcc missing standard libraries.
copying blpapi/schema.py -> build/lib.macosx-10.7-x86_64-3.7/blpapi
running build_ext
building 'blpapi._internals' extension
creating build/temp.macosx-10.7-x86_64-3.7
creating build/temp.macosx-10.7-x86_64-3.7/blpapi
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/anaconda3/envs/invtools/include -arch x86_64 -I/anaconda3/envs/invtools/include -arch x86_64 -I/usr/local/lib/blpapi_cpp_3.8.1.1/include -I/anaconda3/envs/invtools/include/python3.7m -c blpapi/internals_wrap.cxx -o build/temp.macosx-10.7-x86_64-3.7/blpapi/internals_wrap.o
warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
blpapi/internals_wrap.cxx:3101:10: fatal error: 'stdexcept' file not found
#include <stdexcept>
^~~~~~~~~~~
1 warning and 1 error generated.
error: command 'gcc' failed with exit status 1
I had a different issue initially. It was something about cannot find type uint8_t. And someone suggested to delete files in: /usr/local/include/. And that causes the above now. It is because there are no standard libraries now. I installed this /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg and now I have standard lib in /usr/include. Which I copied to /usr/local/indclude/ to no avail. brew link gcc tells me:
Warning: Already linked: /usr/local/Cellar/gcc/8.2.0
To relink: brew unlink gcc && brew link gcc
How do I resolve this issue?

Unable to compile C program on Mac, but able to compile on Linux

I facing some trouble compiling my programming assignment on my local machine. The program is distribute to us with makefiles and compilation commands that are known to work on the school's Scientific Linux servers. My local machine is Mac OS X El Capitan.
When I compile my program running make on my Mac, I get the following error that prevents compilation from proceeding:
myid-MacBook-Pro:mp6 myid$ make
gcc -g -lm -std=c99 -Wall -Werror -c lodepng.c
clang: error: -lm: 'linker' input unused
make: *** [lodepng.o] Error 1
But when I push that very same code as work in progress to the Linux servers and compile there, everything works fine. The linux servers use gcc and not clang:
[netid#linux-a2 mp6]$ make
gcc -g -lm -std=c99 -Wall -Werror -c functions.c
gcc -g -lm -std=c99 -Wall -Werror main.o lodepng.o imageData.o functions.o -o mp6 -lm
gcc -g -lm -std=c99 -Wall -Werror -c test.c
gcc -g -lm -std=c99 -Wall -Werror test.o lodepng.o imageData.o functions.o solution.o -o test -lm
In the makefile, these are the variable definitions:
CC=gcc
CFLAGS=-g -lm -std=c99 -Wall -Werror
and the target definition for loadpng.o
lodepng.o: lodepng.c
$(CC) $(CFLAGS) -c lodepng.c
I would appreciate any help on understanding this error and overcoming it.
Thank you very much.
Also, on this note, I thought I would say that I've noticed a subtle difference between Clang and GCC. It seems to me that even warnings generated by Clang would prevent the compilation to proceed so the warnings behaves like errors. But for GCC, if it generates warnings, it still compiles the object file. Please correct me if I'm mistaken.
Right now you're getting a compilation error on your Mac because you're trying to pass linker commands (i.e. -lm) into a compilation(i.e. -c). Do not give link flags when you compile (-c flag) your source files.
In the other compilation snippet you provided, the unused linker command seems to pass by unnoticed which isn't a good thing.
For your last question, the flag -Werror should force all compilation warnings to become errors -- which is exactly what you are describing.

CommandT installation problems on windows

After completing all installation steps for the CommandT plugin, I get the error command-t.vim could not load the C extension when starting it. The ComamndT troubleshooting section gives this advice:
If a problem occurs the first thing you should do is inspect the output of:
ruby extconf.rb
make
During the installation, and:
vim --version
And compare the compilation and linker flags that were passed to the
extension and to Vim itself when they were built. If the Ruby-related
flags or architecture flags are different then it is likely that something
has changed in your Ruby environment and the extension may not work until
you eliminate the discrepancy.
And it does indeed seem that there is discrepancy for me.
Output from make suggests cygwin's gcc is using ruby 1.8:
gcc -I. -I/usr/lib/ruby/1.8/i386-cygwin -I/usr/lib/ruby/1.8/i386-cygwin -I. -DHA
VE_RUBY_H -g -O2 -std=c99 -Wall -Wextra -Wno-unused-parameter -c ext.c
gcc -I. -I/usr/lib/ruby/1.8/i386-cygwin -I/usr/lib/ruby/1.8/i386-cygwin -I. -DHA
VE_RUBY_H -g -O2 -std=c99 -Wall -Wextra -Wno-unused-parameter -c match.c
gcc -I. -I/usr/lib/ruby/1.8/i386-cygwin -I/usr/lib/ruby/1.8/i386-cygwin -I. -DHA
VE_RUBY_H -g -O2 -std=c99 -Wall -Wextra -Wno-unused-parameter -c matcher.c
gcc -shared -s -o ext.so ext.o match.o matcher.o -L. -L/usr/lib -L. -Wl,--enabl
e-auto-image-base,--enable-auto-import,--export-all -lruby -ldl -lcrypt
Output from vim's :version contains this output:
-DDYNAMIC_RUBY_VER=191 -DDYNAMIC_RUBY_DLL=\"msvcrt-ruby191.dll\"
The troubleshooting guide suggests using a combination of Vim 7.2, Ruby 1.8.7-p299, and DevKit 3.4.5r3-20091110. However this is not a good solution for me for a number of reasons:
I'm using Vim 7.3 and would like to continue doing so.
Ruby 1.9.3 is installed on my system, and I need it in my PATH for other projects.
So is there any way to get this working, while keeping the latest version of ruby and the latest version of vim?
UPDATE
Having followed AndrewMarshall's advice, I installed Ruby191 and DevKit-4.5.0-20100819-1536-sfx.exe according to this tutorial and ran ruby extconf.rb through that version. The make cmd executed successfully with this output:
gcc -I. -IC:/Ruby191/include/ruby-1.9.1/i386-mingw32 -I/C/Ruby191/include/ruby-1
.9.1/ruby/backward -I/C/Ruby191/include/ruby-1.9.1 -I. -DHAVE_RUBY_H -O2 -g -
Wall -Wno-parentheses -std=c99 -Wall -Wextra -Wno-unused-parameter -o ext.o -c
ext.c
gcc -I. -IC:/Ruby191/include/ruby-1.9.1/i386-mingw32 -I/C/Ruby191/include/ruby-1
.9.1/ruby/backward -I/C/Ruby191/include/ruby-1.9.1 -I. -DHAVE_RUBY_H -O2 -g -
Wall -Wno-parentheses -std=c99 -Wall -Wextra -Wno-unused-parameter -o match.o
-c match.c
gcc -I. -IC:/Ruby191/include/ruby-1.9.1/i386-mingw32 -I/C/Ruby191/include/ruby-1
.9.1/ruby/backward -I/C/Ruby191/include/ruby-1.9.1 -I. -DHAVE_RUBY_H -O2 -g -
Wall -Wno-parentheses -std=c99 -Wall -Wextra -Wno-unused-parameter -o matcher.
o -c matcher.c
gcc -shared -s -o ext.so ext.o match.o matcher.o -L. -LC:/Ruby191/lib -L. -Wl,-
-enable-auto-image-base,--enable-auto-import -lmsvcrt-ruby191 -lshell32 -lws2
_32
and running :CommandT in vim works now, but as soon as I start typing to search for a file, and then hit enter to select and open it, I get this:
not a real answer but you may wanna try ctrlp instead.
written in vimscript (no dependency, no compiling)
as fast as CommandT (subjective to me)
has probably more features than CommandT (does CommandT have most recent file?)
there is also the good old FuzzyFinder which I haven't tried. seems like it hasn't got updated for about 2 years but it may still be working.
I successfully installed newest command-t on vim 8.0 on windows 10. And I find this question when I'm working on it so I'm gonna post my solution although it's a little late.
Ruby version for vim 8.0 is Ruby 2.2. So download and install Ruby 2.2 and Ruby Devkit (remember to execute ruby dk.rb init and ruby dk.rb install for devkit ).
Then I follow the command-t instruction to execute ruby extconf.conf, but it failed -- it output You have to install development tools first. even though I did install it:
I googled this issue find RubyInstaller wiki says that I should execute this command by add -rdevkit and I did it. It succeed when I execute ruby -rdevkit extconf.rb but failed when make. So I googled again and find another way to compile it:
rake make -rdevkit
And it worked. Here is my screenshot:

Resources