What is needed to get mupdf to compile on macOS (Monterey) - clang

Mupdf no longer compiles on macOS 12.16.1. Using MacPorts for instance gives:
:info:build mkdir -p build/shared-release/generated/resources/fonts/noto/ ; /usr/bin/clang -ffunction-sections -fdata-sections -pipe -O2 -DNDEBUG -fomit-frame-pointer -Os -arch x86_64 -Iinclude -MMD -MP -o build/shared-release/generated/resources/fonts/noto/NotoSansOldPermic-Regular.otf.o -c generated/resources/fonts/noto/NotoSansOldPermic-Regular.otf.c -Wall -Wsign-compare -fPIC -O0
:info:build mkdir -p build/shared-release/generated/resources/fonts/noto/ ; /usr/bin/clang -ffunction-sections -fdata-sections -pipe -O2 -DNDEBUG -fomit-frame-pointer -Os -arch x86_64 -Iinclude -MMD -MP -o build/shared-release/generated/resources/fonts/noto/NotoSansOldPersian-Regular.otf.o -c generated/resources/fonts/noto/NotoSansOldPersian-Regular.otf.c -Wall -Wsign-compare -fPIC -O0
:info:build clang: note: diagnostic msg:
:info:build ********************
:info:build PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
:info:build Preprocessed source(s) and associated run script(s) are located at:
:info:build clang: note: diagnostic msg: /opt/local/var/macports/build/_Users_gerben_MacPortsDev_macports-ports_graphics_mupdf/mupdf/work/.tmp/SourceHanSerif-Regular-5d1585.c
:info:build clang: note: diagnostic msg: /opt/local/var/macports/build/_Users_gerben_MacPortsDev_macports-ports_graphics_mupdf/mupdf/work/.tmp/SourceHanSerif-Regular-5d1585.sh
:info:build clang: note: diagnostic msg: Crash backtrace is located in
:info:build clang: note: diagnostic msg: /opt/local/var/macports/build/_Users_gerben_MacPortsDev_macports-ports_graphics_mupdf/mupdf/work/.home/Library/Logs/DiagnosticReports/clang_<YYYY-MM-DD-HHMMSS>_<hostname>.crash
:info:build clang: note: diagnostic msg: (choose the .crash file that corresponds to your crash)
:info:build clang: note: diagnostic msg:
:info:build ********************
:info:build make[1]: *** [build/shared-release/generated/resources/fonts/han/SourceHanSerif-Regular.ttc.o] Error 254
:info:build make[1]: *** Waiting for unfinished jobs....
:info:build make[1]: Leaving directory `/opt/local/var/macports/build/_Users_gerben_MacPortsDev_macports-ports_graphics_mupdf/mupdf/work/mupdf-1.20.3-source'
:info:build make: *** [shared-release] Error 2
:info:build make: *** Waiting for unfinished jobs....
:info:build make: Leaving directory `/opt/local/var/macports/build/_Users_gerben_MacPortsDev_macports-ports_graphics_mupdf/mupdf/work/mupdf-1.20.3-source'
:info:build Command failed: cd "/opt/local/var/macports/build/_Users_gerben_MacPortsDev_macports-ports_graphics_mupdf/mupdf/work/mupdf-1.20.3-source" && /usr/bin/make -j6 -w all PREFIX=/opt/local CC=/usr/bin/clang CXX=/usr/bin/clang++ CPP=/usr/bin/cpp XCFLAGS="-Os -arch x86_64" XLIBS="-L/opt/local/lib -Wl,-headerpad_max_install_names -arch x86_64" HAVE_GLUT=yes HAVE_X11=no USE_SYSTEM_LIBS=yes build=release verbose=yes shared
:info:build Exit code: 2
:error:build Failed to build mupdf: command execution failed
:debug:build Error code: CHILDSTATUS 99706 2
:debug:build Backtrace: command execution failed
:debug:build while executing
:debug:build "system {*}$notty {*}$callback {*}$nice $fullcmdstring"
:debug:build invoked from within
:debug:build "command_exec -callback portprogress::target_progress_callback build"
:debug:build (procedure "portbuild::build_main" line 8)
:debug:build invoked from within
:debug:build "$procedure $targetname"
:error:build See /opt/local/var/macports/logs/_Users_gerben_MacPortsDev_macports-ports_graphics_mupdf/mupdf/main.log for details.
In MacPorts this is a known issue and it seems related to clang not being able to compile something because it runs out of resources when compiling NotoSansOldPersian-Regular.otf
Is there maybe a config or something we could temporary workaround by telling the mupdf configure not to compile this font? People (see ticket) already tried turning optimization off, using another compiler, but it is a more fundamental problem.

