T
Termux2mo ago
VISΛGE

Can't build CDP 8 because of POS64 in dev/newsfsys/sfsys.c Any hotfix possible?

Using the latest Clang in the packages and the latest code from their GitHub repo, I can't directly let Clang compile CDP 8 and the issue also persisted in the CDP 8.0 Tarball. I already made an issue regarding it but all it seems to do is to just get and set the memory addresses of whatever is passed into it, which are all data inside structs. I probably can just &(f->propoffset) to get their addresses but can I set them like this or do I have to wait for an official fix to be made?
GitHub
Building CDP8 on Termux gives errors about POS64 · Issue #17 · Co...
As the title says, I can't build CDP8 without errors about POS64 (member reference base type 'fpos_t' (aka 'long') is not a structure or union). Compiler: clang version 20.1.8 T...
Solution:
here is my version, you can try it and let me know if this works for you.
Jump to solution
5 Replies
owokitty
owokitty2mo ago
hi
Solution
owokitty
owokitty2mo ago
here is my version, you can try it and let me know if this works for you.
owokitty
owokitty2mo ago
pkg upgrade
pkg install git build-essential cmake dos2unix libandroid-glob portaudio-static
git clone https://github.com/ComposersDesktop/CDP8.git
# the software is written by a developer of Windows software,
# so unfortunately they commit CRLF line endings to
# some files and, experienced users of UNIX-like
# operating systems know that unfortunately,
# it's necessary to preemptively use this command
# on any local clones of CRLF repos that will be
# edited in any way on the UNIX-like operating system
# in order to avoid a lot
# of annoying problems that can happen from
# attempting to use CRLF-ended text files on
# UNIX-like operating systems.
find CDP8 -type f -print0 | xargs -0 dos2unix
tar xvf CDP8/libaaio/libaaio-0.3.1.tar.bz2 --strip-components=1 -C CDP8/libaaio/
rm CDP8/libaaio/libaaio-0.3.1.tar.bz2
cd CDP8
# make a local fork in which all code is tracked in
# a style that is friendly to development on UNIX-like operating systems
# the purpose of this is to make development for
# a fork of this software for Android or other UNIX-like
# operating systems more convenient.
# the downside is that any changes made will not be
# easily upstreamable to the repository where the
# developer of the Windows version is storing their code,
# but the advantage is that it avoids inconvenient
# barriers to writing and applying patches to the code
# through the command line of a UNIX-like operating system.
git add .
git commit -m "tmp"
# these are the patches which can fix your actual errors.
# the changes involve workarounds for several GNU-isms and
# Windows-isms written by the upstream developer, who is
# understandably likely focused on Windows and might not have
# the resources to maintain support for alternative UNIX-like operating systems.
pkg upgrade
pkg install git build-essential cmake dos2unix libandroid-glob portaudio-static
git clone https://github.com/ComposersDesktop/CDP8.git
# the software is written by a developer of Windows software,
# so unfortunately they commit CRLF line endings to
# some files and, experienced users of UNIX-like
# operating systems know that unfortunately,
# it's necessary to preemptively use this command
# on any local clones of CRLF repos that will be
# edited in any way on the UNIX-like operating system
# in order to avoid a lot
# of annoying problems that can happen from
# attempting to use CRLF-ended text files on
# UNIX-like operating systems.
find CDP8 -type f -print0 | xargs -0 dos2unix
tar xvf CDP8/libaaio/libaaio-0.3.1.tar.bz2 --strip-components=1 -C CDP8/libaaio/
rm CDP8/libaaio/libaaio-0.3.1.tar.bz2
cd CDP8
# make a local fork in which all code is tracked in
# a style that is friendly to development on UNIX-like operating systems
# the purpose of this is to make development for
# a fork of this software for Android or other UNIX-like
# operating systems more convenient.
# the downside is that any changes made will not be
# easily upstreamable to the repository where the
# developer of the Windows version is storing their code,
# but the advantage is that it avoids inconvenient
# barriers to writing and applying patches to the code
# through the command line of a UNIX-like operating system.
git add .
git commit -m "tmp"
# these are the patches which can fix your actual errors.
# the changes involve workarounds for several GNU-isms and
# Windows-isms written by the upstream developer, who is
# understandably likely focused on Windows and might not have
# the resources to maintain support for alternative UNIX-like operating systems.
git apply -v << 'EOF'
--- a/dev/externals/mctools/chxformat.c
+++ b/dev/externals/mctools/chxformat.c
@@ -41,7 +41,7 @@ char* guidnames[] = {"PCM","PCM FLOAT","AMB PCM","AMB FLOAT"};
#define REVWBYTES(t) ( (((t)&0xff) << 8) | (((t)>>8) &0xff) )
#define TAG(a,b,c,d) ( ((a)<<24) | ((b)<<16) | ((c)<<8) | (d) )

