How to build DCMTK 3.6.1 libs for iOS? - ios

I followed Russes' instructions found at http://forum.dcmtk.org/viewtopic.php?f=3&t=3047&start=15
With a fresh copy of his "afab" git branch, I built Xcode project for x86 arch with the command line:
cmake -DIOS_PLATFORM=SIMULATOR64 -G Xcode ../dcmtk.public
or for arm arch with:
cmake -DIOS_PLATFORM=OS -G Xcode ../dcmtk.public
However, my Xcode project can't be successfully built because of, at least, the following errors:
List of Xcode errors on ofchrenc.cc file (for eg. "No class named Implementation in OFCharacterEncoding")
The compilation with Unix makefiles gives the same errors in my case:
Scanning dependencies of target ofstd
0% Building CXX object ofstd/libsrc/CMakeFiles/ofstd.dir/ofchrenc.cc.o
dcmtk.public/ofstd/libsrc/ofchrenc.cc:518:28: error: no class named 'Implementation' in 'OFCharacterEncoding'
class OFCharacterEncoding::Implementation {};
dcmtk.public/ofstd/libsrc/ofchrenc.cc:556:31: error: out-of-line definition of 'getLocaleEncoding' does not match any declaration in
'OFCharacterEncoding'
OFString OFCharacterEncoding::getLocaleEncoding()
/usr/local/include/dcmtk/ofstd/ofchrenc.h:97:21: note: member declaration does not match because it is const qualified
const OFString &getLocaleEncoding() const;
[...]
dcmtk.public/ofstd/libsrc/ofchrenc.cc:644:34: error: out-of-line definition of 'setConversionFlags' does not match any declaration in
'OFCharacterEncoding'
OFCondition OFCharacterEncoding::setConversionFlags(const unsigned flags)
19 errors generated.
make 2: ofstd/libsrc/CMakeFiles/ofstd.dir/ofchrenc.cc.o Error 1
make 1: ofstd/libsrc/CMakeFiles/ofstd.dir/all Error 2
make: [all] Error 2
I don't understand what is wrong in my configuration:
MacOs Sierra 10.12.2
Xcode 8.2
CMake 3.7.1 (I have the same issue previously with 3.5.2 version)
GNU Make 3.81 (for Unix makefiles compilation)
Apple LLVM version 8.0.0.8000042
Darwin version of host: 16.3.0
Building for minimum iOS version: 10.2 (SDK version: 10.2)

I'm not sure about the first error message but
/usr/local/include/dcmtk/ofstd/ofchrenc.h:97:21: note: member
declaration does not match because it is const qualified const
OFString &getLocaleEncoding() const;
seems to indicate that you are mixing an old version of "ofchrenc.h" (stored in "/usr/local/...") with a more recent version of "ofchrenc.cc" (stored in your working directory).

Related

How to compile RocksDB for IOS?

