ARM9/bass

make failing

Closed this issue · 5 comments

OS: Windows 7 x86_64
Compiler: g++ - cygwin - x86

g++ --version

Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-pc-cygwin/5.3.0/lto-wrapper.exe
Target: i686-pc-cygwin
Configured with: /cygdrive/i/szsz/tmpp/gcc/gcc-5.3.0-3.i686/src/gcc-5.3.0/configure --srcdir=/cygdri
ve/i/szsz/tmpp/gcc/gcc-5.3.0-3.i686/src/gcc-5.3.0 --prefix=/usr --exec-prefix=/usr --localstatedir=/
var --sysconfdir=/etc --docdir=/usr/share/doc/gcc --htmldir=/usr/share/doc/gcc/html -C --build=i686-
pc-cygwin --host=i686-pc-cygwin --target=i686-pc-cygwin --without-libiconv-prefix --without-libintl-
prefix --libexecdir=/usr/lib --enable-shared --enable-shared-libgcc --enable-static --enable-version
-specific-runtime-libs --enable-bootstrap --enable-__cxa_atexit --with-dwarf2 --with-arch=i686 --wit
h-tune=generic --disable-sjlj-exceptions --enable-languages=ada,c,c++,fortran,java,lto,objc,obj-c++
--enable-graphite --enable-threads=posix --enable-libatomic --enable-libcilkrts --enable-libgomp --e
nable-libitm --enable-libquadmath --enable-libquadmath-support --enable-libssp --enable-libada --ena
ble-libjava --enable-libgcj-sublibs --disable-java-awt --disable-symvers --with-ecj-jar=/usr/share/j
ava/ecj.jar --with-gnu-ld --with-gnu-as --with-cloog-include=/usr/include/cloog-isl --without-libico
nv-prefix --without-libintl-prefix --with-system-zlib --enable-linker-build-id --with-default-libstd
cxx-abi=gcc4-compatible
Thread model: posix
gcc version 5.3.0 (GCC)

Error:

> make
g++ -x c++ -std=c++11 -fwrapv -O3 -fomit-frame-pointer -I.. -o obj/bass.o -c bass.cpp
In file included from ../nall/string.hpp:17:0,
                 from ../nall/base64.hpp:5,
                 from ../nall/nall.hpp:12,
                 from bass.hpp:1,
                 from bass.cpp:6:
../nall/intrinsics.hpp:56:4: warning: #warning "unable to detect platform" [-Wcpp]
   #warning "unable to detect platform"
    ^
In file included from ../nall/string.hpp:37:0,
                 from ../nall/base64.hpp:5,
                 from ../nall/nall.hpp:12,
                 from bass.hpp:1,
                 from bass.cpp:6:
../nall/string/platform.hpp: In function 'nall::string nall::realpath(const nall::string&)':
../nall/string/platform.hpp:18:6: error: '::realpath' has not been declared
   if(::realpath(name, path)) result = dir(path);
      ^