-#ifdef linux
+#if defined(linux) && !defined(__ANDROID__)
#define POS64(x) (x.__pos)
#else
#define POS64(x) (x)
--- a/dev/externals/portsf/portsf.c
+++ b/dev/externals/portsf/portsf.c
@@ -90,7 +90,7 @@ int stricmp(const char *a, const char *b);
int strnicmp(const char *a, const char *b, const int length);
#endif

-#ifdef linux
+#if defined(linux) && !defined(__ANDROID__)
#define POS64(x) (x.__pos)
#else
#define POS64(x) (x)
EOF
git apply -v << 'EOF'
--- a/dev/externals/mctools/chxformat.c
+++ b/dev/externals/mctools/chxformat.c
@@ -41,7 +41,7 @@ char* guidnames[] = {"PCM","PCM FLOAT","AMB PCM","AMB FLOAT"};
#define REVWBYTES(t) ( (((t)&0xff) << 8) | (((t)>>8) &0xff) )
#define TAG(a,b,c,d) ( ((a)<<24) | ((b)<<16) | ((c)<<8) | (d) )

-#ifdef linux
+#if defined(linux) && !defined(__ANDROID__)
#define POS64(x) (x.__pos)
#else
#define POS64(x) (x)
--- a/dev/externals/portsf/portsf.c
+++ b/dev/externals/portsf/portsf.c
@@ -90,7 +90,7 @@ int stricmp(const char *a, const char *b);
int strnicmp(const char *a, const char *b, const int length);
#endif

-#ifdef linux
+#if defined(linux) && !defined(__ANDROID__)
#define POS64(x) (x.__pos)
#else
#define POS64(x) (x)
EOF
git apply -v << 'EOF'
--- a/dev/newsfsys/sfsys.c
+++ b/dev/newsfsys/sfsys.c
@@ -280,7 +280,7 @@ extern int sampsize[];
#define sizeof_WFMTEX (40)


-#ifdef linux
+#if defined(linux) && !defined(__ANDROID__)
#define POS64(x) (x.__pos)
#else
#define POS64(x) (x)
--- a/dev/sfsys/sfsys.c
+++ b/dev/sfsys/sfsys.c
@@ -274,7 +274,7 @@ extern int sampsize[];
#define sizeof_WFMTEX (40)


-#ifdef linux
+#if defined(linux) && !defined(__ANDROID__)
#define POS64(x) (x.__pos)
#else
#define POS64(x) (x)
EOF
git apply -v << 'EOF'
--- a/dev/newsfsys/sfsys.c
+++ b/dev/newsfsys/sfsys.c
@@ -280,7 +280,7 @@ extern int sampsize[];
#define sizeof_WFMTEX (40)


-#ifdef linux
+#if defined(linux) && !defined(__ANDROID__)
#define POS64(x) (x.__pos)
#else
#define POS64(x) (x)
--- a/dev/sfsys/sfsys.c
+++ b/dev/sfsys/sfsys.c
@@ -274,7 +274,7 @@ extern int sampsize[];
#define sizeof_WFMTEX (40)


-#ifdef linux
+#if defined(linux) && !defined(__ANDROID__)
#define POS64(x) (x.__pos)
#else
#define POS64(x) (x)
EOF
git apply -v << 'EOF'
--- a/dev/externals/paprogs/pvplay/CMakeLists.txt
+++ b/dev/externals/paprogs/pvplay/CMakeLists.txt
@@ -32,7 +32,7 @@ link_directories( ../../lib ../../../newsfsys ../../../pvxio2)
# need /usr/local/include here?
include_directories(/usr/local/include ../../../newinclude ../include ../portaudio/include ../portaudio/src/common)
#../portaudio/src/common/pa_ringbuffer.c
-add_executable(pvplay pvplay.cpp pvoc2.cpp fmhfuncs.c pvthreads.cpp mxfft.c)
+add_executable(pvplay pvplay.cpp pvoc2.cpp fmhfuncs.c pvthreads.cpp mxfft.c ../pa_ringbuffer.c)
target_link_libraries(pvplay sfsys pvxio2 ${EXTRA_LIBRARIES1})

