Comments (2)
Can confirm it doesn't build either in Ubuntu 18.04 with g++ 7.5.0. I had to apply the following patch to get around some missing includes that g++ was complaining about and to fix the install prefix to the Phosg library to the one used by the Phosg Makefile here.
From cf8601994d232f558daea2077fbf92c156edaaa8 Mon Sep 17 00:00:00 2001
From: Miguel Angel Astor Romero <[email protected]>
Date: Fri, 30 Oct 2020 14:33:52 -0400
Subject: [PATCH] abcd
---
Makefile | 28 ++++++++++++++--------------
bt_render.cc | 2 ++
render_bits.cc | 1 +
resource_dasm.cc | 1 +
resource_fork.cc | 1 +
5 files changed, 19 insertions(+), 14 deletions(-)
diff --git a/Makefile b/Makefile
index 08576e0..4dc204c 100644
--- a/Makefile
+++ b/Makefile
@@ -1,48 +1,48 @@
COMMON_OBJECTS=resource_fork.o audio_codecs.o pict.o quickdraw_formats.o mc68k.o mc68k_dasm.o
-CXXFLAGS=-I/opt/local/include -g -Wall -std=c++14
-LDFLAGS=-L/opt/local/lib -lphosg
+CXXFLAGS=-I/usr/local/include/phosg -g -Wall -std=c++14
+LDFLAGS=-L/usr/local/lib -lm -lpthread
EXECUTABLES=render_bits bt_render macski_decomp mohawk_dasm realmz_dasm dc_dasm resource_dasm infotron_render ferazel_render harry_render mshines_render sc2k_render
all: $(EXECUTABLES)
resource_dasm: resource_dasm.o $(COMMON_OBJECTS)
- g++ $(LDFLAGS) -o resource_dasm $^
+ g++ -o resource_dasm $^ /usr/local/lib/libphosg.a $(LDFLAGS)
bt_render: bt_render.o ambrosia_sprites.o $(COMMON_OBJECTS)
- g++ $(LDFLAGS) -o bt_render $^
+ g++ -o bt_render $^ /usr/local/lib/libphosg.a $(LDFLAGS)
dc_dasm: dc_dasm.o $(COMMON_OBJECTS)
- g++ $(LDFLAGS) -o dc_dasm $^
+ g++ -o dc_dasm $^ /usr/local/lib/libphosg.a $(LDFLAGS)
ferazel_render: ferazel_render.o $(COMMON_OBJECTS)
- g++ $(LDFLAGS) -o ferazel_render $^
+ g++ -o ferazel_render $^ /usr/local/lib/libphosg.a $(LDFLAGS)
harry_render: harry_render.o ambrosia_sprites.o $(COMMON_OBJECTS)
- g++ $(LDFLAGS) -o harry_render $^
+ g++ -o harry_render $^ /usr/local/lib/libphosg.a $(LDFLAGS)
infotron_render: infotron_render.o $(COMMON_OBJECTS)
- g++ $(LDFLAGS) -o infotron_render $^
+ g++ -o infotron_render $^ /usr/local/lib/libphosg.a $(LDFLAGS)
macski_decomp: macski_decomp.o
- g++ $(LDFLAGS) -o macski_decomp $^
+ g++ -o macski_decomp $^ /usr/local/lib/libphosg.a $(LDFLAGS)
mohawk_dasm: mohawk_dasm.o $(COMMON_OBJECTS)
- g++ $(LDFLAGS) -o mohawk_dasm $^
+ g++ -o mohawk_dasm $^ /usr/local/lib/libphosg.a $(LDFLAGS)
mshines_render: mshines_render.o $(COMMON_OBJECTS)
- g++ $(LDFLAGS) -o mshines_render $^
+ g++ -o mshines_render $^ /usr/local/lib/libphosg.a $(LDFLAGS)
realmz_dasm: realmz_dasm.o realmz_lib.o $(COMMON_OBJECTS)
- g++ $(LDFLAGS) -o realmz_dasm $^
+ g++ -o realmz_dasm $^ /usr/local/lib/libphosg.a $(LDFLAGS)
render_bits: render_bits.o
- g++ $(LDFLAGS) -o render_bits $^
+ g++ -o render_bits $^ /usr/local/lib/libphosg.a $(LDFLAGS)
sc2k_render: sc2k_render.o $(COMMON_OBJECTS)
- g++ $(LDFLAGS) -o sc2k_render $^
+ g++ -o sc2k_render $^ /usr/local/lib/libphosg.a $(LDFLAGS)
clean:
diff --git a/bt_render.cc b/bt_render.cc
index 81ac969..3c95024 100755
--- a/bt_render.cc
+++ b/bt_render.cc
@@ -1,3 +1,5 @@
+#include <cstring>
+
#include <phosg/Filesystem.hh>
#include <phosg/Image.hh>
#include <phosg/Strings.hh>
diff --git a/render_bits.cc b/render_bits.cc
index 56a6c6c..2c6d1cb 100755
--- a/render_bits.cc
+++ b/render_bits.cc
@@ -1,6 +1,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <cmath>
#include <phosg/Encoding.hh>
#include <phosg/Image.hh>
diff --git a/resource_dasm.cc b/resource_dasm.cc
index 89347da..f03ddc0 100644
--- a/resource_dasm.cc
+++ b/resource_dasm.cc
@@ -4,6 +4,7 @@
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
+#include <algorithm>
#include <functional>
#include <phosg/Encoding.hh>
diff --git a/resource_fork.cc b/resource_fork.cc
index 45ae1ff..ed9d3fa 100644
--- a/resource_fork.cc
+++ b/resource_fork.cc
@@ -7,6 +7,7 @@
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
+#include <algorithm>
#include <exception>
#include <phosg/Encoding.hh>
--
2.17.1
After the patch it fails with the following compilation error that I honestly can't make head or tails off (c++14 isn't my forte either), though by the looks of it, it makes me think that maaaaaaybe it needs a specific version of g++ higher than 7.5.0 🤔️
In file included from /usr/include/x86_64-linux-gnu/c++/7/bits/c++allocator.h:33:0,
from /usr/include/c++/7/bits/allocator.h:46,
from /usr/include/c++/7/string:41,
from /usr/include/c++/7/stdexcept:39,
from /usr/include/c++/7/array:39,
from /usr/include/c++/7/tuple:39,
from /usr/include/c++/7/functional:54,
from /usr/local/include/phosg/Filesystem.hh:15,
from resource_fork.hh:8,
from resource_fork.cc:1:
/usr/include/c++/7/ext/new_allocator.h: In instantiation of ‘class __gnu_cxx::new_allocator<const std::__cxx11::basic_string<char> >’:
/usr/include/c++/7/bits/allocator.h:108:11: required from ‘class std::allocator<const std::__cxx11::basic_string<char> >’
/usr/include/c++/7/bits/stl_vector.h:81:14: required from ‘struct std::_Vector_base<const std::__cxx11::basic_string<char>, std::allocator<const std::__cxx11::basic_string<char> > >::_Vector_impl’
/usr/include/c++/7/bits/stl_vector.h:166:20: required from ‘struct std::_Vector_base<const std::__cxx11::basic_string<char>, std::allocator<const std::__cxx11::basic_string<char> > >’
/usr/include/c++/7/bits/stl_vector.h:216:11: required from ‘class std::vector<const std::__cxx11::basic_string<char> >’
resource_fork.cc:2584:44: required from here
/usr/include/c++/7/ext/new_allocator.h:93:7: error: ‘const _Tp* __gnu_cxx::new_allocator<_Tp>::address(__gnu_cxx::new_allocator<_Tp>::const_reference) const [with _Tp = const std::__cxx11::basic_string<char>; __gnu_cxx::new_allocator<_Tp>::const_pointer = const std::__cxx11::basic_string<char>*; __gnu_cxx::new_allocator<_Tp>::const_reference = const std::__cxx11::basic_string<char>&]’ cannot be overloaded
address(const_reference __x) const _GLIBCXX_NOEXCEPT
^~~~~~~
/usr/include/c++/7/ext/new_allocator.h:89:7: error: with ‘_Tp* __gnu_cxx::new_allocator<_Tp>::address(__gnu_cxx::new_allocator<_Tp>::reference) const [with _Tp = const std::__cxx11::basic_string<char>; __gnu_cxx::new_allocator<_Tp>::pointer = const std::__cxx11::basic_string<char>*; __gnu_cxx::new_allocator<_Tp>::reference = const std::__cxx11::basic_string<char>&]’
address(reference __x) const _GLIBCXX_NOEXCEPT
^~~~~~~
resource_fork.cc: In member function ‘std::__cxx11::string ResourceFile::decode_styl(int16_t, uint32_t)’:
resource_fork.cc:2949:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
uint32_t end_offset = (x == num_commands - 1) ? text.size() : bswap32(cmds[x + 1].offset);
~~^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/7/bits/c++allocator.h:33:0,
from /usr/include/c++/7/bits/allocator.h:46,
from /usr/include/c++/7/string:41,
from /usr/include/c++/7/stdexcept:39,
from /usr/include/c++/7/array:39,
from /usr/include/c++/7/tuple:39,
from /usr/include/c++/7/functional:54,
from /usr/local/include/phosg/Filesystem.hh:15,
from resource_fork.hh:8,
from resource_fork.cc:1:
/usr/include/c++/7/ext/new_allocator.h: In instantiation of ‘void __gnu_cxx::new_allocator<_Tp>::deallocate(__gnu_cxx::new_allocator<_Tp>::pointer, __gnu_cxx::new_allocator<_Tp>::size_type) [with _Tp = const std::__cxx11::basic_string<char>; __gnu_cxx::new_allocator<_Tp>::pointer = const std::__cxx11::basic_string<char>*; __gnu_cxx::new_allocator<_Tp>::size_type = long unsigned int]’:
/usr/include/c++/7/bits/alloc_traits.h:462:9: required from ‘static void std::allocator_traits<std::allocator<_CharT> >::deallocate(std::allocator_traits<std::allocator<_CharT> >::allocator_type&, std::allocator_traits<std::allocator<_CharT> >::pointer, std::allocator_traits<std::allocator<_CharT> >::size_type) [with _Tp = const std::__cxx11::basic_string<char>; std::allocator_traits<std::allocator<_CharT> >::allocator_type = std::allocator<const std::__cxx11::basic_string<char> >; std::allocator_traits<std::allocator<_CharT> >::pointer = const std::__cxx11::basic_string<char>*; std::allocator_traits<std::allocator<_CharT> >::size_type = long unsigned int]’
/usr/include/c++/7/bits/stl_vector.h:180:19: required from ‘void std::_Vector_base<_Tp, _Alloc>::_M_deallocate(std::_Vector_base<_Tp, _Alloc>::pointer, std::size_t) [with _Tp = const std::__cxx11::basic_string<char>; _Alloc = std::allocator<const std::__cxx11::basic_string<char> >; std::_Vector_base<_Tp, _Alloc>::pointer = const std::__cxx11::basic_string<char>*; std::size_t = long unsigned int]’
/usr/include/c++/7/bits/stl_vector.h:162:22: required from ‘std::_Vector_base<_Tp, _Alloc>::~_Vector_base() [with _Tp = const std::__cxx11::basic_string<char>; _Alloc = std::allocator<const std::__cxx11::basic_string<char> >]’
/usr/include/c++/7/bits/stl_vector.h:385:18: required from ‘std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = const std::__cxx11::basic_string<char>; _Alloc = std::allocator<const std::__cxx11::basic_string<char> >; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<const std::__cxx11::basic_string<char> >]’
resource_fork.cc:2652:2: required from here
/usr/include/c++/7/ext/new_allocator.h:125:19: error: invalid conversion from ‘const void*’ to ‘void*’ [-fpermissive]
::operator delete(__p);
~~~~~~~~~~~~~~~~~^~~~~
In file included from /usr/include/c++/7/functional:53:0,
from /usr/local/include/phosg/Filesystem.hh:15,
from resource_fork.hh:8,
from resource_fork.cc:1:
/usr/include/c++/7/new:124:6: note: initializing argument 1 of ‘void operator delete(void*)’
void operator delete(void*) _GLIBCXX_USE_NOEXCEPT
^~~~~~~~
In file included from /usr/include/c++/7/memory:64:0,
from /usr/local/include/phosg/Filesystem.hh:16,
from resource_fork.hh:8,
from resource_fork.cc:1:
/usr/include/c++/7/bits/stl_construct.h: In instantiation of ‘void std::_Construct(_T1*, _Args&& ...) [with _T1 = const std::__cxx11::basic_string<char>; _Args = {const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&}]’:
/usr/include/c++/7/bits/stl_uninitialized.h:83:18: required from ‘static _ForwardIterator std::__uninitialized_copy<_TrivialValueTypes>::__uninit_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = const std::__cxx11::basic_string<char>*; _ForwardIterator = const std::__cxx11::basic_string<char>*; bool _TrivialValueTypes = false]’
/usr/include/c++/7/bits/stl_uninitialized.h:134:15: required from ‘_ForwardIterator std::uninitialized_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = const std::__cxx11::basic_string<char>*; _ForwardIterator = const std::__cxx11::basic_string<char>*]’
/usr/include/c++/7/bits/stl_uninitialized.h:289:37: required from ‘_ForwardIterator std::__uninitialized_copy_a(_InputIterator, _InputIterator, _ForwardIterator, std::allocator<_Tp>&) [with _InputIterator = const std::__cxx11::basic_string<char>*; _ForwardIterator = const std::__cxx11::basic_string<char>*; _Tp = const std::__cxx11::basic_string<char>]’
/usr/include/c++/7/bits/stl_vector.h:1331:33: required from ‘void std::vector<_Tp, _Alloc>::_M_range_initialize(_ForwardIterator, _ForwardIterator, std::forward_iterator_tag) [with _ForwardIterator = const std::__cxx11::basic_string<char>*; _Tp = const std::__cxx11::basic_string<char>; _Alloc = std::allocator<const std::__cxx11::basic_string<char> >]’
/usr/include/c++/7/bits/stl_vector.h:387:21: required from ‘std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = const std::__cxx11::basic_string<char>; _Alloc = std::allocator<const std::__cxx11::basic_string<char> >; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<const std::__cxx11::basic_string<char> >]’
resource_fork.cc:2652:2: required from here
/usr/include/c++/7/bits/stl_construct.h:75:13: error: invalid static_cast from type ‘const std::__cxx11::basic_string<char>*’ to type ‘void*’
{ ::new(static_cast<void*>(__p)) _T1(std::forward<_Args>(__args)...); }
^~~~~~~~~~~~~~~~~~~~~~~
Also tried to compile it with clang but it throws an impressive ammount of linking error with the Phosg library (also compiled with clang). The library itself compiles fine with both g++ and clang, however.
from resource_dasm.
There were a couple of problems here; I've addressed them in b3bb502, which should make the project build properly in Ubuntu 18.04 / gcc 7.5.0 and hopefully other Linuxes as well; I don't have any other distributions already set up to try with though. This commit fixes numerous sign-compare warnings (clang doesn't warn about these), adds missing includes, and fixes the linker argument order so ld won't complain. It's remarkable to me that in 2020, the linker still isn't smart enough to link libraries correctly regardless of the order they're specified on the command line...
Feel free to reopen if this doesn't fix the build issues for you.
from resource_dasm.
Related Issues (20)
- Any way to group the items by resource type? HOT 6
- Encoding.hh: shifting a negative signed value is undefined HOT 1
- Format string errors HOT 2
- Black borders when decoding PICT HOT 3
- Format of Spectre Supreme "shap" resources HOT 7
- Technically, it's "PEF", not "PEFF" (Preferred Executable Format) HOT 1
- Improvement : extracting as png instead of bmp HOT 5
- compile error in Ubuntu on Pi4 ARM HOT 16
- warning: PICT rendering failed (mask region rect Rect(x1=-27892, y1=26790, x2=0, y2=256) is not same as source rect HOT 5
- Suggestion: Conditional compilation for some features HOT 4
- Easier way to convert TEXT/styl to .rtf? HOT 2
- Prebuilt binary for Linux with phosg prelinked HOT 2
- issue with Mail.app .emlx files HOT 6
- Maelstrom icns converted to PNG/BMP are just mask HOT 4
- Bad CPU type in executable HOT 2
- Incorrect canvas size for some PICTs HOT 5
- Doesn't Work On Amazon Trail? HOT 2
- compile errors with g++ 13.2.1 20230826 HOT 4
- Blobbo - resource fork missing or empty HOT 6
- Minor Issue: BCD Version numbers in 'vers' resources HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from resource_dasm.