I've been trying to compile the rocksdb platform for iOS for a while now.
The simple git clone the repo and run
TARGET_OS="IOS" make static_lib -j8
fails with a spew of errors, and I'm not sure where I can also add the preprocessor directives.
I have then been looking at wrappers, and trying to compile them for a later version:
https://github.com/koraykoska/rocksdb.swift : This uses a rocksdb version of 6.4.7, and uses CocoaPods to compile the rocksdb library and the swift wrapper. I have tried cloning the rocksdb repo into the upstream folder, and then use this 'rocksdb.swift' pod in an Xcode Project.
Here are the changes I made in the pod spec(v6.22.1 being the one I need to compile.)
(librocksdb.podspec)
s.name = 'librocksdb'
s.version = '***6.22.1***'
s.summary = 'rocksdb bindings for Swift. Cocoapods and SPM support. Linux support.'
(rocksdb.swift.podspec)
s.name = 'rocksdb.swift'
s.version = '***6.22.1***'
s.summary = 'rocksdb Wrapper for Swift. Cocoapods and SPM support. Linux support.'
...
s.dependency 'librocksdb', '~> ***6.22.1***'
...
The pod install now fails as it cannot find the 'new' version of librocksdb so I add both librocksdb and rocksdb.swift to my Podfile with the :path => format.
The pod then installs, and the Xcode project has this error
/.../librdb/librocksdb/rocksdb/memtable/write_buffer_manager.cc:10:10: 'rocksdb/write_buffer_manager.h' file not found
https://github.com/hlzhang/rocksdb-build : Along similar lines to the previous wrapper, I tried changing the versions and then compiling. This meant some changes in common.sh and build-rocksdb-ios.sh scripts. Fails with
monitoring/perf_context.cc:23:2: error: "No thread-local support. Disable perf context with -DNPERF_CONTEXT."
#error "No thread-local support. Disable perf context with -DNPERF_CONTEXT."
^
1 error generated.
monitoring/iostats_context.cc:19:2: error: "No thread-local support. Disable iostats context with -DNIOSTATS_CONTEXT."
#error \
^
1 error generated.
$DEBUG_LEVEL is 0
monitoring/iostats_context.cc:19:2: error: "No thread-local support. Disable iostats context with -DNIOSTATS_CONTEXT."
#error \
^
monitoring/perf_context.cc:23:2: error: "No thread-local support. Disable perf context with -DNPERF_CONTEXT."
#error "No thread-local support. Disable perf context with -DNPERF_CONTEXT."
^
1 error generated.
1 error generated.
In file included from cache/sharded_cache.cc:16:
In file included from ./util/hash.h:26:
./util/fastrange.h:60:5: error: unknown type name '__uint128_t'
__uint128_t wide = __uint128_t{range} * hash;
^
./util/fastrange.h:60:24: error: use of undeclared identifier '__uint128_t'
__uint128_t wide = __uint128_t{range} * hash;
^
./util/fastrange.h:60:35: error: expected ';' at end of declaration
__uint128_t wide = __uint128_t{range} * hash;
^
;
./util/fastrange.h:53:35: error: unused parameter 'hash' [-Werror,-Wunused-parameter]
static inline Range Fn(uint64_t hash, Range range) {
^
./util/fastrange.h:53:47: error: unused parameter 'range' [-Werror,-Wunused-parameter]
static inline Range Fn(uint64_t hash, Range range) {
^
5 errors generated.
I try adding the relevant flags to the CFLAGS variable, and also add the -std=c++17 flag to attempt to resolve the uint__128 issue.
This then fails with
./cache/lru_cache.h:269:11: error: aligned deallocation function of type 'void (void *, std::align_val_t) noexcept' is only available on iOS 11 or newer
virtual ~LRUCacheShard() override = default;
^
cache/lru_cache.cc:656:18: note: in defaulted destructor for 'rocksdb::LRUCacheShard' first required here
shards_[i].~LRUCacheShard();
^
./cache/lru_cache.h:269:11: note: if you supply your own aligned allocation functions, use -faligned-allocation to silence this diagnostic
virtual ~LRUCacheShard() override = default;
^
1 error generated.
This is not resolved using by changing the IOS_SDK_VERSION to a newer version in the build-rockdb-ios.sh script.
I was hence looking for someone who has compiled a recent version of rocksdb/a wrapper of rocksdb for iOS and am looking for guidance.
TIA
Try RocksDB 6.x version, from 7.0 RocksDB need C++17。
Dropping some compiler support in 7.0#9388
#Xcode Version 13.2.1 (13C100)
$ brew install git
$ brew install cmake
$ git clone https://github.com/facebook/rocksdb.git
$ git checkout v6.29.5
$ export PORTABLE=1
$ export TARGET_OS=IOS
$ export ROCKSDB_LITE=1
$ export IOS_CROSS_COMPILE=1
#disable int128
$ export TEST_UINT128_COMPAT=1
$ export DISABLE_WARNING_AS_ERROR=1
$ export DEBUG_LEVEL=0
$ export EXTRA_CXXFLAGS="-DNPERF_CONTEXT -DNIOSTATS_CONTEXT"
$ make V=1 VERBOSE=1 -j16 static_lib

MacOS RStudio accessing wrong clang after upgrade to Catalina

After an upgrade to MacOS Catalina, I find that I can no longer install packages from source in the RStudio IDE (v1.2.5001, current stable release).
Example:
> install.packages("processx", type = "source")
trying URL 'https://cran.rstudio.com/src/contrib/processx_3.4.1.tar.gz'
Content type 'application/x-gzip' length 123430 bytes (120 KB)
==================================================
downloaded 120 KB
* installing *source* package ‘processx’ ...
** package ‘processx’ successfully unpacked and MD5 sums checked
** libs
/usr/local/clang4/bin/clang -Wall -g -O2 -Wall tools/px.c -o tools/px
make: *** [tools/px] Killed: 9
ERROR: compilation failed for package ‘processx’
* removing ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/processx’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/processx’
Warning in install.packages :
installation of package ‘processx’ had non-zero exit status
In the process I get a popup with this message:
“clang-4.0” cannot be opened because the developer cannot be verified.
It seems that RStudio is pointed at clang from XCode 11.1, rather than the clang 8 I got from CRAN https://cran.r-project.org/bin/macosx/tools/.
Straight from R (e.g. sudo -i R in my terminal) a source install works fine, so it seems to be a matter of getting RStudio to look in the right place for the clang binary.
Any ideas?
I changed my ~/.R/Makevars file to point to a newer version of clang (R recommends 8+), e.g. CC=/usr/local/opt/llvm/bin/clang. I commented out the clang4 lines and created a new set pointing to the updated clang. Worked like a charm, now able to install R packages as usual.
Note: I had previously used brew to update llvm, which installed clang9.
Hope that helps!

How to fix “swift package generate-xcodeproj” results in manifest parse error?

I'm new to Swift and the Package Manager. I'm following a tutorial that generates the Xcode project file, but I get errors when I run "swift package generate-xcodeproj" (or "swift package update" for that matter). Below is the output.
It looks like it doesn't recognise the 'uuid_string_t' type in hfs_format.h header file.
Any ideas on how to solve this? I'm using Xcode 10.2 and Swift 5 on macOS 10.14.4. My Xcode Command Line Tools setting under the Location Preferences tab is set to 10.2.
/Users/rayscott/Developer/Source/Swift/TCPClient: error: manifest parse error(s):
:353:9: note: in file included from :353:
#import "hfs/hfs_format.h"
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/hfs/hfs_format.h:794:2: error: unknown type name 'uuid_string_t'
uuid_string_t ext_jnl_uuid;
^
:353:9: note: in file included from :353:
#import "hfs/hfs_format.h"
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/hfs/hfs_format.h:796:20: error: use of undeclared identifier 'uuid_string_t'; did you mean 'uuid_variant'?
char reserved[JIB_RESERVED_SIZE];
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/hfs/hfs_format.h:787:61: note: expanded from macro 'JIB_RESERVED_SIZE'
#define JIB_RESERVED_SIZE ((32*sizeof(u_int32_t)) - sizeof(uuid_string_t) - 48)
^
/usr/local/include/uuid/uuid.h:98:5: note: 'uuid_variant' declared here
int uuid_variant(const uuid_t uu);
^
:0: error: could not build Objective-C module 'Darwin'
I had the same issue after installing Xcode 10.2 and macOS 10.14.4. Solution for me was to run the following commands in Terminal:
brew doctor, and fix the mentioned issues
sudo xcode-select --reset
After executing these steps I did a reboot, and build started to work again.

Cordova Local Notification plugin failing with linker command when building project in Xcode

I'm using the Cordova Local Notification plugin in conjunction with ngCordova. My environment is Xcode 7.2 on OS X El Capitan.
This is what I'm doing (Mac OS X)
ionic build ios
open path/to/Project.xcodeproject
Then I try to build the project with Xcode and it throws this linker error:
duplicate symbol _UIApplicationRegisterUserNotificationSettings in:
/Users/aaronwells/Library/Developer/Xcode/DerivedData/WorkwellNW-bdstegwryfvyatdpihlpdjnexcnk/Build/Intermediates/WorkwellNW.build/Debug-iphonesimulator/WorkwellNW.build/Objects-normal/x86_64/AppDelegate+APPRegisterUserNotificationSettings.o
/Users/aaronwells/Library/Developer/Xcode/DerivedData/WorkwellNW-bdstegwryfvyatdpihlpdjnexcnk/Build/Intermediates/WorkwellNW.build/Debug-iphonesimulator/WorkwellNW.build/Objects-normal/x86_64/AppDelegate+APPLocalNotification.o
ld: 1 duplicate symbol for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
So I inspected the source files for AppDelegate+APPRegisterUserNotificationSettings.o, and AppDelegate+APPLocalNotification.o:
AppDelegate+APPRegisterUserNotificationSettings.h:
extern NSString* const UIApplicationRegisterUserNotificationSettings;
AppDelegate+APPRegisterUserNotificationSettings.m:
NSString* const UIApplicationRegisterUserNotificationSettings = #"UIApplicationRegisterUserNotificationSettings";
AppDelegate+APPLocalNotification.h:
extern NSString* const UIApplicationRegisterUserNotificationSettings;
AppDelegate+APPLocalNotification.m:
NSString* const UIApplicationRegisterUserNotificationSettings = #"UIApplicationRegisterUserNotificationSettings";
Okay, so I think the problem is duplicate constant declarations/initializations across source files in the plugin. But why am I not seeing this issue elsewhere for this plugin? What is the recommended way to resolve this issue? Is this an issue with the plugin (in which case I would open an issue on github)? Is it machine specific?
I had the wrong versions installed. cordova-plugin-local-notification depends on RegisterUserNotificationSettings. My Cordova Local Notifications version was 0.8.1, which contained a conflicting object with RegisterNotificationSettings 1.0.1. Once I had updated the local notification to version 0.8.2, the problem vanished.

Error compiling Mosquitto 1.4

I have tried to compile Mosquitto on both Arch and CentOS 7, but everytime I get the same error. I want to test the Websocket feature.
This is the procedure I am using for CentOS:
yum group install "Development Tools"
yum install cmake openssl-devel cmake
yum install uuid-devel libxslt docbook5-style-xsl.noarch docbook-style-xsl.noarch
git clone https://github.com/warmcat/libwebsockets.git
cd libwebsockets/
mkdir build;cd build
cmake ..
make
make install
git clone https://git.eclipse.org/r/mosquitto/org.eclipse.mosquitto
cd org.eclipse.mosquitto/
git checkout origin/1.4
vi config.mk
Change "WITH_WEBSOCKETS:=yes"
make
And this is where it dies on Arch and CentOS:
make[1]: Entering directory '/home/install/org.eclipse.mosquitto/src'
cc -Wall -ggdb -O2 -I. -I.. -I../lib -DVERSION="\"1.4\"" -DTIMESTAMP="\"2015-05-04 17:17:55+0200\"" -DWITH_BROKER -DWITH_TLS -DWITH_TLS_PSK -DWITH_UUID -DWITH_BRIDGE -DWITH_PERSISTENCE -DWITH_MEMORY_TRACKING -DWITH_SYS_TREE -DWITH_WEBSOCKETS -DWITH_EC -c mosquitto.c -o mosquitto.o
In file included from /usr/include/unistd.h:25:0,
from mosquitto.c:22:
/usr/include/features.h:148:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
# warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
mosquitto.c: In function ‘main’:
mosquitto.c:275:101: error: expected expression before ‘,’ token
_mosquitto_log_printf(NULL, MOSQ_LOG_INFO, "mosquitto version %s (build date %s) starting", VERSION, TIMESTAMP);
mosquitto.c:290:54: error: expected expression before ‘)’ token
snprintf(buf, 1024, "mosquitto version %s", VERSION);
mosquitto.c:368:88: error: expected expression before ‘)’ token
_mosquitto_log_printf(NULL, MOSQ_LOG_INFO, "mosquitto version %s terminating", VERSION);
Makefile:15: recipe for target 'mosquitto.o' failed
make[1]: *** [mosquitto.o] Error 1
make[1]: Leaving directory '/home/install/org.eclipse.mosquitto/src'
Makefile:21: recipe for target 'mosquitto' failed
make: *** [mosquitto] Error 2
If someone can please point out what I am doing wrong or missing ?
As #hardillb says, the VERSION defines are the problem. If I add the line
#define VERSION
to mosquitto.c, then I can reproduce the error that you see, but also get a warning about redefining VERSION.
If I remove the definition of VERSION from config.mk, then I get an error about VERSION not being defined.
These both make sense.
What seems to be happening for you is that the compiler is ignoring the command line definition -DVERSION="\"1.4.1\"" and replacing it with -DVERSION=, or isn't parsing the string properly. This doesn't make sense.
Other people have managed to compile on Arch, and the CentOS7 repository has a binary version - but without websockets.
After some investigation, it appears as though there is a bug in recent libwebsockets code. This changeset introduces some changes that mean that libwebsockets is claiming the macro VERSION all for itself, which isn't very polite for a library. If you use a released version of libwebsockets you should not have any problem compiling.
Just out of interest have you tried building from the TGZ src bundle for Mosquitto 1.4.1 available here:
http://mosquitto.org/download/
The errors look to be something to do with expanding the passed in VERSION and TIMESTAMP values. It builds fine [with the exception of the docs] on Fedora 20 which shouldn't be that far from RHEL 7.0 (and from there to Centos 7).

Resources