my_install(pvplay)
--- a/dev/externals/paprogs/paplay/CMakeLists.txt
+++ b/dev/externals/paprogs/paplay/CMakeLists.txt
@@ -35,7 +35,7 @@ include_directories(../../include ../include ../portaudio/include ../portaudio/s
if(MINGW)
add_executable(paplay paplay.c fmhfuncs.c cmakedummy.cpp)
else()
-add_executable(paplay paplay.c fmhfuncs.c )
+add_executable(paplay paplay.c fmhfuncs.c ../pa_ringbuffer.c)
endif()
target_link_libraries(paplay ${EXTRA_LIBRARIES1})

--- a/dev/externals/paprogs/recsf/CMakeLists.txt
+++ b/dev/externals/paprogs/recsf/CMakeLists.txt
@@ -33,7 +33,7 @@ include_directories(../../include ../portaudio/include ../portaudio/src/common /
if(MINGW)
add_executable(recsf recsf.c cmakedummy.cpp)
else()
- add_executable(recsf recsf.c)
+ add_executable(recsf recsf.c ../pa_ringbuffer.c)
endif()
target_link_libraries(recsf portsf ${EXTRA_LIBRARIES1})

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -119,7 +119,7 @@ if(WIN32)
oleaut32
uuid)
else()
- set(EXTRA_LIBRARIES "m")
+ set(EXTRA_LIBRARIES "m" "OpenSLES")
endif(WIN32)

if(CMAKE_SYSTEM_NAME MATCHES "Linux")
EOF
git apply -v << 'EOF'
--- a/dev/externals/paprogs/pvplay/CMakeLists.txt
+++ b/dev/externals/paprogs/pvplay/CMakeLists.txt
@@ -32,7 +32,7 @@ link_directories( ../../lib ../../../newsfsys ../../../pvxio2)
# need /usr/local/include here?
include_directories(/usr/local/include ../../../newinclude ../include ../portaudio/include ../portaudio/src/common)
#../portaudio/src/common/pa_ringbuffer.c
-add_executable(pvplay pvplay.cpp pvoc2.cpp fmhfuncs.c pvthreads.cpp mxfft.c)
+add_executable(pvplay pvplay.cpp pvoc2.cpp fmhfuncs.c pvthreads.cpp mxfft.c ../pa_ringbuffer.c)
target_link_libraries(pvplay sfsys pvxio2 ${EXTRA_LIBRARIES1})

my_install(pvplay)
--- a/dev/externals/paprogs/paplay/CMakeLists.txt
+++ b/dev/externals/paprogs/paplay/CMakeLists.txt
@@ -35,7 +35,7 @@ include_directories(../../include ../include ../portaudio/include ../portaudio/s
if(MINGW)
add_executable(paplay paplay.c fmhfuncs.c cmakedummy.cpp)
else()
-add_executable(paplay paplay.c fmhfuncs.c )
+add_executable(paplay paplay.c fmhfuncs.c ../pa_ringbuffer.c)
endif()
target_link_libraries(paplay ${EXTRA_LIBRARIES1})

--- a/dev/externals/paprogs/recsf/CMakeLists.txt
+++ b/dev/externals/paprogs/recsf/CMakeLists.txt
@@ -33,7 +33,7 @@ include_directories(../../include ../portaudio/include ../portaudio/src/common /
if(MINGW)
add_executable(recsf recsf.c cmakedummy.cpp)
else()
- add_executable(recsf recsf.c)
+ add_executable(recsf recsf.c ../pa_ringbuffer.c)
endif()
target_link_libraries(recsf portsf ${EXTRA_LIBRARIES1})

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -119,7 +119,7 @@ if(WIN32)
oleaut32
uuid)
else()
- set(EXTRA_LIBRARIES "m")
+ set(EXTRA_LIBRARIES "m" "OpenSLES")
endif(WIN32)

if(CMAKE_SYSTEM_NAME MATCHES "Linux")
EOF
# the build system of the software is unfortunately written in an inconvenient way
# that doesn't allow easily adding additional compiler arguments, so just stuff
# all the needed arguments into places where they work.
find . -type f | xargs -n 1 sed -i \
-e "s|-Dunix|$(pkg-config --libs portaudiocpp) -landroid-glob -D__USE_BSD -Dunix|g" \
-e "s|PaUtil_AllocateMemory|PaUtil_AllocateZeroInitializedMemory|g"
# this software uses internal portaudio code that is not intended for public use by upstream portaudio.
curl https://raw.githubusercontent.com/PortAudio/portaudio/57aa393109ec996799d3a5846c9ecb0a65b64644/src/common/pa_ringbuffer.h > dev/include/pa_ringbuffer.h
curl https://raw.githubusercontent.com/PortAudio/portaudio/57aa393109ec996799d3a5846c9ecb0a65b64644/src/common/pa_memorybarrier.h > dev/include/pa_memorybarrier.h
curl https://raw.githubusercontent.com/PortAudio/portaudio/57aa393109ec996799d3a5846c9ecb0a65b64644/src/common/pa_util.h > dev/include/pa_util.h
curl https://raw.githubusercontent.com/PortAudio/portaudio/57aa393109ec996799d3a5846c9ecb0a65b64644/src/common/pa_ringbuffer.c > dev/externals/paprogs/pa_ringbuffer.c
# install a timeb polyfill for Android
# that I copied and pasted from the 8086tiny package
mkdir dev/include/sys
# the build system of the software is unfortunately written in an inconvenient way
# that doesn't allow easily adding additional compiler arguments, so just stuff
# all the needed arguments into places where they work.
find . -type f | xargs -n 1 sed -i \
-e "s|-Dunix|$(pkg-config --libs portaudiocpp) -landroid-glob -D__USE_BSD -Dunix|g" \
-e "s|PaUtil_AllocateMemory|PaUtil_AllocateZeroInitializedMemory|g"
# this software uses internal portaudio code that is not intended for public use by upstream portaudio.
curl https://raw.githubusercontent.com/PortAudio/portaudio/57aa393109ec996799d3a5846c9ecb0a65b64644/src/common/pa_ringbuffer.h > dev/include/pa_ringbuffer.h
curl https://raw.githubusercontent.com/PortAudio/portaudio/57aa393109ec996799d3a5846c9ecb0a65b64644/src/common/pa_memorybarrier.h > dev/include/pa_memorybarrier.h
curl https://raw.githubusercontent.com/PortAudio/portaudio/57aa393109ec996799d3a5846c9ecb0a65b64644/src/common/pa_util.h > dev/include/pa_util.h
curl https://raw.githubusercontent.com/PortAudio/portaudio/57aa393109ec996799d3a5846c9ecb0a65b64644/src/common/pa_ringbuffer.c > dev/externals/paprogs/pa_ringbuffer.c
# install a timeb polyfill for Android
# that I copied and pasted from the 8086tiny package
mkdir dev/include/sys
cat << 'EOF' > dev/include/sys/timeb.h
#ifndef _TIMEB_H
#define _TIMEB_H

#include <time.h>

struct timeb {
time_t time; /* Seconds since epoch, as from `time'. */
unsigned short int millitm; /* Additional milliseconds. */
short int timezone; /* Minutes west of GMT. */
short int dstflag; /* Nonzero if Daylight Savings Time used. */
};

static int ftime(struct timeb *tb)
{
struct timeval tv;
struct timezone tz;

if (gettimeofday (&tv, &tz) < 0)
return -1;

tb->time = tv.tv_sec;
tb->millitm = (tv.tv_usec + 500) / 1000;

if (tb->millitm == 1000) {
++tb->time;
tb->millitm = 0;
}
tb->timezone = tz.tz_minuteswest;
tb->dstflag = tz.tz_dsttime;

return 0;
}

#endif
EOF
cd libaaio/
autoreconf -fi
# warning this will install libaaio manually into your Termux $PREFIX
# without package management, but the software libaaio is
# not widely used and is unlikely to conflict with anything else
./configure --prefix=$PREFIX
make
make install
cd ..
mkdir build
cd build
cmake ..
make
cat << 'EOF' > dev/include/sys/timeb.h
#ifndef _TIMEB_H
#define _TIMEB_H

#include <time.h>

struct timeb {
time_t time; /* Seconds since epoch, as from `time'. */
unsigned short int millitm; /* Additional milliseconds. */
short int timezone; /* Minutes west of GMT. */
short int dstflag; /* Nonzero if Daylight Savings Time used. */
};

static int ftime(struct timeb *tb)
{
struct timeval tv;
struct timezone tz;

if (gettimeofday (&tv, &tz) < 0)
return -1;

tb->time = tv.tv_sec;
tb->millitm = (tv.tv_usec + 500) / 1000;

if (tb->millitm == 1000) {
++tb->time;
tb->millitm = 0;
}
tb->timezone = tz.tz_minuteswest;
tb->dstflag = tz.tz_dsttime;

return 0;
}

#endif
EOF
cd libaaio/
autoreconf -fi
# warning this will install libaaio manually into your Termux $PREFIX
# without package management, but the software libaaio is
# not widely used and is unlikely to conflict with anything else
./configure --prefix=$PREFIX
make
make install
cd ..
mkdir build
cd build
cmake ..
make
in order to do this you kind of have to copy and paste that 200 lines of bash code and run it, i made that, but unfortunately it won't work unless you copy and paste it perfectly so if you have a hard time getting this script to run then let me know and I'll upload it somewhere else where you can download it @VISΛGE I put it in your issue too, it should be easy to copy from there if you need it
VISΛGE
VISΛGEOP2mo ago
i thought there were other non-glibc linux systems. is that only an android thing?
owokitty
owokitty2mo ago
there are but i haven't tested cdp8 on any of them, so they would all need their own different patch sets but i can let you know that there would be a similar amount of patches for most of them, just different patches, because it is clear that the upstream developer does not regularly test or add support in their code for most OS other than windows, so a lot of changes would be required to fully support all UNIX-like OS at once without errors

Did you find this page helpful?