Skip to content
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

Compile patch for solaris #3456

Closed
panosdim opened this issue Oct 14, 2016 · 31 comments
Closed

Compile patch for solaris #3456

panosdim opened this issue Oct 14, 2016 · 31 comments

Comments

@panosdim
Copy link

I am trying to compile fish-2.3.1 in solaris

xigpadi  edeacts0703  ~  $ uname -a
SunOS edeacts0703 5.10 Generic_147147-26 sun4u sparc SUNW,SPARC-Enterprise

and the following patch is need in order to successful compile. Can this patch included in the source code for next release?

@zanchey
Copy link
Member

zanchey commented Oct 14, 2016

At least some of this has already been included - would you be able to try against the current Git master? There is some work being done on Solaris-derived platforms in #3340.

@panosdim
Copy link
Author

I am trying to compile from git master but i get an error in configure

 xigpadi  edeacts0703  ~/f/p/fish-shell-master  $ autoconf
 xigpadi  edeacts0703  ~/f/p/fish-shell-master  $ ./configure
configure: error: cannot find sources (fish) in . or ..

Can anyone help?

@zanchey
Copy link
Member

zanchey commented Oct 14, 2016

That's usually a permissions problem, from what I can see from Google. autoconf; ./configure works ok for me here on Solaris 11.

@panosdim
Copy link
Author

In order for configure to work i had to create a folder fish and put the src folder inside it.
However not the make command hit new errors:

src/builtin.cpp: In function 'void builtin_print_help(parser_t&, io_streams_t&, const wchar_t*, output_stream_t&)':
src/builtin.cpp:166:36: error: 'wcsdup' was not declared in this scope
     wchar_t *str = wcsdup(h.c_str());
                                    ^
src/builtin.cpp: In function 'int builtin_block(parser_t&, io_streams_t&, wchar_t**)':
src/builtin.cpp:660:32: warning: missing initializer for member 'event_blockage_t::typemask' [-Wmissing-field-initializers]
         event_blockage_t eb = {};
                                ^