Related

Error while building 'luac' executable in RHEL6.6

I am trying to build lua-5.3.1 in Red Hat Enterprise Linux 6.6 platform. Following binaries will be build :
shared library : liblua.so
executable : lua
executable : luac
I have made the following changes in the provided Makefile :
Existing :
CC= gcc -std=gnu99
LUA_A= liblua.a
$(LUA_A): $(BASE_O)
$(AR) $# $(BASE_O)
$(RANLIB) $#
Modified :
CC= gcc -fPIC
LUA_A= liblua.so
$(LUA_A): $(BASE_O)
$(CC) -mthreads -shared -o $(LUA_A) $(BASE_O)
'liblua.so' and 'lua' have been built successfully using the modified Makefile. But during 'luac' build following linking error is coming :
gcc -fPIC -O2 -Wall -Wextra -DLUA_COMPAT_5_2 -DLUA_USE_LINUX -c -o luac.o luac.c
gcc -fPIC -o luac luac.o liblua.so -lm -Wl,-E -ldl -lreadline
luac.o: In function `PrintFunction':
luac.c:(.text+0x947): undefined reference to `luaP_opnames'
luac.c:(.text+0x963): undefined reference to `luaP_opmodes'
luac.o: In function `pmain':
luac.c:(.text+0x11db): undefined reference to `luaU_dump'
/usr/bin/ld: luac: hidden symbol `luaU_dump' isn't defined
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: ld returned 1 exit status
make[1]: *** [luac] Error 1
make[1]: Leaving directory `/disk1/u10rhel66/lua-5.3.1/src'
make: *** [linux] Error 2
Any help will be appreciated.
luac must be built statically linked with liblua.a.
If you really want luac linked dynamically, try this:
remove LUAI_DDEF and LUAI_DDEC from lopcodes.c and lopcodes.h
remove LUAI_FUNC from lundump.h
rebuild

ld: -bundle and -bitcode_bundle cannot be used together

i'm building llvm/clang 3.7 with bitcode support (-fembed-bitcode). Some modules can't be linked due to error:
ld: -bundle and -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES)
cannot be used together clang: error: linker command failed with exit
code 1 (use -v to see invocation)
Full error output:
Linking CXX shared module ../../lib/BugpointPasses.dylib cd
/Volumes/Transcend/dev/src/llvm_37_ios_any_build/tools/bugpoint-passes
&& /usr/local/Cellar/cmake/2.8.12.2/bin/cmake -E cmake_link_script
CMakeFiles/BugpointPasses.dir/link.txt --verbose=1 /usr/bin/c++
-fembed-bitcode -Os -std=c++11 -stdlib=libc++ -arch arm64 -mios-version-min=8.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk
-Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -pedantic -Wno-long-long -Wnon-virtual-dtor -O3 -DNDEBUG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk
-bundle -Wl,-headerpad_max_install_names -Wl,-dead_strip -Wl,-exported_symbols_list,/Volumes/Transcend/dev/src/llvm_37_ios_any_build/tools/bugpoint-passes/BugpointPasses.exports
-Wl,-flat_namespace -Wl,-undefined -Wl,suppress -o ../../lib/BugpointPasses.dylib
CMakeFiles/BugpointPasses.dir/TestPasses.cpp.o
-Wl,-rpath,#executable_path/../lib ld: -bundle and -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES) cannot be used together clang:
error: linker command failed with exit code 1 (use -v to see
invocation) make[2]: * [lib/BugpointPasses.dylib] Error 1 make[1]:
* [tools/bugpoint-passes/CMakeFiles/BugpointPasses.dir/all] Error 2 make: *** [all] Error 2
It seems that -bundle is added by CMake as i was not able to find it in CMakeLists.txt and -bitcode_bundle is added by SDK because of -fembed-bitcode.
How can i fix it? Any workaround (f.e. to switch off dylibs building since i don't need them)?
Check that you are not using Bundle loader in any of your projects:
and set match-O type to Executable instead of Bundle
Hope that helps, I had the same problem and fixed it
Set the Enable Bitcode build setting to No for your debug configuration:
If you don't see the Enable Bitcode option, make sure BaseSDK is set to either iOS, tvOS, or watchOS.

Can't compile libjpeg-turbo for iOS on Xcode 5 / Clang toolchain with SIMD / NEON support

Looks like with Xcode 5 and the removal of LLVM-GCC-4.2 and its replacement by Clang, building libjpeg-turbo for iOS devices now fails during the compilation of NEON support.
Configure step:
export PLATFORM="iPhoneOS"
export IPHONE_SDK="7.0"
export IPHONE_MIN_VERSION="5.0"
export DEVELOPER=`xcode-select --print-path`
export DEVROOT="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer"
export SDKROOT="${DEVROOT}/SDKs/${PLATFORM}${IPHONE_SDK}.sdk"
export CC=`xcrun -find gcc`
export LD=`xcrun -find ld`
export IOS_CFLAGS="-arch armv7"
export CFLAGS="-O3 ${IOS_CFLAGS} -isysroot ${SDKROOT}"
export LDFLAGS="${IOS_CFLAGS} -isysroot ${SDKROOT}"
export CPPFLAGS="${CFLAGS}"
export CFLAGS="${CFLAGS} -miphoneos-version-min=${IPHONE_MIN_VERSION}"
./configure --with-jpeg8 --host arm-apple-darwin --enable-static --disable-shared
...
checking if we have SIMD optimisations for cpu type... yes (arm)
checking if the assembler is GNU-compatible and can be used... yes
...
Build step:
make -j4
/Applications/Xcode.app/Contents/Developer/usr/bin/make all-recursive
Making all in java
echo timestamp > classnodist_noinst.stamp
Making all in simd
/Applications/Xcode.app/Contents/Developer/usr/bin/gcc -E -I.. -I../simd ./jsimdcfg.inc.h | grep -E "^[\;%]|^\ %" | sed 's%_cpp_protection_%%' | sed 's#% define#%define#g' > jsimdcfg.inc
/Applications/Xcode.app/Contents/Developer/usr/bin/make all-am
if /bin/sh ../libtool --mode=compile --tag=CC /Applications/Xcode.app/Contents/Developer/usr/bin/gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I.. -O3 -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -O3 -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -miphoneos-version-min=5.0 -MT jsimd_arm.lo -MD -MP -MF ".deps/jsimd_arm.Tpo" -c -o jsimd_arm.lo jsimd_arm.c; \
then mv -f ".deps/jsimd_arm.Tpo" ".deps/jsimd_arm.Plo"; else rm -f ".deps/jsimd_arm.Tpo"; exit 1; fi
/bin/sh ../libtool --mode=compile gas-preprocessor.pl /Applications/Xcode.app/Contents/Developer/usr/bin/gcc -O3 -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -miphoneos-version-min=5.0 -c -o jsimd_arm_neon.lo jsimd_arm_neon.S
libtool: compile: unable to infer tagged configuration
libtool: compile: specify a tag with `--tag'
make[3]: *** [jsimd_arm_neon.lo] Error 1
make[3]: *** Waiting for unfinished jobs....
/Applications/Xcode.app/Contents/Developer/usr/bin/gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I.. -O3 -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -O3 -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -miphoneos-version-min=5.0 -MT jsimd_arm.lo -MD -MP -MF .deps/jsimd_arm.Tpo -c jsimd_arm.c -o jsimd_arm.o
make[2]: *** [all] Error 2
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
Any idea how to fix this? The build succeeds if disabling SIMD support but that's obviously not great.
It has been fixed by the maintainer of libjpeg-turbo:
http://sourceforge.net/mailarchive/message.php?msg_id=31902025
What is needed is a special CLANG compatible version of gas-preprocessor:
http://sourceforge.net/p/libjpeg-turbo/code/HEAD/tree/gas-preprocessor/
There is a known issue when cross-compiling for iOS on OSX:
http://sourceforge.net/mailarchive/message.php?msg_id=30462917
In short, you need to run
$ autoreconf -fiv
in the libjpeg-turbo directory before running configure.
On OSX 10.9 and Xcode 5, below are the versions of tools that you will need to compile the lib successfully. Newer versions will not work.
autoconf 2.69
nasm 2.08.01
automake 1.13
Alternatively, you can just use the prebuilt binaries that comes with the DMG:
http://sourceforge.net/mailarchive/forum.php?thread_name=5255ABCE.8070705%40users.sourceforge.net&forum_name=libjpeg-turbo-users

I can't install rails correctly on mac

I attempt to intsall rails on mac by error still exist
I really frustrated and want some suggestions
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
creating Makefile
make "DESTDIR="
xcrun cc -I. -I. - I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal- darwin12.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE -fno-common -pipe -fno-common -c atomic_reference.c
xcrun: Error: could not stat active Xcode path '/Developer'. (No such file or directory)
cc -arch i386 -arch x86_64 -pipe -bundle -undefined dynamic_lookup -o atomic_reference.bundle atomic_reference.o -L. - L/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib -L. -arch i386 -arch x86_64 -lruby -lpthread -ldl -lobjc
clang: error: no such file or directory: 'atomic_reference.o'
make: *** [atomic_reference.bundle] Error 1
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/atomic-1.1.12 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/atomic-1.1.12/ext/gem_make.out
I've found the best way is with Homebrew and RVM. There's an excellent Railscast on this: http://railscasts.com/episodes/310-getting-started-with-rails

Erros while installing 'therubyracer-heroku' gem

I am trying to do a gem install therubyracer-heroku -v '0.8.1.pre3', but I am getting errors while building, it is a big log but here is the last failing lines (pasted full log in the end):
g++ -o obj/release/bootstrapper.o -c -Wall -Werror -W -Wno-unused-parameter -Wnon-virtual-dtor -pedantic -m32 -O3 -fomit-frame-pointer -fdata-sections -ffunction-sections -ansi -fno-rtti -fno-exceptions -fvisibility=hidden -Wall -Werror -W -Wno-unused-parameter -Wnon-virtual-dtor -pedantic -m32 -O3 -fomit-frame-pointer -fdata-sections -ffunction-sections -ansi -DV8_TARGET_ARCH_IA32 -DENABLE_VMSTATE_TRACKING -DENABLE_LOGGING_AND_PROFILING -DENABLE_DEBUGGER_SUPPORT -Isrc src/bootstrapper.cc
src/bootstrapper.cc: In static member function 'static bool v8::internal::Genesis::CompileScriptCached(v8::internal::Vector<const char>, v8::internal::Handle<v8::internal::String>, v8::internal::SourceCodeCache*, v8::Extension*, v8::internal::Handle<v8::internal::Context>, bool)':
src/bootstrapper.cc:1002:18: error: variable 'result' set but not used [-Werror=unused-but-set-variable]
src/bootstrapper.cc: In member function 'bool v8::internal::Genesis::InstallNatives()':
src/bootstrapper.cc:1227:24: error: variable 'name' set but not used [-Werror=unused-but-set-variable]
cc1plus: all warnings being treated as errors
scons: *** [obj/release/bootstrapper.o] Error 1
scons: building terminated because of errors.
make: *** [build/v8/libv8.a] Error 2
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
I have googled about his for many hours and looked into a lot of SO similar questions, but nothing helped, also I don't know what is mkmf log mean and where to find it.
Additional information:
OS: Ubuntu, 12.04
I already have nodeJs installed, version is v0.8.14 (Just giving this info, since it may be linked with this)
Ruby version: 1.9.3
RVM is used

Resources