../nall/string/platform.hpp:18:6: note: suggested alternative:
../nall/string/platform.hpp:15:8: note:   'nall::realpath'
 string realpath(const string& name) {
        ^
../nall/string/platform.hpp: In function 'nall::string nall::programpath()':
../nall/string/platform.hpp:33:3: error: 'Dl_info' was not declared in this scope
   Dl_info info;
   ^
../nall/string/platform.hpp:34:32: error: 'info' was not declared in this scope
   dladdr((void*)&programpath, &info);
                                ^
../nall/string/platform.hpp:34:36: error: 'dladdr' was not declared in this scope
   dladdr((void*)&programpath, &info);
                                    ^
In file included from ../nall/bmp.hpp:4:0,
                 from ../nall/nall.hpp:15,
                 from bass.hpp:1,
                 from bass.cpp:6:
../nall/file.hpp: In member function 'bool nall::file::truncate(unsigned int)':
../nall/file.hpp:223:31: error: 'fileno' was not declared in this scope
     return ftruncate(fileno(fp), size) == 0;
                               ^
Makefile:17: recipe for target 'obj/bass.o' failed
make: *** [obj/bass.o] Error 1

However I can successfully compile bass on Linux (g++ version 5.3.1), so I'm not sure what's up. Just ping me on irc if you want to poke me for questions.

ARM9 commented

Your installation of cygwin seems to be missing the win32 api. The simplest solution would be to just get that (hopefully _WIN32 will then be defined properly). Otherwise I'm not sure what to treat cygwin as in the preprocessor in this case (gnu? linux? if at all possible eg #if defined(LINUX) || defined(CYGWIN)). Since I don't have windows or cygwin currently I can't test this.
Defines from ProfOaks cygwin g++: https://gist.github.com/ARM9/1cf40e66c09cc953d7704429d3f5d954

You can detect cygwin with:

#elif defined(__CYGWIN__)
  #define PLATFORM_WINDOWS
  Intrinsics::Platform Intrinsics::platform() { return Intrinsics::Platform::Windows; }

However, it still doesn't compile because WIN32 really is missing. To get bass working, I switched to msys2 "an independent rewrite of MSYS, based on modern Cygwin and MinGW-w64 with the aim of better interoperability with native Windows software". After installing I ran pacman -Syu, pacman -S make gcc, and then it worked.

$ make
g++ -x c++ -std=c++11 -fwrapv -O3 -fomit-frame-pointer -I.. -o obj/bass.o -c bass.cpp
In file included from ../nall/string.hpp:17:0,
                 from ../nall/base64.hpp:5,
                 from ../nall/nall.hpp:12,
                 from bass.hpp:1,
                 from bass.cpp:6:
../nall/intrinsics.hpp:56:4: warning: #warning "unable to detect platform" [-Wcpp]
   #warning "unable to detect platform"
    ^~~~~~~
g++ -o bass obj/bass.o  -s

$ ls
arch  bass.cpp  bass.exe  bass.hpp  core  doc  Makefile  obj

$ ./bass.exe
bass v14
usage: bass [options] [-o target] source [source ...]

options:
  -d name[=value]  create define with optional value
  -c name[=value]  create constant with optional value
  -strict          upgrade warnings to errors
  -create          overwrite target file if it already exists
  -benchmark       benchmark performance
  -sym file        create symbol file

I haven't used it yet, but if it prints help it probably works. If you want to suppress the error message, check for: #ifdef __MINGW32__ (link).

In case you want to to put a pre compiled version for people who are lazy or have limited bandwidth in the release section.
bass.zip

I've been strugling a lot but I'm not able to do a make in Windows 10 (x86). I have tried cygwin, msys64 & msys2 without luck. The error seems to be similar to the ProfOak had few years ago. OS is not recognized and threrefore WIN32 cannot be found. I have downloaded Phillip-May zip, but I don't know the reasson (maybe is too old) but I can not use it to compile for "ng-cpu" architecture. Any help will be appreciated.

$ make
g++ -x c++ -std=c++11 -fwrapv -O3 -fomit-frame-pointer -I.. -o obj/bass.o -c bass.cpp
In file included from ../nall/string.hpp:17,
                 from ../nall/base64.hpp:5,
                 from ../nall/nall.hpp:12,
                 from bass.hpp:1,
                 from bass.cpp:6:
../nall/intrinsics.hpp:56:4: warning: #warning "unable to detect platform" [-Wcpp]
   56 |   #warning "unable to detect platform"
      |    ^~~~~~~
In file included from bass.hpp:1,
                 from bass.cpp:6:
../nall/nall.hpp:1: error: unterminated #ifndef
    1 | #ifndef NALL_HPP
      |
In file included from ../nall/string.hpp:37,
                 from ../nall/base64.hpp:5,
                 from ../nall/nall.hpp:12,
                 from bass.hpp:1,
                 from bass.cpp:6:
../nall/string/platform.hpp: In function ‘nall::string nall::realpath(const nall::string&)’:
../nall/string/platform.hpp:18:8: error: ‘::realpath’ has not been declared; did you mean ‘nall::realpath’?
   18 |   if(::realpath(name, path)) result = dir(path);
      |        ^~~~~~~~
      |        nall::realpath
../nall/string/platform.hpp:15:8: note: ‘nall::realpath’ declared here
   15 | string realpath(const string& name) {
      |        ^~~~~~~~
../nall/string/platform.hpp: In function ‘nall::string nall::programpath()’:
../nall/string/platform.hpp:33:3: error: ‘Dl_info’ was not declared in this scope
   33 |   Dl_info info;
      |   ^~~~~~~
../nall/string/platform.hpp:34:32: error: ‘info’ was not declared in this scope
   34 |   dladdr((void*)&programpath, &info);
      |                                ^~~~
../nall/string/platform.hpp:34:3: error: ‘dladdr’ was not declared in this scope; did you mean ‘h_addr’?
   34 |   dladdr((void*)&programpath, &info);
      |   ^~~~~~
      |   h_addr
In file included from ../nall/bmp.hpp:4,
                 from ../nall/nall.hpp:15,
                 from bass.hpp:1,
                 from bass.cpp:6:
../nall/file.hpp: In member function ‘bool nall::file::truncate(unsigned int)’:
../nall/file.hpp:223:22: error: ‘fileno’ was not declared in this scope; did you mean ‘file’?
  223 |     return ftruncate(fileno(fp), size) == 0;
      |                      ^~~~~~
      |                      file
../nall/file.hpp:223:12: error: ‘ftruncate’ was not declared in this scope; did you mean ‘truncate’?
  223 |     return ftruncate(fileno(fp), size) == 0;
      |            ^~~~~~~~~
      |            truncate
In file included from ../nall/nall.hpp:19,
                 from bass.hpp:1,
                 from bass.cpp:6:
../nall/directory.hpp: In static member function ‘static nall::lstring nall::directory::ufolders(const nall::string&, const nall::string&)’:
../nall/directory.hpp:193:42: error: ‘DT_DIR’ was not declared in this scope
  193 |         bool is_directory = ep->d_type & DT_DIR;
      |                                          ^~~~~~
../nall/directory.hpp:194:25: error: ‘DT_UNKNOWN’ was not declared in this scope
  194 |         if(ep->d_type & DT_UNKNOWN) {
      |                         ^~~~~~~~~~
../nall/directory.hpp: In static member function ‘static nall::lstring nall::directory::ufiles(const nall::string&, const nall::string&)’:
../nall/directory.hpp:218:26: error: ‘DT_DIR’ was not declared in this scope
  218 |         if((ep->d_type & DT_DIR) == 0) {
      |                          ^~~~~~
In file included from ../nall/nall.hpp:29,
                 from bass.hpp:1,
                 from bass.cpp:6:
../nall/http.hpp: At global scope:
../nall/http.hpp:22:3: error: ‘addrinfo’ does not name a type
   22 |   addrinfo* serverinfo;
      |   ^~~~~~~~
../nall/http.hpp: In member function ‘bool nall::http::connect(nall::string, unsigned int)’:
../nall/http.hpp:44:5: error: ‘addrinfo’ was not declared in this scope
   44 |     addrinfo hints;
      |     ^~~~~~~~
../nall/http.hpp:45:13: error: ‘hints’ was not declared in this scope
   45 |     memset(&hints, 0, sizeof(addrinfo));
      |             ^~~~~
../nall/http.hpp:48:22: error: ‘AI_PASSIVE’ was not declared in this scope
   48 |     hints.ai_flags = AI_PASSIVE;
      |                      ^~~~~~~~~~
../nall/http.hpp:50:63: error: ‘serverinfo’ was not declared in this scope; did you mean ‘servent’?
   50 |     int status = getaddrinfo(hostname, string(port), &hints, &serverinfo);
      |                                                               ^~~~~~~~~~
      |                                                               servent
../nall/http.hpp:50:18: error: ‘getaddrinfo’ was not declared in this scope
   50 |     int status = getaddrinfo(hostname, string(port), &hints, &serverinfo);
      |                  ^~~~~~~~~~~
../nall/http.hpp: In member function ‘void nall::http::disconnect()’:
../nall/http.hpp:149:18: error: ‘serverinfo’ was not declared in this scope; did you mean ‘servent’?
  149 |     freeaddrinfo(serverinfo);
      |                  ^~~~~~~~~~
      |                  servent
../nall/http.hpp:149:5: error: ‘freeaddrinfo’ was not declared in this scope
  149 |     freeaddrinfo(serverinfo);
      |     ^~~~~~~~~~~~
In file included from core/core.cpp:1,
                 from bass.cpp:7:
core/evaluate.cpp: In member function ‘int64_t Bass::evaluate(nall::Eval::Node*, Bass::Evaluation)’:
core/evaluate.cpp:55:8: warning: control reaches end of non-void function [-Wreturn-type]
   55 |   error("unsupported operator");
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
core/evaluate.cpp: In member function ‘int64_t Bass::evaluateFunction(nall::Eval::Node*, Bass::Evaluation)’:
core/evaluate.cpp:67:50: warning: control reaches end of non-void function [-Wreturn-type]
   67 |   auto p = evaluateParameters(node->link[1], mode);
      |                                                  ^
core/evaluate.cpp: In member function ‘int64_t Bass::evaluateLiteral(nall::Eval::Node*, Bass::Evaluation)’:
core/evaluate.cpp:97:8: warning: control reaches end of non-void function [-Wreturn-type]
   97 |   error("unrecognized variable: ", s);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
core/evaluate.cpp: In member function ‘int64_t Bass::evaluateAssign(nall::Eval::Node*, Bass::Evaluation)’:
core/evaluate.cpp:108:8: warning: control reaches end of non-void function [-Wreturn-type]
  108 |   error("unrecognized variable");
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
make: *** [Makefile:17: obj/bass.o] Error 1


outdated as hell