src/builtin.cpp: In function 'int builtin_function(parser_t&, io_streams_t&, const wcstring_list_t&, const wcstring&, int, wcstring*)':
src/builtin.cpp:1573:69: error: 'wcscasecmp' was not declared in this scope
                 if ((opt == 'j') && (wcscasecmp(w.woptarg, L"caller") == 0)) {
                                                                     ^
src/builtin.cpp: In function 'int builtin_read(parser_t&, io_streams_t&, wchar_t**)':
src/builtin.cpp:2033:32: warning: missing initializer for member '__mbstate_t::__filler' [-Wmissing-field-initializers]
             mbstate_t state = {};
                                ^
make: *** [Makefile:798: obj/builtin.o] Error 1

@krader1961
Copy link
Contributor

In order for configure to work i had to create a folder fish and put the src folder inside it.

@panosdim, That tells me you didn't install the source package correctly. Doing a simple git clone should have produced the correct directory structure. I don't think there is any point in debugging your other build problems until you've correctly installed the source package. What commands did you run to install the fish source?

@floam
Copy link
Member

floam commented Oct 17, 2016

It looks like he's working with a git checkout.

@zanchey
Copy link
Member

zanchey commented Oct 18, 2016

I can reproduce the wcsdup/wcscasecmp problem - on Solaris, these are in the std:: namespace but on all other platforms they are not namespaced.

Probably a #define wcsdup std::wcsdup in the right place is the thing to do here.

@floam
Copy link
Member

floam commented Oct 18, 2016

What if you #include <cstdlib>? -- I'd rather just have it namespaced everywhere.

@zanchey
Copy link
Member

zanchey commented Oct 18, 2016

What if you #include <cstdlib>

Nope. Annoyingly std::wcsdup will not compile under glibc or FreeBSD.

@zanchey zanchey removed the question label Oct 18, 2016
@floam floam added the bug Something that's not working as intended label Oct 18, 2016
@panosdim
Copy link
Author

In order for configure to work i had to create a folder fish and put the src folder inside it.
@panosdim, That tells me you didn't install the source package correctly. Doing a simple git clone should have produced the correct directory structure. I don't think there is any point in debugging your other build problems until you've correctly installed the source package. What commands did you run to install the fish source?

Even with a fresh git clone i had the same problem with configure

 xigpadi  edeacts0702  ~/f/priv  $ git clone https://github.com/fish-shell/fish-shell.git
Cloning into 'fish-shell'...
remote: Counting objects: 35786, done.
remote: Compressing objects: 100% (81/81), done.
remote: Total 35786 (delta 37), reused 0 (delta 0), pack-reused 35705
Receiving objects: 100% (35786/35786), 32.16 MiB | 448.00 KiB/s, done.
Resolving deltas: 100% (22982/22982), done.
Checking out files: 100% (1205/1205), done.
 xigpadi  edeacts0702  ~/f/priv  $ ls
fish-shell/
 xigpadi  edeacts0702  ~/f/priv  $ cd fish-shell/
 xigpadi  edeacts0702  ~/f/p/fish-shell  $ ls
CHANGELOG.md     Dockerfile     Doxyfile.user  build_tools/   configure.ac  etc/          fish.xcodeproj/    osx/          share/
CONTRIBUTING.md  Doxyfile       Makefile.in    config.guess*  debian/       fish.pc.in    install-sh*        pcre2-10.21/  src/
COPYING          Doxyfile.help  README.md      config.sub*    doc_src/      fish.spec.in  lexicon_filter.in  po/           tests/
 xigpadi  edeacts0702  ~/f/p/fish-shell  $ autoconf
cut: cannot open FISH-BUILD-VERSION-FILE
 xigpadi  edeacts0702  ~/f/p/fish-shell  $ ls
CHANGELOG.md     Doxyfile       README.md        config.sub*   doc_src/      fish.xcodeproj/    pcre2-10.21/  tests/
CONTRIBUTING.md  Doxyfile.help  autom4te.cache/  configure*    etc/          install-sh*        po/
COPYING          Doxyfile.user  build_tools/     configure.ac  fish.pc.in    lexicon_filter.in  share/
Dockerfile       Makefile.in    config.guess*    debian/       fish.spec.in  osx/               src/
 xigpadi  edeacts0702  ~/f/p/fish-shell  $ ./configure
configure: error: cannot find sources (fish) in . or ..
 xigpadi  edeacts0702  ~/f/p/fish-shell  1  $

@krader1961
Copy link
Contributor

The configure script should set the source dir to "." (that is, the cwd). There is either something wrong with the configure script created by autoconf or there is something weird with the permission bits of your fish-shell directory (or perhaps the ACLs, etc.). I'll be very surprised if this has anything to do with fish.

Open the configure script in your editor. Find this block of code:

# When building in place, set srcdir=.
if test "$ac_abs_confdir" = "$ac_pwd"; then
   srcdir=.
fi

Insert exit 1 after the fi. Then type /bin/sh -x ./configure and show us the last screenful of output; at least the portion after lines like this:

++ pwd
+ ac_pwd=/Users/krader/projects/3rd-party/fish-shell

Your ac_pwd value will obviously be different.

@panosdim
Copy link
Author

Here is the output

+ continue
+ build=
+ host=
+ target=
+ test x '!=' x
+ ac_tool_prefix=
+ test -n ''
+ test '' = yes
++ pwd
+ ac_pwd=/home/xigpadi/ftp/priv/fish-shell
+ test -n /home/xigpadi/ftp/priv/fish-shell
++ ls -di .
+ ac_ls_di='9617298 .'
++ cd /home/xigpadi/ftp/priv/fish-shell
++ ls -di .
+ ac_pwd_ls_di='9617298 .'
+ test 'X9617298 .' = 'X9617298 .'
+ test -z ''
+ ac_srcdir_defaulted=yes
++ dirname -- ./configure
+ ac_confdir=.
+ srcdir=.
+ test '!' -r ./fish
+ srcdir=..
+ test '!' -r ../fish
+ test yes = yes
+ srcdir='. or ..'
+ as_fn_error 0 'cannot find sources (fish) in . or ..'
+ as_status=0
+ test 0 -eq 0
+ as_status=1
+ test ''
+ printf '%s\n' 'configure: error: cannot find sources (fish) in . or ..'
configure: error: cannot find sources (fish) in . or ..
+ as_fn_exit 1
+ set +e
+ as_fn_set_status 1
+ return 1
+ exit 1
 xigpadi  edeacts0702  ~/f/p/fish-shell  1  $

@krader1961
Copy link
Contributor

At this point everything looks fine:

+ srcdir=.

Here is where things go wrong:

+ test '!' -r ./fish

That's from this line in the configure script:

if test ! -r "$srcdir/$ac_unique_file"; then

On my systems (macOS, various Linux, Cygwin, BSD) the $ac_unique_file variable is not defined so it tests that the cwd is readable. On your system it has been initialized to "fish". Since that file doesn't exist configure reports that it is unsure where the source can be found.

Some googling suggests this was the behavior of old versions of autoconf; e.g., 2.13. On my systems it is much newer; e.g., 2.69. What does autoconf -V report on your system? You can workaround that specific failure by first doing touch fish. Of course, given that your build tools seem to be quite old there may be other problems.

@panosdim
Copy link
Author

I have a new autoconf

 xigpadi  edeacts0702  ~/f/p/fish-shell  1  $ autoconf -V
autoconf (GNU Autoconf) 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+/Autoconf: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>, <http://gnu.org/licenses/exceptions.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by David J. MacKenzie and Akim Demaille.
 xigpadi  edeacts0702  ~/f/p/fish-shell  $

Maybe it is some strange behaviour of autoconf in solaris. Nevermind with touch fish it is working ok.

@krader1961 krader1961 added enhancement packaging and removed bug Something that's not working as intended labels Oct 25, 2016
@krader1961
Copy link
Contributor

We'd love to modify fish so that hacks like touch fish aren't needed to build on Solaris. But I don't believe any of the core devs have access to that environment. So we're going to be dependent on someone like you, @panosdim, to provide a solution.

@krader1961 krader1961 added this to the fish-future milestone Oct 25, 2016
@panosdim
Copy link
Author

No problem i can test any modification in Solaris environment, just tell me when and what you need to test.

@zanchey
Copy link
Member

zanchey commented Oct 25, 2016

I have Solaris 11, with autoconf 2.68, and I don't get the same problem with requiring touch fish. I do, however, run into the wcsdup/wcscasecmp problems described above.

@zanchey
Copy link
Member

zanchey commented Dec 3, 2016

Could you try the patch in #3608? That gives me a clean, working build on Solaris 11.

@panosdim
Copy link
Author

panosdim commented Dec 5, 2016

Still not working on SunOS edeacts0703 5.10 Generic_147147-26 sun4u sparc SUNW,SPARC-Enterprise Solaris

src/builtin.cpp:187:36: error: 'wcsdup' was not declared in this scope
     wchar_t *str = wcsdup(h.c_str());
                                    ^
make: *** [Makefile:810: obj/builtin_set.o] Error 1
src/builtin.cpp: In function 'int builtin_block(parser_t&, io_streams_t&, wchar_t**)':
src/builtin.cpp:676:32: warning: missing initializer for member 'event_blockage_t::typemask' [-Wmissing-field-initializers]
         event_blockage_t eb = {};
                                ^
make: *** [Makefile:810: obj/env_universal_common.o] Error 1
src/complete.cpp: In member function 'bool completer_t::complete_param(const wcstring&, const wcstring&, const wcstring&, bool)':
src/complete.cpp:995:80: error: 'wcsncasecmp' was not declared in this scope
                 match_no_case = wcsncasecmp(str, whole_opt.c_str(), wcslen(str)) == 0;
                                                                                ^
src/builtin.cpp: In function 'int builtin_function(parser_t&, io_streams_t&, const wcstring_list_t&, const wcstring&, int, wcstring*)':
src/builtin.cpp:1626:69: error: 'wcscasecmp' was not declared in this scope
                 if ((opt == 'j') && (wcscasecmp(w.woptarg, L"caller") == 0)) {
                                                                     ^
src/complete.cpp: In member function 'bool completer_t::try_complete_user(const wcstring&)':
src/complete.cpp:1239:60: error: 'wcsncasecmp' was not declared in this scope
         } else if (wcsncasecmp(user_name, pw_name, name_len) == 0) {
                                                            ^
src/builtin.cpp: In function 'int builtin_read(parser_t&, io_streams_t&, wchar_t**)':
src/builtin.cpp:2018:32: warning: missing initializer for member '__mbstate_t::__filler' [-Wmissing-field-initializers]
             mbstate_t state = {};
                                ^
make: *** [Makefile:810: obj/highlight.o] Error 1
make: *** [Makefile:810: obj/builtin.o] Error 1

@zanchey
Copy link
Member

zanchey commented Dec 5, 2016

Right, it looks like those functions aren't available on Solaris 10. Can you try building from Git master? I am not sure that the GCC available on Solaris 10 is new enough to support C++11, so we might be SOL on that platform anyway.

@panosdim
Copy link
Author

panosdim commented Dec 5, 2016

I build from master but same error. I have installed a newer version of GCC on Solaris 10.
gcc --version
gcc (GCC) 4.9.3
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

@krader1961
Copy link
Contributor

@panosdim: gcc 4.9.3 does support C++11 so that shouldn't be an issue for supporting Solaris 10. You only have three actual errors. It can't find wcsdup(), wcscasecmp() and wcsncasecmp(). Zanchey added using statements to the bottom of src/common.h to deal with the fact they're in the std:: namespace. But those are predicated on autoconf tests that might be returning the wrong result on your platform. What happens if you just make those using statements unconditional? Or change the places where they're used, such as src/builtin.cpp line 187, to say std::wcsdup()?

@zanchey
Copy link
Member

zanchey commented Dec 6, 2016

Alternatively, a copy of your config.log might be helpful.

@panosdim
Copy link
Author

panosdim commented Dec 6, 2016

These functions are missing from solaris 10 (even the std::xxx functions) as you can see from the config.log. Can you declare it in source code?
config.log.txt

@krader1961
Copy link
Contributor

Can you declare it in source code?

Yes. In fact we already have fallback implementations. Look for wcsdup_fallback in src/fallback.cpp. You just need to figure out how to modify our automake scripts and source to recognize that those fallbacks are needed on Solaris 10.

@panosdim
Copy link
Author

panosdim commented Dec 7, 2016

I finally managed to compile in Solaris 10 using the attached patch.
Can someone apply the patch to master branch if it is not causing any problem to other platforms?
fish-shell-master-patch.txt

@krader1961
Copy link
Contributor

Looks good to me. Tested on macOS, Ubuntu, and Cygwin on Windows 10.

If you run make style it will correct a couple whitespace nits. Do you want to create a pull-request @panosdim or do you want one of us to just merge your patch?

@zanchey
Copy link
Member

zanchey commented Dec 8, 2016

I think this needs checking for 10.6 as well.

@panosdim
Copy link
Author

panosdim commented Dec 8, 2016

@krader1961 It will be better if you can just merge the patch.

@krader1961
Copy link
Contributor

I think this needs checking for 10.6 as well.

The switch to require C++11 means we can no longer build fish on OS X 10.6 irrespective of this change. I confirmed this sad fact by starting up my VirtualBox OS X 10.6 instance, syncing the source, and running ./configure. It fails with several errors of the form

checking whether g++ supports C++11 features... no

I can't readily confirm but believe we are now limited to supporting OS X 10.8 or newer.

It will be better if you can just merge the patch.

Okay, I will do so in a few minutes.

@ridiculousfish
Copy link
Member

#3138 has the SnowLeopard plans. The upshot is the official packages can probably be made to work via a MacPorts install of libc++; if not, a MacPorts package can certainly be made to work. So SnowLeopard users won't be left out in the, err, cold.

@krader1961 krader1961 modified the milestones: fish 2.5.0, fish-future Jan 2, 2017
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants