New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ocamlopt on Cygwin64: caml_program, caml_apply2, caml_apply3 in amd64.S (and, possibly, others) are undefined #6041
Comments
Comment author: Camarade_Tux Hi, I hadn't noticed at first but this is Cygwin 64. As far as I know it's a very recent platform and I wouldn't be surprised if you were the first to try to build ocaml on it. The fact that you had to hack around the SYSTEM variable makes me even more suspicious it's a known platform to the ocaml compiler's build system. What did you have to do with that variable? Can you run "file" and "nm" on the "libasmrun.a" file? |
Comment author: Vasiliy Cygwin64 setup: $ file libasmrun.a $ nm libasmrun.a startup.o: main.o: fail.o: roots.o: globroots.o: signals.o: signals_asm.o: misc.o: freelist.o: major_gc.o: minor_gc.o: memory.o: alloc.o: compare.o: ints.o: floats.o: str.o: array.o: io.o: extern.o: intern.o: hash.o: sys.o: parsing.o: gc_ctrl.o: terminfo.o: md5.o: obj.o: lexing.o: printexc.o: callback.o: weak.o: compact.o: |
Comment author: @protz Hi, Why are you using Cygwin64? You don't need the 64-bit version of Cygwin to produce a mingw64 version of OCaml. As long as you install the i686-mingw32-w64 packages from Cygwin, the resulting OCaml compiler will be a 64-bit program that produces 64-bit executables. Cheers, jonathan |
Comment author: @xavierleroy Cygwin64 is not (yet) a platform supported by the OCaml native-code compiler. It is likely to have significant differences with the MinGW64 platform, which is supported. So, I record your PR as a feature wish to support Cygwin64. Outside contributions are welcome. |
Comment author: Vasiliy The answer is fairly simple: to work with POSIX paths. Besides, i686-mingw32-w64 compiler would surely need as the same libraries as x86_64-pc-cygwin does, so there is not so much relevance to the reported symbols missing. BTW, I've tried to compile amd64.S with x86_64-mingw32-w64 and there's very much the same outcome. |
Comment author: @damiendoligez Commits 14335 (for 4.01) and 14337 (for trunk) make OCaml work on cygwin-64. Without dynamic linking for the moment because flexdll is not yet available. Keeping this PR open as a wish for Flexdll. |
This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc. |
Original bug ID: 6041
Reporter: Vasiliy
Status: acknowledged (set by @xavierleroy on 2013-06-17T08:03:57Z)
Resolution: open
Severity: feature
Platform: x86_64
OS: Cygwin
OS Version: 1.7.21(0.266/5/3
Version: 4.00.1
Category: configure and build/install
Tags: patch
Monitored by: @alainfrisch
Bug description
When I try to compile OCaml on Cygwin 64-bit (after some hack with 'SYSTEM' variable), I get the following errors:
gcc -DSYS_mingw64 -o amd64.o amd64.S -L../stdlib -lasmrun ||
{ echo "If your assembler produced syntax errors, it is probably unhappy with the"; echo "preprocessor. Check your assembler, or try producing amd64.o by hand."; exit 2; }
/tmp/cc1pjYsj.o:fake:(.text+0x29f): undefined reference to
caml_program' /tmp/cc1pjYsj.o:fake:(.text+0x29f): relocation truncated to fit: R_X86_64_PC32 against undefined symbol
caml_program'/tmp/cc1pjYsj.o:fake:(.text+0x4cc): undefined reference to
caml_apply2' /tmp/cc1pjYsj.o:fake:(.text+0x4cc): relocation truncated to fit: R_X86_64_PC32 against undefined symbol
caml_apply2'/tmp/cc1pjYsj.o:fake:(.text+0x543): undefined reference to
caml_apply3' /tmp/cc1pjYsj.o:fake:(.text+0x543): relocation truncated to fit: R_X86_64_PC32 against undefined symbol
caml_apply3'/usr/lib/gcc/x86_64-pc-cygwin/4.8.1/../../../../x86_64-pc-cygwin/bin/ld: /tmp/cc1pjYsj.o: bad reloc address 0x8 in section
.data' /usr/lib/gcc/x86_64-pc-cygwin/4.8.1/../../../../x86_64-pc-cygwin/bin/ld: final link failed: Invalid operation collect2: error: ld returned 1 exit status If your assembler produced syntax errors, it is probably unhappy with the preprocessor. Check your assembler, or try producing amd64.o by hand. Makefile:175: recipe for target
amd64.o' failedmake: *** [amd64.o] Error 2
Steps to reproduce
cd asmrun
gcc -DSYS_mingw64 -o amd64.o amd64.S -L../stdlib -lasmrun
(note: libasmrun does not have the above symbols defined, but the rest, and the search path should to be added additionally)
Additional information
config/m.h:
#define ARCH_SIXTYFOUR
#define SIZEOF_INT 4
#define SIZEOF_LONG 8
#define SIZEOF_PTR 8
#define SIZEOF_SHORT 2
#define ARCH_INT64_TYPE long
#define ARCH_UINT64_TYPE unsigned long
#define ARCH_INT64_PRINTF_FORMAT "l"
#undef ARCH_BIG_ENDIAN
#undef ARCH_ALIGN_DOUBLE
#undef ARCH_ALIGN_INT64
#undef NONSTANDARD_DIV_MOD
config/s.h:
#define OCAML_OS_TYPE "Cygwin"
#define OCAML_STDLIB_DIR "/usr/lib/ocaml"
#define POSIX_SIGNALS
#define HAS_C99_FLOAT_OPS
#define HAS_GETRUSAGE
#define HAS_TIMES
#define HAS_TERMCAP
#define HAS_SOCKETS
#define HAS_SOCKLEN_T
#define HAS_INET_ATON
#define HAS_IPV6
#define HAS_UNISTD
#define HAS_OFF_T
#define HAS_DIRENT
#define HAS_REWINDDIR
#define HAS_LOCKF
#define HAS_MKFIFO
#define HAS_GETCWD
#define HAS_GETWD
#define HAS_GETPRIORITY
#define HAS_UTIME
#define HAS_UTIMES
#define HAS_DUP2
#define HAS_FCHMOD
#define HAS_TRUNCATE
#define HAS_SYS_SELECT_H
#define HAS_SELECT
#define HAS_SYMLINK
#define HAS_WAITPID
#define HAS_WAIT4
#define HAS_GETGROUPS
#define HAS_SETGROUPS
#define HAS_INITGROUPS
#define HAS_TERMIOS
#define HAS_SETITIMER
#define HAS_GETHOSTNAME
#define HAS_UNAME
#define HAS_GETTIMEOFDAY
#define HAS_MKTIME
#define HAS_PUTENV
#define HAS_LOCALE
#define HAS_MMAP
#define HAS_PWRITE
#define HAS_SIGWAIT
config/Makefile:
generated by ./configure -bindir /usr/bin -libdir /usr/lib/ocaml -mandir /usr/share/man -no-tk
PREFIX=/usr
BINDIR=/usr/bin
LIBDIR=/usr/lib/ocaml
STUBLIBDIR=$(LIBDIR)/stublibs
MANDIR=/usr/share/man
MANEXT=1
RANLIB=ranlib
RANLIBCMD=ranlib
ARCMD=ar
SHARPBANGSCRIPTS=false
BNG_ARCH=generic
BNG_ASM_LEVEL=0
PTHREAD_LINK=-cclib -lpthread
X11_INCLUDES=
X11_LINK=-lX11 -lxcb -lXau -lXdmcp
TK_DEFS=
TK_LINK=
LIBBFD_LINK=
BYTECC=gcc
BYTECCCOMPOPTS=-fno-defer-pop -Wall -U_WIN32 -D_FILE_OFFSET_BITS=64 -D_REENTRANT
BYTECCLINKOPTS=
BYTECCLIBS= -lm -lcurses -lpthread
BYTECCRPATH=
EXE=.exe
SUPPORTS_SHARED_LIBRARIES=false
SHAREDCCCOMPOPTS=
MKSHAREDLIBRPATH=
NATDYNLINKOPTS=
SYSLIB=-l$(1)
#ml let syslib x = "-l"^x;;
How to build a static library
MKLIB=ar rc$(1) $ (2); ranlib $(1)
#ml let mklib out files opts = Printf.sprintf "ar rc %s %s %s; ranlib %s" out opts files out;;
ARCH=amd64
MODEL=default
SYSTEM=mingw64
NATIVECC=gcc
NATIVECCCOMPOPTS=-Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT
NATIVECCPROFOPTS=-Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT
NATIVECCLINKOPTS=
NATIVECCRPATH=
NATIVECCLIBS= -lm
ASM=as
ASPP=gcc
ASPPPROFFLAGS=-DPROFILING
PROFILING=noprof
DYNLINKOPTS=
OTHERLIBRARIES=unix str num dynlink bigarray systhreads threads graph
DEBUGGER=ocamldebugger
CC_PROFILE=-pg
SYSTHREAD_SUPPORT=true
PARTIALLD=ld -r
PACKLD=$(PARTIALLD) $(NATIVECCLINKOPTS) -o\
DLLCCCOMPOPTS=-U_WIN32 -DCAML_DLL
IFLEXDIR=
O=o
A=a
SO=so
EXT_OBJ=.o
EXT_ASM=.s
EXT_LIB=.a
EXT_DLL=.so
EXTRALIBS=
CCOMPTYPE=cc
TOOLCHAIN=cc
NATDYNLINK=false
CMXS=cmxa
MKEXE=$(BYTECC)
MKEXEDEBUGFLAG=-g
MKDLL=
MKMAINDLL=
RUNTIMED=noruntimed
CAMLP4=camlp4
ASM_CFI_SUPPORTED=false
The text was updated successfully, but these errors were encountered: